智慧水务管理系统 - 精河县供水工程综合管理平台

index-native.cjs 323KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591
  1. 'use strict';
  2. var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
  3. /*
  4. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions are met:
  7. 1. Redistributions of source code must retain the above copyright notice,
  8. this list of conditions and the following disclaimer.
  9. 2. Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the distribution.
  12. 3. The names of the authors may not be used to endorse or promote products
  13. derived from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  15. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  16. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  17. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  19. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  20. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  21. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  22. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  23. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. const MAX_32_BITS = 0xffffffff;
  26. const MAX_16_BITS = 0xffff;
  27. const MAX_8_BITS = 0xff;
  28. const COMPRESSION_METHOD_DEFLATE = 0x08;
  29. const COMPRESSION_METHOD_DEFLATE_64 = 0x09;
  30. const COMPRESSION_METHOD_STORE = 0x00;
  31. const COMPRESSION_METHOD_AES = 0x63;
  32. const LOCAL_FILE_HEADER_SIGNATURE = 0x04034b50;
  33. const SPLIT_ZIP_FILE_SIGNATURE = 0x08074b50;
  34. const DATA_DESCRIPTOR_RECORD_SIGNATURE = SPLIT_ZIP_FILE_SIGNATURE;
  35. const CENTRAL_FILE_HEADER_SIGNATURE = 0x02014b50;
  36. const END_OF_CENTRAL_DIR_SIGNATURE = 0x06054b50;
  37. const ZIP64_END_OF_CENTRAL_DIR_SIGNATURE = 0x06064b50;
  38. const ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE = 0x07064b50;
  39. const END_OF_CENTRAL_DIR_LENGTH = 22;
  40. const ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH = 20;
  41. const ZIP64_END_OF_CENTRAL_DIR_LENGTH = 56;
  42. const ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH = END_OF_CENTRAL_DIR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LENGTH;
  43. const DATA_DESCRIPTOR_RECORD_LENGTH = 12;
  44. const DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH = 20;
  45. const DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH = 4;
  46. const EXTRAFIELD_TYPE_ZIP64 = 0x0001;
  47. const EXTRAFIELD_TYPE_AES = 0x9901;
  48. const EXTRAFIELD_TYPE_NTFS = 0x000a;
  49. const EXTRAFIELD_TYPE_NTFS_TAG1 = 0x0001;
  50. const EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP = 0x5455;
  51. const EXTRAFIELD_TYPE_UNICODE_PATH = 0x7075;
  52. const EXTRAFIELD_TYPE_UNICODE_COMMENT = 0x6375;
  53. const EXTRAFIELD_TYPE_USDZ = 0x1986;
  54. const EXTRAFIELD_TYPE_INFOZIP = 0x7875;
  55. const EXTRAFIELD_TYPE_UNIX = 0x7855;
  56. const BITFLAG_ENCRYPTED = 0b1;
  57. const BITFLAG_LEVEL = 0b0110;
  58. const BITFLAG_LEVEL_MAX_MASK = 0b010;
  59. const BITFLAG_LEVEL_FAST_MASK = 0b100;
  60. const BITFLAG_LEVEL_SUPER_FAST_MASK = 0b110;
  61. const BITFLAG_DATA_DESCRIPTOR = 0b1000;
  62. const BITFLAG_LANG_ENCODING_FLAG = 0b100000000000;
  63. const FILE_ATTR_MSDOS_DIR_MASK = 0b10000;
  64. const FILE_ATTR_MSDOS_READONLY_MASK = 0x01;
  65. const FILE_ATTR_MSDOS_HIDDEN_MASK = 0x02;
  66. const FILE_ATTR_MSDOS_SYSTEM_MASK = 0x04;
  67. const FILE_ATTR_MSDOS_ARCHIVE_MASK = 0x20;
  68. const FILE_ATTR_UNIX_TYPE_MASK = 0o170000;
  69. const FILE_ATTR_UNIX_TYPE_DIR = 0o040000;
  70. const FILE_ATTR_UNIX_EXECUTABLE_MASK = 0o111;
  71. const FILE_ATTR_UNIX_DEFAULT_MASK = 0o644;
  72. const FILE_ATTR_UNIX_SETUID_MASK = 0o4000;
  73. const FILE_ATTR_UNIX_SETGID_MASK = 0o2000;
  74. const FILE_ATTR_UNIX_STICKY_MASK = 0o1000;
  75. const VERSION_DEFLATE = 0x14;
  76. const VERSION_ZIP64 = 0x2D;
  77. const VERSION_AES = 0x33;
  78. const DIRECTORY_SIGNATURE = "/";
  79. const HEADER_SIZE = 30;
  80. const HEADER_OFFSET_SIGNATURE = 10;
  81. const HEADER_OFFSET_COMPRESSED_SIZE = 14;
  82. const HEADER_OFFSET_UNCOMPRESSED_SIZE = 18;
  83. const MAX_DATE = new Date(2107, 11, 31);
  84. const MIN_DATE = new Date(1980, 0, 1);
  85. const UNDEFINED_VALUE = undefined;
  86. const INFINITY_VALUE = Infinity;
  87. const UNDEFINED_TYPE = "undefined";
  88. const FUNCTION_TYPE = "function";
  89. const OBJECT_TYPE = "object";
  90. /*
  91. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  92. Redistribution and use in source and binary forms, with or without
  93. modification, are permitted provided that the following conditions are met:
  94. 1. Redistributions of source code must retain the above copyright notice,
  95. this list of conditions and the following disclaimer.
  96. 2. Redistributions in binary form must reproduce the above copyright
  97. notice, this list of conditions and the following disclaimer in
  98. the documentation and/or other materials provided with the distribution.
  99. 3. The names of the authors may not be used to endorse or promote products
  100. derived from this software without specific prior written permission.
  101. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  102. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  103. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  104. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  105. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  106. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  107. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  108. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  109. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  110. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  111. */
  112. const MINIMUM_CHUNK_SIZE = 64;
  113. let maxWorkers = 2;
  114. try {
  115. if (typeof navigator != UNDEFINED_TYPE && navigator.hardwareConcurrency) {
  116. maxWorkers = navigator.hardwareConcurrency;
  117. }
  118. } catch {
  119. // ignored
  120. }
  121. const DEFAULT_CONFIGURATION = {
  122. workerURI: "./core/web-worker-wasm.js",
  123. wasmURI: "./core/streams/zlib-wasm/zlib-streams.wasm",
  124. chunkSize: 64 * 1024,
  125. maxWorkers,
  126. terminateWorkerTimeout: 5000,
  127. useWebWorkers: true,
  128. useCompressionStream: true,
  129. CompressionStream: typeof CompressionStream != UNDEFINED_TYPE && CompressionStream,
  130. DecompressionStream: typeof DecompressionStream != UNDEFINED_TYPE && DecompressionStream
  131. };
  132. const config = Object.assign({}, DEFAULT_CONFIGURATION);
  133. function getConfiguration() {
  134. return config;
  135. }
  136. function getChunkSize(config) {
  137. return Math.max(config.chunkSize, MINIMUM_CHUNK_SIZE);
  138. }
  139. function configure(configuration) {
  140. const {
  141. baseURI,
  142. chunkSize,
  143. maxWorkers,
  144. terminateWorkerTimeout,
  145. useCompressionStream,
  146. useWebWorkers,
  147. CompressionStream,
  148. DecompressionStream,
  149. CompressionStreamZlib,
  150. DecompressionStreamZlib,
  151. workerURI,
  152. wasmURI
  153. } = configuration;
  154. setIfDefined("baseURI", baseURI);
  155. setIfDefined("wasmURI", wasmURI);
  156. setIfDefined("workerURI", workerURI);
  157. setIfDefined("chunkSize", chunkSize);
  158. setIfDefined("maxWorkers", maxWorkers);
  159. setIfDefined("terminateWorkerTimeout", terminateWorkerTimeout);
  160. setIfDefined("useCompressionStream", useCompressionStream);
  161. setIfDefined("useWebWorkers", useWebWorkers);
  162. setIfDefined("CompressionStream", CompressionStream);
  163. setIfDefined("DecompressionStream", DecompressionStream);
  164. setIfDefined("CompressionStreamZlib", CompressionStreamZlib);
  165. setIfDefined("DecompressionStreamZlib", DecompressionStreamZlib);
  166. }
  167. function setIfDefined(propertyName, propertyValue) {
  168. if (propertyValue !== UNDEFINED_VALUE) {
  169. config[propertyName] = propertyValue;
  170. }
  171. }
  172. const A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function g$1(g){g({workerURI:g=>{const B="text/javascript",I=(g=>{g=(g=>{const B=(g=(g+"").replace(/[^A-Za-z0-9+/=]/g,"")).length,I=[];for(let C=0;B>C;C+=4){const B=A.indexOf(g[C])<<18|A.indexOf(g[C+1])<<12|(63&A.indexOf(g[C+2]))<<6|63&A.indexOf(g[C+3]);I.push(B>>16&255),"="!==g[C+2]&&I.push(B>>8&255),"="!==g[C+3]&&I.push(255&B);}return new Uint8Array(I)})(g);let B=new Uint8Array(1024),I=0;for(let A=0;A<g.length;){const E=g[A++];if(128&E){const Q=3+(127&E),Y=g[A++]<<8|g[A++],F=I-Y;C(I+Q);for(let A=0;Q>A;A++)B[I++]=B[F+A];}else {const Q=E;C(I+Q);for(let C=0;Q>C&&A<g.length;C++)B[I++]=g[A++];}}return (g=>{let B="";const I=g.length;let C=0;for(;I>C+2;C+=3){const I=g[C]<<16|g[C+1]<<8|g[C+2];B+=A[I>>18&63]+A[I>>12&63]+A[I>>6&63]+A[63&I];}const E=I-C;if(1===E){const I=g[C]<<16;B+=A[I>>18&63]+A[I>>12&63]+"==";}else if(2===E){const I=g[C]<<16|g[C+1]<<8;B+=A[I>>18&63]+A[I>>12&63]+A[I>>6&63]+"=";}return B})(new Uint8Array(B.buffer.slice(0,I)));function C(A){if(B.length<A){let g=2*B.length;for(;A>g;)g*=2;const C=new Uint8Array(g);C.set(B.subarray(0,I)),B=C;}}})("IChlPT57ImZ1bmN0aW9uIj09dHlwZW9mIGRlZmluZSYmgwAIBS5hbWQ/gwALCihlKTplKCl9KSiFADVEKCl7InVzZSBzdHJpY3QiO2NvbnN0e0FycmF5OmUsT2JqZWN0OnQsTnVtYmVyOnIsTWF0aDpuLEVycm9yOmksVWludDiDAC4Bb4IADQIxNoMADgFmggAOAjMygwAOA3MsSYcADQFsgABFInA6YSxEYXRhVmlldzpjLFByb21pc2U6dSxUZXh0RW5jb2SAAG4zdyxjcnlwdG86aCxwb3N0TWVzc2FnZTpkLFRyYW5zZm9ybVN0cmVhbTpwLFJlYWRhYmxlhAARBmssV3JpdIgAEQdiLENvbXBygABCgAD0hAAUBXksRGVjjgAWFm19PXNlbGYsdj12b2lkIDAsZz0idW6DAT8FZCIsUz2HAXAGLFQ9W107gACIFChsZXQgZT0wOzI1Nj5lO2UrKyl7gQATA3Q9ZYoAHwE4hAAdFzEmdD90PXQ+Pj4xXjM5ODgyOTIzODQ6gQAREj0xO1RbZV09dH1jbGFzcyB6e4IBkgRydWN0gABJCGUpe3RoaXMugABZC3x8LTF9YXBwZW5kgQAXgwBvAjB8gwAfhgB2BXI9MCxugAAXDmUubGVuZ3RoO24+cjtygACDgwB/EjheVFsyNTUmKHReZVtyX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AZ0GECFqBAG6CXfyBQrGBdHuABuqCBkuBVeyCBkuCNQoBboMSZYEhHIM0I4iZeYcrqIAAfIINnooHTYQ7VIIAQoMAYoGSa4BsOoAABgE1gQUOggdWAS2Aq9WHADeBHXiAACuARDyCItICPTWCrvmAAiUBIYEAR4AjLAI4PoIHmIE5cYcBPYAAEoAAGIEHUAFpgwWeiBLEgTFvgRKLg07ighLPgSXjgk2hgRIogAcUgEMwjgXqhg5thS0KgKiBgwXPgga3gLOLgQAHoAA4hwYpgAHkgyifgwYuhAYNg1jUgIivgwYOgAFzgS1EigFzAXSCIkeAtmiAItWDAAiAKJyAA22ABLGEAC6CDwmEeeuDgzGAAlIBaoJOCoMAroIESoAGi4EAMIAcwYALG4YACoAboYQACgFzgS4bgAAIgxoGhARmiAAGgVZFAXKDA4SBA5gBcoBHOANuOm6AcneDBI+LA5eBALWSA5eBC5eXA5cBO4yJH4KxPYEKwQI9YYERBAFugAnrgIdFAyk7Cg==");if(g){const A=atob(I),g=new Blob([A],{type:B});return URL.createObjectURL(g)}return "data:"+B+";base64,"+I}});}
  173. /*
  174. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  175. Redistribution and use in source and binary forms, with or without
  176. modification, are permitted provided that the following conditions are met:
  177. 1. Redistributions of source code must retain the above copyright notice,
  178. this list of conditions and the following disclaimer.
  179. 2. Redistributions in binary form must reproduce the above copyright
  180. notice, this list of conditions and the following disclaimer in
  181. the documentation and/or other materials provided with the distribution.
  182. 3. The names of the authors may not be used to endorse or promote products
  183. derived from this software without specific prior written permission.
  184. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  185. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  186. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  187. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  188. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  189. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  190. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  191. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  192. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  193. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  194. */
  195. const table$1 = [];
  196. for (let i = 0; i < 256; i++) {
  197. let t = i;
  198. for (let j = 0; j < 8; j++) {
  199. if (t & 1) {
  200. t = (t >>> 1) ^ 0xEDB88320;
  201. } else {
  202. t = t >>> 1;
  203. }
  204. }
  205. table$1[i] = t;
  206. }
  207. class Crc32 {
  208. constructor(crc) {
  209. this.crc = crc || -1;
  210. }
  211. append(data) {
  212. let crc = this.crc | 0;
  213. for (let offset = 0, length = data.length | 0; offset < length; offset++) {
  214. crc = (crc >>> 8) ^ table$1[(crc ^ data[offset]) & 0xFF];
  215. }
  216. this.crc = crc;
  217. }
  218. get() {
  219. return ~this.crc;
  220. }
  221. }
  222. /*
  223. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  224. Redistribution and use in source and binary forms, with or without
  225. modification, are permitted provided that the following conditions are met:
  226. 1. Redistributions of source code must retain the above copyright notice,
  227. this list of conditions and the following disclaimer.
  228. 2. Redistributions in binary form must reproduce the above copyright
  229. notice, this list of conditions and the following disclaimer in
  230. the documentation and/or other materials provided with the distribution.
  231. 3. The names of the authors may not be used to endorse or promote products
  232. derived from this software without specific prior written permission.
  233. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  234. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  235. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  236. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  237. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  238. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  239. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  240. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  241. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  242. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  243. */
  244. class Crc32Stream extends TransformStream {
  245. constructor() {
  246. // deno-lint-ignore prefer-const
  247. let stream;
  248. const crc32 = new Crc32();
  249. super({
  250. transform(chunk, controller) {
  251. crc32.append(chunk);
  252. controller.enqueue(chunk);
  253. },
  254. flush() {
  255. const value = new Uint8Array(4);
  256. const dataView = new DataView(value.buffer);
  257. dataView.setUint32(0, crc32.get());
  258. stream.value = value;
  259. }
  260. });
  261. stream = this;
  262. }
  263. }
  264. /*
  265. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  266. Redistribution and use in source and binary forms, with or without
  267. modification, are permitted provided that the following conditions are met:
  268. 1. Redistributions of source code must retain the above copyright notice,
  269. this list of conditions and the following disclaimer.
  270. 2. Redistributions in binary form must reproduce the above copyright
  271. notice, this list of conditions and the following disclaimer in
  272. the documentation and/or other materials provided with the distribution.
  273. 3. The names of the authors may not be used to endorse or promote products
  274. derived from this software without specific prior written permission.
  275. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  276. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  277. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  278. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  279. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  280. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  281. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  282. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  283. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  284. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  285. */
  286. function encodeText(value) {
  287. // deno-lint-ignore valid-typeof
  288. if (typeof TextEncoder == UNDEFINED_TYPE) {
  289. value = unescape(encodeURIComponent(value));
  290. const result = new Uint8Array(value.length);
  291. for (let i = 0; i < result.length; i++) {
  292. result[i] = value.charCodeAt(i);
  293. }
  294. return result;
  295. } else {
  296. return new TextEncoder().encode(value);
  297. }
  298. }
  299. // Derived from https://github.com/xqdoo00o/jszip/blob/master/lib/sjcl.js and https://github.com/bitwiseshiftleft/sjcl
  300. // deno-lint-ignore-file no-this-alias
  301. /*
  302. * SJCL is open. You can use, modify and redistribute it under a BSD
  303. * license or under the GNU GPL, version 2.0.
  304. */
  305. /** @fileOverview Javascript cryptography implementation.
  306. *
  307. * Crush to remove comments, shorten variable names and
  308. * generally reduce transmission size.
  309. *
  310. * @author Emily Stark
  311. * @author Mike Hamburg
  312. * @author Dan Boneh
  313. */
  314. /*jslint indent: 2, bitwise: false, nomen: false, plusplus: false, white: false, regexp: false */
  315. /** @fileOverview Arrays of bits, encoded as arrays of Numbers.
  316. *
  317. * @author Emily Stark
  318. * @author Mike Hamburg
  319. * @author Dan Boneh
  320. */
  321. /**
  322. * Arrays of bits, encoded as arrays of Numbers.
  323. * @namespace
  324. * @description
  325. * <p>
  326. * These objects are the currency accepted by SJCL's crypto functions.
  327. * </p>
  328. *
  329. * <p>
  330. * Most of our crypto primitives operate on arrays of 4-byte words internally,
  331. * but many of them can take arguments that are not a multiple of 4 bytes.
  332. * This library encodes arrays of bits (whose size need not be a multiple of 8
  333. * bits) as arrays of 32-bit words. The bits are packed, big-endian, into an
  334. * array of words, 32 bits at a time. Since the words are double-precision
  335. * floating point numbers, they fit some extra data. We use this (in a private,
  336. * possibly-changing manner) to encode the number of bits actually present
  337. * in the last word of the array.
  338. * </p>
  339. *
  340. * <p>
  341. * Because bitwise ops clear this out-of-band data, these arrays can be passed
  342. * to ciphers like AES which want arrays of words.
  343. * </p>
  344. */
  345. const bitArray = {
  346. /**
  347. * Concatenate two bit arrays.
  348. * @param {bitArray} a1 The first array.
  349. * @param {bitArray} a2 The second array.
  350. * @return {bitArray} The concatenation of a1 and a2.
  351. */
  352. concat(a1, a2) {
  353. if (a1.length === 0 || a2.length === 0) {
  354. return a1.concat(a2);
  355. }
  356. const last = a1[a1.length - 1], shift = bitArray.getPartial(last);
  357. if (shift === 32) {
  358. return a1.concat(a2);
  359. } else {
  360. return bitArray._shiftRight(a2, shift, last | 0, a1.slice(0, a1.length - 1));
  361. }
  362. },
  363. /**
  364. * Find the length of an array of bits.
  365. * @param {bitArray} a The array.
  366. * @return {Number} The length of a, in bits.
  367. */
  368. bitLength(a) {
  369. const l = a.length;
  370. if (l === 0) {
  371. return 0;
  372. }
  373. const x = a[l - 1];
  374. return (l - 1) * 32 + bitArray.getPartial(x);
  375. },
  376. /**
  377. * Truncate an array.
  378. * @param {bitArray} a The array.
  379. * @param {Number} len The length to truncate to, in bits.
  380. * @return {bitArray} A new array, truncated to len bits.
  381. */
  382. clamp(a, len) {
  383. if (a.length * 32 < len) {
  384. return a;
  385. }
  386. a = a.slice(0, Math.ceil(len / 32));
  387. const l = a.length;
  388. len = len & 31;
  389. if (l > 0 && len) {
  390. a[l - 1] = bitArray.partial(len, a[l - 1] & 0x80000000 >> (len - 1), 1);
  391. }
  392. return a;
  393. },
  394. /**
  395. * Make a partial word for a bit array.
  396. * @param {Number} len The number of bits in the word.
  397. * @param {Number} x The bits.
  398. * @param {Number} [_end=0] Pass 1 if x has already been shifted to the high side.
  399. * @return {Number} The partial word.
  400. */
  401. partial(len, x, _end) {
  402. if (len === 32) {
  403. return x;
  404. }
  405. return (_end ? x | 0 : x << (32 - len)) + len * 0x10000000000;
  406. },
  407. /**
  408. * Get the number of bits used by a partial word.
  409. * @param {Number} x The partial word.
  410. * @return {Number} The number of bits used by the partial word.
  411. */
  412. getPartial(x) {
  413. return Math.round(x / 0x10000000000) || 32;
  414. },
  415. /** Shift an array right.
  416. * @param {bitArray} a The array to shift.
  417. * @param {Number} shift The number of bits to shift.
  418. * @param {Number} [carry=0] A byte to carry in
  419. * @param {bitArray} [out=[]] An array to prepend to the output.
  420. * @private
  421. */
  422. _shiftRight(a, shift, carry, out) {
  423. if (out === undefined) {
  424. out = [];
  425. }
  426. for (; shift >= 32; shift -= 32) {
  427. out.push(carry);
  428. carry = 0;
  429. }
  430. if (shift === 0) {
  431. return out.concat(a);
  432. }
  433. for (let i = 0; i < a.length; i++) {
  434. out.push(carry | a[i] >>> shift);
  435. carry = a[i] << (32 - shift);
  436. }
  437. const last2 = a.length ? a[a.length - 1] : 0;
  438. const shift2 = bitArray.getPartial(last2);
  439. out.push(bitArray.partial(shift + shift2 & 31, (shift + shift2 > 32) ? carry : out.pop(), 1));
  440. return out;
  441. }
  442. };
  443. /** @fileOverview Bit array codec implementations.
  444. *
  445. * @author Emily Stark
  446. * @author Mike Hamburg
  447. * @author Dan Boneh
  448. */
  449. /**
  450. * Arrays of bytes
  451. * @namespace
  452. */
  453. const codec = {
  454. bytes: {
  455. /** Convert from a bitArray to an array of bytes. */
  456. fromBits(arr) {
  457. const bl = bitArray.bitLength(arr);
  458. const byteLength = bl / 8;
  459. const out = new Uint8Array(byteLength);
  460. let tmp;
  461. for (let i = 0; i < byteLength; i++) {
  462. if ((i & 3) === 0) {
  463. tmp = arr[i / 4];
  464. }
  465. out[i] = tmp >>> 24;
  466. tmp <<= 8;
  467. }
  468. return out;
  469. },
  470. /** Convert from an array of bytes to a bitArray. */
  471. toBits(bytes) {
  472. const out = [];
  473. let i;
  474. let tmp = 0;
  475. for (i = 0; i < bytes.length; i++) {
  476. tmp = tmp << 8 | bytes[i];
  477. if ((i & 3) === 3) {
  478. out.push(tmp);
  479. tmp = 0;
  480. }
  481. }
  482. if (i & 3) {
  483. out.push(bitArray.partial(8 * (i & 3), tmp));
  484. }
  485. return out;
  486. }
  487. }
  488. };
  489. const hash = {};
  490. /**
  491. * Context for a SHA-1 operation in progress.
  492. * @constructor
  493. */
  494. hash.sha1 = class {
  495. constructor(hash) {
  496. const sha1 = this;
  497. /**
  498. * The hash's block size, in bits.
  499. * @constant
  500. */
  501. sha1.blockSize = 512;
  502. /**
  503. * The SHA-1 initialization vector.
  504. * @private
  505. */
  506. sha1._init = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0];
  507. /**
  508. * The SHA-1 hash key.
  509. * @private
  510. */
  511. sha1._key = [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6];
  512. if (hash) {
  513. sha1._h = hash._h.slice(0);
  514. sha1._buffer = hash._buffer.slice(0);
  515. sha1._length = hash._length;
  516. } else {
  517. sha1.reset();
  518. }
  519. }
  520. /**
  521. * Reset the hash state.
  522. * @return this
  523. */
  524. reset() {
  525. const sha1 = this;
  526. sha1._h = sha1._init.slice(0);
  527. sha1._buffer = [];
  528. sha1._length = 0;
  529. return sha1;
  530. }
  531. /**
  532. * Input several words to the hash.
  533. * @param {bitArray|String} data the data to hash.
  534. * @return this
  535. */
  536. update(data) {
  537. const sha1 = this;
  538. if (typeof data === "string") {
  539. data = codec.utf8String.toBits(data);
  540. }
  541. const b = sha1._buffer = bitArray.concat(sha1._buffer, data);
  542. const ol = sha1._length;
  543. const nl = sha1._length = ol + bitArray.bitLength(data);
  544. if (nl > 9007199254740991) {
  545. throw new Error("Cannot hash more than 2^53 - 1 bits");
  546. }
  547. const c = new Uint32Array(b);
  548. let j = 0;
  549. for (let i = sha1.blockSize + ol - ((sha1.blockSize + ol) & (sha1.blockSize - 1)); i <= nl;
  550. i += sha1.blockSize) {
  551. sha1._block(c.subarray(16 * j, 16 * (j + 1)));
  552. j += 1;
  553. }
  554. b.splice(0, 16 * j);
  555. return sha1;
  556. }
  557. /**
  558. * Complete hashing and output the hash value.
  559. * @return {bitArray} The hash value, an array of 5 big-endian words. TODO
  560. */
  561. finalize() {
  562. const sha1 = this;
  563. let b = sha1._buffer;
  564. const h = sha1._h;
  565. // Round out and push the buffer
  566. b = bitArray.concat(b, [bitArray.partial(1, 1)]);
  567. // Round out the buffer to a multiple of 16 words, less the 2 length words.
  568. for (let i = b.length + 2; i & 15; i++) {
  569. b.push(0);
  570. }
  571. // append the length
  572. b.push(Math.floor(sha1._length / 0x100000000));
  573. b.push(sha1._length | 0);
  574. while (b.length) {
  575. sha1._block(b.splice(0, 16));
  576. }
  577. sha1.reset();
  578. return h;
  579. }
  580. /**
  581. * The SHA-1 logical functions f(0), f(1), ..., f(79).
  582. * @private
  583. */
  584. _f(t, b, c, d) {
  585. if (t <= 19) {
  586. return (b & c) | (~b & d);
  587. } else if (t <= 39) {
  588. return b ^ c ^ d;
  589. } else if (t <= 59) {
  590. return (b & c) | (b & d) | (c & d);
  591. } else if (t <= 79) {
  592. return b ^ c ^ d;
  593. }
  594. }
  595. /**
  596. * Circular left-shift operator.
  597. * @private
  598. */
  599. _S(n, x) {
  600. return (x << n) | (x >>> 32 - n);
  601. }
  602. /**
  603. * Perform one cycle of SHA-1.
  604. * @param {Uint32Array|bitArray} words one block of words.
  605. * @private
  606. */
  607. _block(words) {
  608. const sha1 = this;
  609. const h = sha1._h;
  610. // When words is passed to _block, it has 16 elements. SHA1 _block
  611. // function extends words with new elements (at the end there are 80 elements).
  612. // The problem is that if we use Uint32Array instead of Array,
  613. // the length of Uint32Array cannot be changed. Thus, we replace words with a
  614. // normal Array here.
  615. const w = Array(80); // do not use Uint32Array here as the instantiation is slower
  616. for (let j = 0; j < 16; j++) {
  617. w[j] = words[j];
  618. }
  619. let a = h[0];
  620. let b = h[1];
  621. let c = h[2];
  622. let d = h[3];
  623. let e = h[4];
  624. for (let t = 0; t <= 79; t++) {
  625. if (t >= 16) {
  626. w[t] = sha1._S(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);
  627. }
  628. const tmp = (sha1._S(5, a) + sha1._f(t, b, c, d) + e + w[t] +
  629. sha1._key[Math.floor(t / 20)]) | 0;
  630. e = d;
  631. d = c;
  632. c = sha1._S(30, b);
  633. b = a;
  634. a = tmp;
  635. }
  636. h[0] = (h[0] + a) | 0;
  637. h[1] = (h[1] + b) | 0;
  638. h[2] = (h[2] + c) | 0;
  639. h[3] = (h[3] + d) | 0;
  640. h[4] = (h[4] + e) | 0;
  641. }
  642. };
  643. /** @fileOverview Low-level AES implementation.
  644. *
  645. * This file contains a low-level implementation of AES, optimized for
  646. * size and for efficiency on several browsers. It is based on
  647. * OpenSSL's aes_core.c, a public-domain implementation by Vincent
  648. * Rijmen, Antoon Bosselaers and Paulo Barreto.
  649. *
  650. * An older version of this implementation is available in the public
  651. * domain, but this one is (c) Emily Stark, Mike Hamburg, Dan Boneh,
  652. * Stanford University 2008-2010 and BSD-licensed for liability
  653. * reasons.
  654. *
  655. * @author Emily Stark
  656. * @author Mike Hamburg
  657. * @author Dan Boneh
  658. */
  659. const cipher = {};
  660. /**
  661. * Schedule out an AES key for both encryption and decryption. This
  662. * is a low-level class. Use a cipher mode to do bulk encryption.
  663. *
  664. * @constructor
  665. * @param {Array} key The key as an array of 4, 6 or 8 words.
  666. */
  667. cipher.aes = class {
  668. constructor(key) {
  669. /**
  670. * The expanded S-box and inverse S-box tables. These will be computed
  671. * on the client so that we don't have to send them down the wire.
  672. *
  673. * There are two tables, _tables[0] is for encryption and
  674. * _tables[1] is for decryption.
  675. *
  676. * The first 4 sub-tables are the expanded S-box with MixColumns. The
  677. * last (_tables[01][4]) is the S-box itself.
  678. *
  679. * @private
  680. */
  681. const aes = this;
  682. aes._tables = [[[], [], [], [], []], [[], [], [], [], []]];
  683. if (!aes._tables[0][0][0]) {
  684. aes._precompute();
  685. }
  686. const sbox = aes._tables[0][4];
  687. const decTable = aes._tables[1];
  688. const keyLen = key.length;
  689. let i, encKey, decKey, rcon = 1;
  690. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  691. throw new Error("invalid aes key size");
  692. }
  693. aes._key = [encKey = key.slice(0), decKey = []];
  694. // schedule encryption keys
  695. for (i = keyLen; i < 4 * keyLen + 28; i++) {
  696. let tmp = encKey[i - 1];
  697. // apply sbox
  698. if (i % keyLen === 0 || (keyLen === 8 && i % keyLen === 4)) {
  699. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  700. // shift rows and add rcon
  701. if (i % keyLen === 0) {
  702. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  703. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  704. }
  705. }
  706. encKey[i] = encKey[i - keyLen] ^ tmp;
  707. }
  708. // schedule decryption keys
  709. for (let j = 0; i; j++, i--) {
  710. const tmp = encKey[j & 3 ? i : i - 4];
  711. if (i <= 4 || j < 4) {
  712. decKey[j] = tmp;
  713. } else {
  714. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^
  715. decTable[1][sbox[tmp >> 16 & 255]] ^
  716. decTable[2][sbox[tmp >> 8 & 255]] ^
  717. decTable[3][sbox[tmp & 255]];
  718. }
  719. }
  720. }
  721. // public
  722. /* Something like this might appear here eventually
  723. name: "AES",
  724. blockSize: 4,
  725. keySizes: [4,6,8],
  726. */
  727. /**
  728. * Encrypt an array of 4 big-endian words.
  729. * @param {Array} data The plaintext.
  730. * @return {Array} The ciphertext.
  731. */
  732. encrypt(data) {
  733. return this._crypt(data, 0);
  734. }
  735. /**
  736. * Decrypt an array of 4 big-endian words.
  737. * @param {Array} data The ciphertext.
  738. * @return {Array} The plaintext.
  739. */
  740. decrypt(data) {
  741. return this._crypt(data, 1);
  742. }
  743. /**
  744. * Expand the S-box tables.
  745. *
  746. * @private
  747. */
  748. _precompute() {
  749. const encTable = this._tables[0];
  750. const decTable = this._tables[1];
  751. const sbox = encTable[4];
  752. const sboxInv = decTable[4];
  753. const d = [];
  754. const th = [];
  755. let xInv, x2, x4, x8;
  756. // Compute double and third tables
  757. for (let i = 0; i < 256; i++) {
  758. th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;
  759. }
  760. for (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  761. // Compute sbox
  762. let s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  763. s = s >> 8 ^ s & 255 ^ 99;
  764. sbox[x] = s;
  765. sboxInv[s] = x;
  766. // Compute MixColumns
  767. x8 = d[x4 = d[x2 = d[x]]];
  768. let tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;
  769. let tEnc = d[s] * 0x101 ^ s * 0x1010100;
  770. for (let i = 0; i < 4; i++) {
  771. encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  772. decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;
  773. }
  774. }
  775. // Compactify. Considerable speedup on Firefox.
  776. for (let i = 0; i < 5; i++) {
  777. encTable[i] = encTable[i].slice(0);
  778. decTable[i] = decTable[i].slice(0);
  779. }
  780. }
  781. /**
  782. * Encryption and decryption core.
  783. * @param {Array} input Four words to be encrypted or decrypted.
  784. * @param dir The direction, 0 for encrypt and 1 for decrypt.
  785. * @return {Array} The four encrypted or decrypted words.
  786. * @private
  787. */
  788. _crypt(input, dir) {
  789. if (input.length !== 4) {
  790. throw new Error("invalid aes block size");
  791. }
  792. const key = this._key[dir];
  793. const nInnerRounds = key.length / 4 - 2;
  794. const out = [0, 0, 0, 0];
  795. const table = this._tables[dir];
  796. // load up the tables
  797. const t0 = table[0];
  798. const t1 = table[1];
  799. const t2 = table[2];
  800. const t3 = table[3];
  801. const sbox = table[4];
  802. // state variables a,b,c,d are loaded with pre-whitened data
  803. let a = input[0] ^ key[0];
  804. let b = input[dir ? 3 : 1] ^ key[1];
  805. let c = input[2] ^ key[2];
  806. let d = input[dir ? 1 : 3] ^ key[3];
  807. let kIndex = 4;
  808. let a2, b2, c2;
  809. // Inner rounds. Cribbed from OpenSSL.
  810. for (let i = 0; i < nInnerRounds; i++) {
  811. a2 = t0[a >>> 24] ^ t1[b >> 16 & 255] ^ t2[c >> 8 & 255] ^ t3[d & 255] ^ key[kIndex];
  812. b2 = t0[b >>> 24] ^ t1[c >> 16 & 255] ^ t2[d >> 8 & 255] ^ t3[a & 255] ^ key[kIndex + 1];
  813. c2 = t0[c >>> 24] ^ t1[d >> 16 & 255] ^ t2[a >> 8 & 255] ^ t3[b & 255] ^ key[kIndex + 2];
  814. d = t0[d >>> 24] ^ t1[a >> 16 & 255] ^ t2[b >> 8 & 255] ^ t3[c & 255] ^ key[kIndex + 3];
  815. kIndex += 4;
  816. a = a2; b = b2; c = c2;
  817. }
  818. // Last round.
  819. for (let i = 0; i < 4; i++) {
  820. out[dir ? 3 & -i : i] =
  821. sbox[a >>> 24] << 24 ^
  822. sbox[b >> 16 & 255] << 16 ^
  823. sbox[c >> 8 & 255] << 8 ^
  824. sbox[d & 255] ^
  825. key[kIndex++];
  826. a2 = a; a = b; b = c; c = d; d = a2;
  827. }
  828. return out;
  829. }
  830. };
  831. /**
  832. * Random values
  833. * @namespace
  834. */
  835. const random = {
  836. /**
  837. * Generate random words with pure js, cryptographically not as strong & safe as native implementation.
  838. * @param {TypedArray} typedArray The array to fill.
  839. * @return {TypedArray} The random values.
  840. */
  841. getRandomValues(typedArray) {
  842. const words = new Uint32Array(typedArray.buffer);
  843. const r = (m_w) => {
  844. let m_z = 0x3ade68b1;
  845. const mask = 0xffffffff;
  846. return function () {
  847. m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
  848. m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
  849. const result = ((((m_z << 0x10) + m_w) & mask) / 0x100000000) + .5;
  850. return result * (Math.random() > .5 ? 1 : -1);
  851. };
  852. };
  853. for (let i = 0, rcache; i < typedArray.length; i += 4) {
  854. const _r = r((rcache || Math.random()) * 0x100000000);
  855. rcache = _r() * 0x3ade67b7;
  856. words[i / 4] = (_r() * 0x100000000) | 0;
  857. }
  858. return typedArray;
  859. }
  860. };
  861. /** @fileOverview CTR mode implementation.
  862. *
  863. * Special thanks to Roy Nicholson for pointing out a bug in our
  864. * implementation.
  865. *
  866. * @author Emily Stark
  867. * @author Mike Hamburg
  868. * @author Dan Boneh
  869. */
  870. /** Brian Gladman's CTR Mode.
  871. * @constructor
  872. * @param {Object} _prf The aes instance to generate key.
  873. * @param {bitArray} _iv The iv for ctr mode, it must be 128 bits.
  874. */
  875. const mode = {};
  876. /**
  877. * Brian Gladman's CTR Mode.
  878. * @namespace
  879. */
  880. mode.ctrGladman = class {
  881. constructor(prf, iv) {
  882. this._prf = prf;
  883. this._initIv = iv;
  884. this._iv = iv;
  885. }
  886. reset() {
  887. this._iv = this._initIv;
  888. }
  889. /** Input some data to calculate.
  890. * @param {bitArray} data the data to process, it must be intergral multiple of 128 bits unless it's the last.
  891. */
  892. update(data) {
  893. return this.calculate(this._prf, data, this._iv);
  894. }
  895. incWord(word) {
  896. if (((word >> 24) & 0xff) === 0xff) { //overflow
  897. let b1 = (word >> 16) & 0xff;
  898. let b2 = (word >> 8) & 0xff;
  899. let b3 = word & 0xff;
  900. if (b1 === 0xff) { // overflow b1
  901. b1 = 0;
  902. if (b2 === 0xff) {
  903. b2 = 0;
  904. if (b3 === 0xff) {
  905. b3 = 0;
  906. } else {
  907. ++b3;
  908. }
  909. } else {
  910. ++b2;
  911. }
  912. } else {
  913. ++b1;
  914. }
  915. word = 0;
  916. word += (b1 << 16);
  917. word += (b2 << 8);
  918. word += b3;
  919. } else {
  920. word += (0x01 << 24);
  921. }
  922. return word;
  923. }
  924. incCounter(counter) {
  925. if ((counter[0] = this.incWord(counter[0])) === 0) {
  926. // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
  927. counter[1] = this.incWord(counter[1]);
  928. }
  929. }
  930. calculate(prf, data, iv) {
  931. let l;
  932. if (!(l = data.length)) {
  933. return [];
  934. }
  935. const bl = bitArray.bitLength(data);
  936. for (let i = 0; i < l; i += 4) {
  937. this.incCounter(iv);
  938. const e = prf.encrypt(iv);
  939. data[i] ^= e[0];
  940. data[i + 1] ^= e[1];
  941. data[i + 2] ^= e[2];
  942. data[i + 3] ^= e[3];
  943. }
  944. return bitArray.clamp(data, bl);
  945. }
  946. };
  947. const misc = {
  948. importKey(password) {
  949. return new misc.hmacSha1(codec.bytes.toBits(password));
  950. },
  951. pbkdf2(prf, salt, count, length) {
  952. count = count || 10000;
  953. if (length < 0 || count < 0) {
  954. throw new Error("invalid params to pbkdf2");
  955. }
  956. const byteLength = ((length >> 5) + 1) << 2;
  957. let u, ui, i, j, k;
  958. const arrayBuffer = new ArrayBuffer(byteLength);
  959. const out = new DataView(arrayBuffer);
  960. let outLength = 0;
  961. const b = bitArray;
  962. salt = codec.bytes.toBits(salt);
  963. for (k = 1; outLength < (byteLength || 1); k++) {
  964. u = ui = prf.encrypt(b.concat(salt, [k]));
  965. for (i = 1; i < count; i++) {
  966. ui = prf.encrypt(ui);
  967. for (j = 0; j < ui.length; j++) {
  968. u[j] ^= ui[j];
  969. }
  970. }
  971. for (i = 0; outLength < (byteLength || 1) && i < u.length; i++) {
  972. out.setInt32(outLength, u[i]);
  973. outLength += 4;
  974. }
  975. }
  976. return arrayBuffer.slice(0, length / 8);
  977. }
  978. };
  979. /** @fileOverview HMAC implementation.
  980. *
  981. * @author Emily Stark
  982. * @author Mike Hamburg
  983. * @author Dan Boneh
  984. */
  985. /** HMAC with the specified hash function.
  986. * @constructor
  987. * @param {bitArray} key the key for HMAC.
  988. * @param {Object} [Hash=hash.sha1] The hash function to use.
  989. */
  990. misc.hmacSha1 = class {
  991. constructor(key) {
  992. const hmac = this;
  993. const Hash = hmac._hash = hash.sha1;
  994. const exKey = [[], []];
  995. hmac._baseHash = [new Hash(), new Hash()];
  996. const bs = hmac._baseHash[0].blockSize / 32;
  997. if (key.length > bs) {
  998. key = new Hash().update(key).finalize();
  999. }
  1000. for (let i = 0; i < bs; i++) {
  1001. exKey[0][i] = key[i] ^ 0x36363636;
  1002. exKey[1][i] = key[i] ^ 0x5C5C5C5C;
  1003. }
  1004. hmac._baseHash[0].update(exKey[0]);
  1005. hmac._baseHash[1].update(exKey[1]);
  1006. hmac._resultHash = new Hash(hmac._baseHash[0]);
  1007. }
  1008. reset() {
  1009. const hmac = this;
  1010. hmac._resultHash = new hmac._hash(hmac._baseHash[0]);
  1011. hmac._updated = false;
  1012. }
  1013. update(data) {
  1014. const hmac = this;
  1015. hmac._updated = true;
  1016. hmac._resultHash.update(data);
  1017. }
  1018. digest() {
  1019. const hmac = this;
  1020. const w = hmac._resultHash.finalize();
  1021. const result = new (hmac._hash)(hmac._baseHash[1]).update(w).finalize();
  1022. hmac.reset();
  1023. return result;
  1024. }
  1025. encrypt(data) {
  1026. if (!this._updated) {
  1027. this.update(data);
  1028. return this.digest(data);
  1029. } else {
  1030. throw new Error("encrypt on already updated hmac called!");
  1031. }
  1032. }
  1033. };
  1034. /*
  1035. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  1036. Redistribution and use in source and binary forms, with or without
  1037. modification, are permitted provided that the following conditions are met:
  1038. 1. Redistributions of source code must retain the above copyright notice,
  1039. this list of conditions and the following disclaimer.
  1040. 2. Redistributions in binary form must reproduce the above copyright
  1041. notice, this list of conditions and the following disclaimer in
  1042. the documentation and/or other materials provided with the distribution.
  1043. 3. The names of the authors may not be used to endorse or promote products
  1044. derived from this software without specific prior written permission.
  1045. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  1046. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1047. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  1048. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  1049. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1050. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  1051. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  1052. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  1053. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  1054. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1055. */
  1056. const GET_RANDOM_VALUES_SUPPORTED = typeof crypto != UNDEFINED_TYPE && typeof crypto.getRandomValues == FUNCTION_TYPE;
  1057. const ERR_INVALID_PASSWORD = "Invalid password";
  1058. const ERR_INVALID_SIGNATURE = "Invalid signature";
  1059. const ERR_ABORT_CHECK_PASSWORD = "zipjs-abort-check-password";
  1060. function getRandomValues(array) {
  1061. if (GET_RANDOM_VALUES_SUPPORTED) {
  1062. return crypto.getRandomValues(array);
  1063. } else {
  1064. return random.getRandomValues(array);
  1065. }
  1066. }
  1067. /*
  1068. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  1069. Redistribution and use in source and binary forms, with or without
  1070. modification, are permitted provided that the following conditions are met:
  1071. 1. Redistributions of source code must retain the above copyright notice,
  1072. this list of conditions and the following disclaimer.
  1073. 2. Redistributions in binary form must reproduce the above copyright
  1074. notice, this list of conditions and the following disclaimer in
  1075. the documentation and/or other materials provided with the distribution.
  1076. 3. The names of the authors may not be used to endorse or promote products
  1077. derived from this software without specific prior written permission.
  1078. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  1079. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1080. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  1081. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  1082. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1083. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  1084. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  1085. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  1086. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  1087. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1088. */
  1089. const BLOCK_LENGTH = 16;
  1090. const RAW_FORMAT = "raw";
  1091. const PBKDF2_ALGORITHM = { name: "PBKDF2" };
  1092. const HASH_ALGORITHM = { name: "HMAC" };
  1093. const HASH_FUNCTION = "SHA-1";
  1094. const BASE_KEY_ALGORITHM = Object.assign({ hash: HASH_ALGORITHM }, PBKDF2_ALGORITHM);
  1095. const DERIVED_BITS_ALGORITHM = Object.assign({ iterations: 1000, hash: { name: HASH_FUNCTION } }, PBKDF2_ALGORITHM);
  1096. const DERIVED_BITS_USAGE = ["deriveBits"];
  1097. const SALT_LENGTH = [8, 12, 16];
  1098. const KEY_LENGTH = [16, 24, 32];
  1099. const SIGNATURE_LENGTH = 10;
  1100. const COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];
  1101. // deno-lint-ignore valid-typeof
  1102. const CRYPTO_API_SUPPORTED = typeof crypto != UNDEFINED_TYPE;
  1103. const subtle = CRYPTO_API_SUPPORTED && crypto.subtle;
  1104. const SUBTLE_API_SUPPORTED = CRYPTO_API_SUPPORTED && typeof subtle != UNDEFINED_TYPE;
  1105. const codecBytes = codec.bytes;
  1106. const Aes = cipher.aes;
  1107. const CtrGladman = mode.ctrGladman;
  1108. const HmacSha1 = misc.hmacSha1;
  1109. let IMPORT_KEY_SUPPORTED = CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && typeof subtle.importKey == FUNCTION_TYPE;
  1110. let DERIVE_BITS_SUPPORTED = CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && typeof subtle.deriveBits == FUNCTION_TYPE;
  1111. class AESDecryptionStream extends TransformStream {
  1112. constructor({ password, rawPassword, signed, encryptionStrength, checkPasswordOnly }) {
  1113. super({
  1114. start() {
  1115. Object.assign(this, {
  1116. ready: new Promise(resolve => this.resolveReady = resolve),
  1117. password: encodePassword(password, rawPassword),
  1118. signed,
  1119. strength: encryptionStrength - 1,
  1120. pending: new Uint8Array()
  1121. });
  1122. },
  1123. async transform(chunk, controller) {
  1124. const aesCrypto = this;
  1125. const {
  1126. password,
  1127. strength,
  1128. resolveReady,
  1129. ready
  1130. } = aesCrypto;
  1131. if (password) {
  1132. await createDecryptionKeys(aesCrypto, strength, password, subarray(chunk, 0, SALT_LENGTH[strength] + 2));
  1133. chunk = subarray(chunk, SALT_LENGTH[strength] + 2);
  1134. if (checkPasswordOnly) {
  1135. controller.error(new Error(ERR_ABORT_CHECK_PASSWORD));
  1136. } else {
  1137. resolveReady();
  1138. }
  1139. } else {
  1140. await ready;
  1141. }
  1142. const output = new Uint8Array(chunk.length - SIGNATURE_LENGTH - ((chunk.length - SIGNATURE_LENGTH) % BLOCK_LENGTH));
  1143. controller.enqueue(append(aesCrypto, chunk, output, 0, SIGNATURE_LENGTH, true));
  1144. },
  1145. async flush(controller) {
  1146. const {
  1147. signed,
  1148. ctr,
  1149. hmac,
  1150. pending,
  1151. ready
  1152. } = this;
  1153. if (hmac && ctr) {
  1154. await ready;
  1155. const chunkToDecrypt = subarray(pending, 0, pending.length - SIGNATURE_LENGTH);
  1156. const originalSignature = subarray(pending, pending.length - SIGNATURE_LENGTH);
  1157. let decryptedChunkArray = new Uint8Array();
  1158. if (chunkToDecrypt.length) {
  1159. const encryptedChunk = toBits(codecBytes, chunkToDecrypt);
  1160. hmac.update(encryptedChunk);
  1161. const decryptedChunk = ctr.update(encryptedChunk);
  1162. decryptedChunkArray = fromBits(codecBytes, decryptedChunk);
  1163. }
  1164. if (signed) {
  1165. const signature = subarray(fromBits(codecBytes, hmac.digest()), 0, SIGNATURE_LENGTH);
  1166. for (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {
  1167. if (signature[indexSignature] != originalSignature[indexSignature]) {
  1168. throw new Error(ERR_INVALID_SIGNATURE);
  1169. }
  1170. }
  1171. }
  1172. controller.enqueue(decryptedChunkArray);
  1173. }
  1174. }
  1175. });
  1176. }
  1177. }
  1178. class AESEncryptionStream extends TransformStream {
  1179. constructor({ password, rawPassword, encryptionStrength }) {
  1180. // deno-lint-ignore prefer-const
  1181. let stream;
  1182. super({
  1183. start() {
  1184. Object.assign(this, {
  1185. ready: new Promise(resolve => this.resolveReady = resolve),
  1186. password: encodePassword(password, rawPassword),
  1187. strength: encryptionStrength - 1,
  1188. pending: new Uint8Array()
  1189. });
  1190. },
  1191. async transform(chunk, controller) {
  1192. const aesCrypto = this;
  1193. const {
  1194. password,
  1195. strength,
  1196. resolveReady,
  1197. ready
  1198. } = aesCrypto;
  1199. let preamble = new Uint8Array();
  1200. if (password) {
  1201. preamble = await createEncryptionKeys(aesCrypto, strength, password);
  1202. resolveReady();
  1203. } else {
  1204. await ready;
  1205. }
  1206. const output = new Uint8Array(preamble.length + chunk.length - (chunk.length % BLOCK_LENGTH));
  1207. output.set(preamble, 0);
  1208. controller.enqueue(append(aesCrypto, chunk, output, preamble.length, 0));
  1209. },
  1210. async flush(controller) {
  1211. const {
  1212. ctr,
  1213. hmac,
  1214. pending,
  1215. ready
  1216. } = this;
  1217. if (hmac && ctr) {
  1218. await ready;
  1219. let encryptedChunkArray = new Uint8Array();
  1220. if (pending.length) {
  1221. const encryptedChunk = ctr.update(toBits(codecBytes, pending));
  1222. hmac.update(encryptedChunk);
  1223. encryptedChunkArray = fromBits(codecBytes, encryptedChunk);
  1224. }
  1225. stream.signature = fromBits(codecBytes, hmac.digest()).slice(0, SIGNATURE_LENGTH);
  1226. controller.enqueue(concat(encryptedChunkArray, stream.signature));
  1227. }
  1228. }
  1229. });
  1230. stream = this;
  1231. }
  1232. }
  1233. function append(aesCrypto, input, output, paddingStart, paddingEnd, verifySignature) {
  1234. const {
  1235. ctr,
  1236. hmac,
  1237. pending
  1238. } = aesCrypto;
  1239. const inputLength = input.length - paddingEnd;
  1240. if (pending.length) {
  1241. input = concat(pending, input);
  1242. output = expand(output, inputLength - (inputLength % BLOCK_LENGTH));
  1243. }
  1244. let offset;
  1245. for (offset = 0; offset <= inputLength - BLOCK_LENGTH; offset += BLOCK_LENGTH) {
  1246. const inputChunk = toBits(codecBytes, subarray(input, offset, offset + BLOCK_LENGTH));
  1247. if (verifySignature) {
  1248. hmac.update(inputChunk);
  1249. }
  1250. const outputChunk = ctr.update(inputChunk);
  1251. if (!verifySignature) {
  1252. hmac.update(outputChunk);
  1253. }
  1254. output.set(fromBits(codecBytes, outputChunk), offset + paddingStart);
  1255. }
  1256. aesCrypto.pending = subarray(input, offset);
  1257. return output;
  1258. }
  1259. async function createDecryptionKeys(decrypt, strength, password, preamble) {
  1260. const passwordVerificationKey = await createKeys$1(decrypt, strength, password, subarray(preamble, 0, SALT_LENGTH[strength]));
  1261. const passwordVerification = subarray(preamble, SALT_LENGTH[strength]);
  1262. if (passwordVerificationKey[0] != passwordVerification[0] || passwordVerificationKey[1] != passwordVerification[1]) {
  1263. throw new Error(ERR_INVALID_PASSWORD);
  1264. }
  1265. }
  1266. async function createEncryptionKeys(encrypt, strength, password) {
  1267. const salt = getRandomValues(new Uint8Array(SALT_LENGTH[strength]));
  1268. const passwordVerification = await createKeys$1(encrypt, strength, password, salt);
  1269. return concat(salt, passwordVerification);
  1270. }
  1271. async function createKeys$1(aesCrypto, strength, password, salt) {
  1272. aesCrypto.password = null;
  1273. const baseKey = await importKey(RAW_FORMAT, password, BASE_KEY_ALGORITHM, false, DERIVED_BITS_USAGE);
  1274. const derivedBits = await deriveBits(Object.assign({ salt }, DERIVED_BITS_ALGORITHM), baseKey, 8 * ((KEY_LENGTH[strength] * 2) + 2));
  1275. const compositeKey = new Uint8Array(derivedBits);
  1276. const key = toBits(codecBytes, subarray(compositeKey, 0, KEY_LENGTH[strength]));
  1277. const authentication = toBits(codecBytes, subarray(compositeKey, KEY_LENGTH[strength], KEY_LENGTH[strength] * 2));
  1278. const passwordVerification = subarray(compositeKey, KEY_LENGTH[strength] * 2);
  1279. Object.assign(aesCrypto, {
  1280. keys: {
  1281. key,
  1282. authentication,
  1283. passwordVerification
  1284. },
  1285. ctr: new CtrGladman(new Aes(key), Array.from(COUNTER_DEFAULT_VALUE)),
  1286. hmac: new HmacSha1(authentication)
  1287. });
  1288. return passwordVerification;
  1289. }
  1290. async function importKey(format, password, algorithm, extractable, keyUsages) {
  1291. if (IMPORT_KEY_SUPPORTED) {
  1292. try {
  1293. return await subtle.importKey(format, password, algorithm, extractable, keyUsages);
  1294. } catch {
  1295. IMPORT_KEY_SUPPORTED = false;
  1296. return misc.importKey(password);
  1297. }
  1298. } else {
  1299. return misc.importKey(password);
  1300. }
  1301. }
  1302. async function deriveBits(algorithm, baseKey, length) {
  1303. if (DERIVE_BITS_SUPPORTED) {
  1304. try {
  1305. return await subtle.deriveBits(algorithm, baseKey, length);
  1306. } catch {
  1307. DERIVE_BITS_SUPPORTED = false;
  1308. return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
  1309. }
  1310. } else {
  1311. return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length);
  1312. }
  1313. }
  1314. function encodePassword(password, rawPassword) {
  1315. if (rawPassword === UNDEFINED_VALUE) {
  1316. return encodeText(password);
  1317. } else {
  1318. return rawPassword;
  1319. }
  1320. }
  1321. function concat(leftArray, rightArray) {
  1322. let array = leftArray;
  1323. if (leftArray.length + rightArray.length) {
  1324. array = new Uint8Array(leftArray.length + rightArray.length);
  1325. array.set(leftArray, 0);
  1326. array.set(rightArray, leftArray.length);
  1327. }
  1328. return array;
  1329. }
  1330. function expand(inputArray, length) {
  1331. if (length && length > inputArray.length) {
  1332. const array = inputArray;
  1333. inputArray = new Uint8Array(length);
  1334. inputArray.set(array, 0);
  1335. }
  1336. return inputArray;
  1337. }
  1338. function subarray(array, begin, end) {
  1339. return array.subarray(begin, end);
  1340. }
  1341. function fromBits(codecBytes, chunk) {
  1342. return codecBytes.fromBits(chunk);
  1343. }
  1344. function toBits(codecBytes, chunk) {
  1345. return codecBytes.toBits(chunk);
  1346. }
  1347. /*
  1348. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  1349. Redistribution and use in source and binary forms, with or without
  1350. modification, are permitted provided that the following conditions are met:
  1351. 1. Redistributions of source code must retain the above copyright notice,
  1352. this list of conditions and the following disclaimer.
  1353. 2. Redistributions in binary form must reproduce the above copyright
  1354. notice, this list of conditions and the following disclaimer in
  1355. the documentation and/or other materials provided with the distribution.
  1356. 3. The names of the authors may not be used to endorse or promote products
  1357. derived from this software without specific prior written permission.
  1358. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  1359. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1360. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  1361. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  1362. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1363. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  1364. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  1365. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  1366. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  1367. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1368. */
  1369. const HEADER_LENGTH = 12;
  1370. class ZipCryptoDecryptionStream extends TransformStream {
  1371. constructor({ password, passwordVerification, checkPasswordOnly }) {
  1372. super({
  1373. start() {
  1374. Object.assign(this, {
  1375. password,
  1376. passwordVerification
  1377. });
  1378. createKeys(this, password);
  1379. },
  1380. transform(chunk, controller) {
  1381. const zipCrypto = this;
  1382. if (zipCrypto.password) {
  1383. const decryptedHeader = decrypt(zipCrypto, chunk.subarray(0, HEADER_LENGTH));
  1384. zipCrypto.password = null;
  1385. if (decryptedHeader.at(-1) != zipCrypto.passwordVerification) {
  1386. throw new Error(ERR_INVALID_PASSWORD);
  1387. }
  1388. chunk = chunk.subarray(HEADER_LENGTH);
  1389. }
  1390. if (checkPasswordOnly) {
  1391. controller.error(new Error(ERR_ABORT_CHECK_PASSWORD));
  1392. } else {
  1393. controller.enqueue(decrypt(zipCrypto, chunk));
  1394. }
  1395. }
  1396. });
  1397. }
  1398. }
  1399. class ZipCryptoEncryptionStream extends TransformStream {
  1400. constructor({ password, passwordVerification }) {
  1401. super({
  1402. start() {
  1403. Object.assign(this, {
  1404. password,
  1405. passwordVerification
  1406. });
  1407. createKeys(this, password);
  1408. },
  1409. transform(chunk, controller) {
  1410. const zipCrypto = this;
  1411. let output;
  1412. let offset;
  1413. if (zipCrypto.password) {
  1414. zipCrypto.password = null;
  1415. const header = getRandomValues(new Uint8Array(HEADER_LENGTH));
  1416. header[HEADER_LENGTH - 1] = zipCrypto.passwordVerification;
  1417. output = new Uint8Array(chunk.length + header.length);
  1418. output.set(encrypt(zipCrypto, header), 0);
  1419. offset = HEADER_LENGTH;
  1420. } else {
  1421. output = new Uint8Array(chunk.length);
  1422. offset = 0;
  1423. }
  1424. output.set(encrypt(zipCrypto, chunk), offset);
  1425. controller.enqueue(output);
  1426. }
  1427. });
  1428. }
  1429. }
  1430. function decrypt(target, input) {
  1431. const output = new Uint8Array(input.length);
  1432. for (let index = 0; index < input.length; index++) {
  1433. output[index] = getByte(target) ^ input[index];
  1434. updateKeys(target, output[index]);
  1435. }
  1436. return output;
  1437. }
  1438. function encrypt(target, input) {
  1439. const output = new Uint8Array(input.length);
  1440. for (let index = 0; index < input.length; index++) {
  1441. output[index] = getByte(target) ^ input[index];
  1442. updateKeys(target, input[index]);
  1443. }
  1444. return output;
  1445. }
  1446. function createKeys(target, password) {
  1447. const keys = [0x12345678, 0x23456789, 0x34567890];
  1448. Object.assign(target, {
  1449. keys,
  1450. crcKey0: new Crc32(keys[0]),
  1451. crcKey2: new Crc32(keys[2])
  1452. });
  1453. for (let index = 0; index < password.length; index++) {
  1454. updateKeys(target, password.charCodeAt(index));
  1455. }
  1456. }
  1457. function updateKeys(target, byte) {
  1458. let [key0, key1, key2] = target.keys;
  1459. target.crcKey0.append([byte]);
  1460. key0 = ~target.crcKey0.get();
  1461. key1 = getInt32(Math.imul(getInt32(key1 + getInt8(key0)), 134775813) + 1);
  1462. target.crcKey2.append([key1 >>> 24]);
  1463. key2 = ~target.crcKey2.get();
  1464. target.keys = [key0, key1, key2];
  1465. }
  1466. function getByte(target) {
  1467. const temp = target.keys[2] | 2;
  1468. return getInt8(Math.imul(temp, (temp ^ 1)) >>> 8);
  1469. }
  1470. function getInt8(number) {
  1471. return number & 0xFF;
  1472. }
  1473. function getInt32(number) {
  1474. return number & 0xFFFFFFFF;
  1475. }
  1476. /*
  1477. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  1478. Redistribution and use in source and binary forms, with or without
  1479. modification, are permitted provided that the following conditions are met:
  1480. 1. Redistributions of source code must retain the above copyright notice,
  1481. this list of conditions and the following disclaimer.
  1482. 2. Redistributions in binary form must reproduce the above copyright
  1483. notice, this list of conditions and the following disclaimer in
  1484. the documentation and/or other materials provided with the distribution.
  1485. 3. The names of the authors may not be used to endorse or promote products
  1486. derived from this software without specific prior written permission.
  1487. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  1488. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1489. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  1490. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  1491. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1492. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  1493. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  1494. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  1495. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  1496. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1497. */
  1498. const ERR_INVALID_UNCOMPRESSED_SIZE = "Invalid uncompressed size";
  1499. const FORMAT_DEFLATE_RAW = "deflate-raw";
  1500. const FORMAT_DEFLATE64_RAW = "deflate64-raw";
  1501. class DeflateStream extends TransformStream {
  1502. constructor(options, { chunkSize, CompressionStreamZlib, CompressionStream }) {
  1503. super({});
  1504. const { compressed, encrypted, useCompressionStream, zipCrypto, signed, level } = options;
  1505. const stream = this;
  1506. let crc32Stream, encryptionStream;
  1507. let readable = super.readable;
  1508. if ((!encrypted || zipCrypto) && signed) {
  1509. crc32Stream = new Crc32Stream();
  1510. readable = pipeThrough(readable, crc32Stream);
  1511. }
  1512. if (compressed) {
  1513. readable = pipeThroughCommpressionStream(readable, useCompressionStream, { level, chunkSize }, CompressionStream, CompressionStreamZlib, CompressionStream);
  1514. }
  1515. if (encrypted) {
  1516. if (zipCrypto) {
  1517. readable = pipeThrough(readable, new ZipCryptoEncryptionStream(options));
  1518. } else {
  1519. encryptionStream = new AESEncryptionStream(options);
  1520. readable = pipeThrough(readable, encryptionStream);
  1521. }
  1522. }
  1523. setReadable(stream, readable, () => {
  1524. let signature;
  1525. if (encrypted && !zipCrypto) {
  1526. signature = encryptionStream.signature;
  1527. }
  1528. if ((!encrypted || zipCrypto) && signed) {
  1529. signature = new DataView(crc32Stream.value.buffer).getUint32(0);
  1530. }
  1531. stream.signature = signature;
  1532. });
  1533. }
  1534. }
  1535. class InflateStream extends TransformStream {
  1536. constructor(options, { chunkSize, DecompressionStreamZlib, DecompressionStream }) {
  1537. super({});
  1538. const { zipCrypto, encrypted, signed, signature, compressed, useCompressionStream, deflate64 } = options;
  1539. let crc32Stream, decryptionStream;
  1540. let readable = super.readable;
  1541. if (encrypted) {
  1542. if (zipCrypto) {
  1543. readable = pipeThrough(readable, new ZipCryptoDecryptionStream(options));
  1544. } else {
  1545. decryptionStream = new AESDecryptionStream(options);
  1546. readable = pipeThrough(readable, decryptionStream);
  1547. }
  1548. }
  1549. if (compressed) {
  1550. readable = pipeThroughCommpressionStream(readable, useCompressionStream, { chunkSize, deflate64 }, DecompressionStream, DecompressionStreamZlib, DecompressionStream);
  1551. }
  1552. if ((!encrypted || zipCrypto) && signed) {
  1553. crc32Stream = new Crc32Stream();
  1554. readable = pipeThrough(readable, crc32Stream);
  1555. }
  1556. setReadable(this, readable, () => {
  1557. if ((!encrypted || zipCrypto) && signed) {
  1558. const dataViewSignature = new DataView(crc32Stream.value.buffer);
  1559. if (signature != dataViewSignature.getUint32(0, false)) {
  1560. throw new Error(ERR_INVALID_SIGNATURE);
  1561. }
  1562. }
  1563. });
  1564. }
  1565. }
  1566. function setReadable(stream, readable, flush) {
  1567. readable = pipeThrough(readable, new TransformStream({ flush }));
  1568. Object.defineProperty(stream, "readable", {
  1569. get() {
  1570. return readable;
  1571. }
  1572. });
  1573. }
  1574. function pipeThroughCommpressionStream(readable, useCompressionStream, options, CompressionStreamNative, CompressionStreamZlib, CompressionStream) {
  1575. const Stream = useCompressionStream && CompressionStreamNative ? CompressionStreamNative : CompressionStreamZlib || CompressionStream;
  1576. const format = options.deflate64 ? FORMAT_DEFLATE64_RAW : FORMAT_DEFLATE_RAW;
  1577. try {
  1578. readable = pipeThrough(readable, new Stream(format, options));
  1579. } catch (error) {
  1580. if (useCompressionStream) {
  1581. if (CompressionStreamZlib) {
  1582. readable = pipeThrough(readable, new CompressionStreamZlib(format, options));
  1583. } else if (CompressionStream) {
  1584. readable = pipeThrough(readable, new CompressionStream(format, options));
  1585. } else {
  1586. throw error;
  1587. }
  1588. } else {
  1589. throw error;
  1590. }
  1591. }
  1592. return readable;
  1593. }
  1594. function pipeThrough(readable, transformStream) {
  1595. return readable.pipeThrough(transformStream);
  1596. }
  1597. /*
  1598. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  1599. Redistribution and use in source and binary forms, with or without
  1600. modification, are permitted provided that the following conditions are met:
  1601. 1. Redistributions of source code must retain the above copyright notice,
  1602. this list of conditions and the following disclaimer.
  1603. 2. Redistributions in binary form must reproduce the above copyright
  1604. notice, this list of conditions and the following disclaimer in
  1605. the documentation and/or other materials provided with the distribution.
  1606. 3. The names of the authors may not be used to endorse or promote products
  1607. derived from this software without specific prior written permission.
  1608. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  1609. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1610. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  1611. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  1612. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1613. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  1614. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  1615. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  1616. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  1617. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1618. */
  1619. const MESSAGE_EVENT_TYPE = "message";
  1620. const MESSAGE_START = "start";
  1621. const MESSAGE_PULL = "pull";
  1622. const MESSAGE_DATA = "data";
  1623. const MESSAGE_ACK_DATA = "ack";
  1624. const MESSAGE_CLOSE = "close";
  1625. const CODEC_DEFLATE = "deflate";
  1626. const CODEC_INFLATE = "inflate";
  1627. class CodecStream extends TransformStream {
  1628. constructor(options, config) {
  1629. super({});
  1630. const codec = this;
  1631. const { codecType } = options;
  1632. let Stream;
  1633. if (codecType.startsWith(CODEC_DEFLATE)) {
  1634. Stream = DeflateStream;
  1635. } else if (codecType.startsWith(CODEC_INFLATE)) {
  1636. Stream = InflateStream;
  1637. }
  1638. codec.outputSize = 0;
  1639. let inputSize = 0;
  1640. const stream = new Stream(options, config);
  1641. const readable = super.readable;
  1642. const inputSizeStream = new TransformStream({
  1643. transform(chunk, controller) {
  1644. if (chunk && chunk.length) {
  1645. inputSize += chunk.length;
  1646. controller.enqueue(chunk);
  1647. }
  1648. },
  1649. flush() {
  1650. Object.assign(codec, {
  1651. inputSize
  1652. });
  1653. }
  1654. });
  1655. const outputSizeStream = new TransformStream({
  1656. transform(chunk, controller) {
  1657. if (chunk && chunk.length) {
  1658. controller.enqueue(chunk);
  1659. codec.outputSize += chunk.length;
  1660. if (options.outputSize !== UNDEFINED_VALUE && codec.outputSize > options.outputSize) {
  1661. throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
  1662. }
  1663. }
  1664. },
  1665. flush() {
  1666. const { signature } = stream;
  1667. Object.assign(codec, {
  1668. signature,
  1669. inputSize
  1670. });
  1671. }
  1672. });
  1673. Object.defineProperty(codec, "readable", {
  1674. get() {
  1675. return readable.pipeThrough(inputSizeStream).pipeThrough(stream).pipeThrough(outputSizeStream);
  1676. }
  1677. });
  1678. }
  1679. }
  1680. class ChunkStream extends TransformStream {
  1681. constructor(chunkSize) {
  1682. let pendingChunk;
  1683. super({
  1684. transform,
  1685. flush(controller) {
  1686. if (pendingChunk && pendingChunk.length) {
  1687. controller.enqueue(pendingChunk);
  1688. }
  1689. }
  1690. });
  1691. function transform(chunk, controller) {
  1692. if (pendingChunk) {
  1693. const newChunk = new Uint8Array(pendingChunk.length + chunk.length);
  1694. newChunk.set(pendingChunk);
  1695. newChunk.set(chunk, pendingChunk.length);
  1696. chunk = newChunk;
  1697. pendingChunk = null;
  1698. }
  1699. if (chunk.length > chunkSize) {
  1700. controller.enqueue(chunk.slice(0, chunkSize));
  1701. transform(chunk.slice(chunkSize), controller);
  1702. } else {
  1703. pendingChunk = chunk;
  1704. }
  1705. }
  1706. }
  1707. }
  1708. /*
  1709. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  1710. Redistribution and use in source and binary forms, with or without
  1711. modification, are permitted provided that the following conditions are met:
  1712. 1. Redistributions of source code must retain the above copyright notice,
  1713. this list of conditions and the following disclaimer.
  1714. 2. Redistributions in binary form must reproduce the above copyright
  1715. notice, this list of conditions and the following disclaimer in
  1716. the documentation and/or other materials provided with the distribution.
  1717. 3. The names of the authors may not be used to endorse or promote products
  1718. derived from this software without specific prior written permission.
  1719. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  1720. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  1721. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  1722. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  1723. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  1724. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  1725. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  1726. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  1727. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  1728. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1729. */
  1730. const MODULE_WORKER_OPTIONS = { type: "module" };
  1731. let webWorkerSupported, webWorkerURI, webWorkerOptions;
  1732. let transferStreamsSupported = true;
  1733. try {
  1734. transferStreamsSupported = typeof structuredClone == FUNCTION_TYPE && structuredClone(new DOMException("", "AbortError")).code !== UNDEFINED_VALUE;
  1735. } catch {
  1736. // ignored
  1737. }
  1738. let initModule = () => { };
  1739. class CodecWorker {
  1740. constructor(workerData, { readable, writable }, { options, config, streamOptions, useWebWorkers, transferStreams, workerURI }, onTaskFinished) {
  1741. const { signal } = streamOptions;
  1742. Object.assign(workerData, {
  1743. busy: true,
  1744. readable: readable
  1745. .pipeThrough(new ChunkStream(config.chunkSize))
  1746. .pipeThrough(new ProgressWatcherStream(streamOptions), { signal }),
  1747. writable,
  1748. options: Object.assign({}, options),
  1749. workerURI,
  1750. transferStreams,
  1751. terminate() {
  1752. return new Promise(resolve => {
  1753. const { worker, busy } = workerData;
  1754. if (worker) {
  1755. if (busy) {
  1756. workerData.resolveTerminated = resolve;
  1757. } else {
  1758. worker.terminate();
  1759. resolve();
  1760. }
  1761. workerData.interface = null;
  1762. } else {
  1763. resolve();
  1764. }
  1765. });
  1766. },
  1767. onTaskFinished() {
  1768. const { resolveTerminated } = workerData;
  1769. if (resolveTerminated) {
  1770. workerData.resolveTerminated = null;
  1771. workerData.terminated = true;
  1772. workerData.worker.terminate();
  1773. resolveTerminated();
  1774. }
  1775. workerData.busy = false;
  1776. onTaskFinished(workerData);
  1777. }
  1778. });
  1779. if (webWorkerSupported === UNDEFINED_VALUE) {
  1780. // deno-lint-ignore valid-typeof
  1781. webWorkerSupported = typeof Worker != UNDEFINED_TYPE;
  1782. }
  1783. return (useWebWorkers && webWorkerSupported ? createWebWorkerInterface : createWorkerInterface)(workerData, config);
  1784. }
  1785. }
  1786. class ProgressWatcherStream extends TransformStream {
  1787. constructor({ onstart, onprogress, size, onend }) {
  1788. let chunkOffset = 0;
  1789. super({
  1790. async start() {
  1791. if (onstart) {
  1792. await callHandler(onstart, size);
  1793. }
  1794. },
  1795. async transform(chunk, controller) {
  1796. chunkOffset += chunk.length;
  1797. if (onprogress) {
  1798. await callHandler(onprogress, chunkOffset, size);
  1799. }
  1800. controller.enqueue(chunk);
  1801. },
  1802. async flush() {
  1803. if (onend) {
  1804. await callHandler(onend, chunkOffset);
  1805. }
  1806. }
  1807. });
  1808. }
  1809. }
  1810. async function callHandler(handler, ...parameters) {
  1811. try {
  1812. await handler(...parameters);
  1813. } catch {
  1814. // ignored
  1815. }
  1816. }
  1817. function createWorkerInterface(workerData, config) {
  1818. return {
  1819. run: () => runWorker$1(workerData, config)
  1820. };
  1821. }
  1822. function createWebWorkerInterface(workerData, config) {
  1823. const { baseURI, chunkSize } = config;
  1824. let { wasmURI } = config;
  1825. if (!workerData.interface) {
  1826. // deno-lint-ignore valid-typeof
  1827. if (typeof wasmURI == FUNCTION_TYPE) {
  1828. wasmURI = wasmURI();
  1829. }
  1830. let worker;
  1831. try {
  1832. worker = getWebWorker(workerData.workerURI, baseURI, workerData);
  1833. } catch {
  1834. webWorkerSupported = false;
  1835. return createWorkerInterface(workerData, config);
  1836. }
  1837. Object.assign(workerData, {
  1838. worker,
  1839. interface: {
  1840. run: () => runWebWorker(workerData, { chunkSize, wasmURI, baseURI })
  1841. }
  1842. });
  1843. }
  1844. return workerData.interface;
  1845. }
  1846. async function runWorker$1({ options, readable, writable, onTaskFinished }, config) {
  1847. let codecStream;
  1848. try {
  1849. if (!options.useCompressionStream) {
  1850. try {
  1851. await initModule(config);
  1852. } catch {
  1853. options.useCompressionStream = true;
  1854. }
  1855. }
  1856. codecStream = new CodecStream(options, config);
  1857. await readable.pipeThrough(codecStream).pipeTo(writable, { preventClose: true, preventAbort: true });
  1858. const {
  1859. signature,
  1860. inputSize,
  1861. outputSize
  1862. } = codecStream;
  1863. return {
  1864. signature,
  1865. inputSize,
  1866. outputSize
  1867. };
  1868. } catch (error) {
  1869. if (codecStream) {
  1870. error.outputSize = codecStream.outputSize;
  1871. }
  1872. throw error;
  1873. } finally {
  1874. onTaskFinished();
  1875. }
  1876. }
  1877. async function runWebWorker(workerData, config) {
  1878. let resolveResult, rejectResult;
  1879. const result = new Promise((resolve, reject) => {
  1880. resolveResult = resolve;
  1881. rejectResult = reject;
  1882. });
  1883. Object.assign(workerData, {
  1884. reader: null,
  1885. writer: null,
  1886. resolveResult,
  1887. rejectResult,
  1888. result
  1889. });
  1890. const { readable, options } = workerData;
  1891. const { writable, closed } = watchClosedStream(workerData.writable);
  1892. const streamsTransferred = sendMessage({
  1893. type: MESSAGE_START,
  1894. options,
  1895. config,
  1896. readable,
  1897. writable
  1898. }, workerData);
  1899. if (!streamsTransferred) {
  1900. Object.assign(workerData, {
  1901. reader: readable.getReader(),
  1902. writer: writable.getWriter()
  1903. });
  1904. }
  1905. const resultValue = await result;
  1906. if (!streamsTransferred) {
  1907. await writable.getWriter().close();
  1908. }
  1909. await closed;
  1910. return resultValue;
  1911. }
  1912. function watchClosedStream(writableSource) {
  1913. const { writable, readable } = new TransformStream();
  1914. const closed = readable.pipeTo(writableSource, { preventClose: true });
  1915. return { writable, closed };
  1916. }
  1917. function getWebWorker(url, baseURI, workerData, isModuleType, useBlobURI = true) {
  1918. let worker, resolvedURI, resolvedOptions;
  1919. if (webWorkerURI === UNDEFINED_VALUE) {
  1920. // deno-lint-ignore valid-typeof
  1921. const isFunctionURI = typeof url == FUNCTION_TYPE;
  1922. if (isFunctionURI) {
  1923. resolvedURI = url(useBlobURI);
  1924. } else {
  1925. resolvedURI = url;
  1926. }
  1927. const isDataURI = resolvedURI.startsWith("data:");
  1928. const isBlobURI = resolvedURI.startsWith("blob:");
  1929. if (isDataURI || isBlobURI) {
  1930. if (isModuleType === UNDEFINED_VALUE) {
  1931. isModuleType = false;
  1932. }
  1933. if (isModuleType) {
  1934. resolvedOptions = MODULE_WORKER_OPTIONS;
  1935. }
  1936. try {
  1937. worker = new Worker(resolvedURI, resolvedOptions);
  1938. } catch (error) {
  1939. if (isBlobURI) {
  1940. try {
  1941. URL.revokeObjectURL(resolvedURI);
  1942. } catch {
  1943. // ignored
  1944. }
  1945. }
  1946. if (isFunctionURI && isBlobURI) {
  1947. return getWebWorker(url, baseURI, workerData, isModuleType, false);
  1948. } else if (!isModuleType) {
  1949. return getWebWorker(url, baseURI, workerData, true, false);
  1950. } else {
  1951. throw error;
  1952. }
  1953. }
  1954. } else {
  1955. if (isModuleType === UNDEFINED_VALUE) {
  1956. isModuleType = true;
  1957. }
  1958. if (isModuleType) {
  1959. resolvedOptions = MODULE_WORKER_OPTIONS;
  1960. }
  1961. try {
  1962. resolvedURI = new URL(resolvedURI, baseURI);
  1963. } catch {
  1964. // ignored
  1965. }
  1966. try {
  1967. worker = new Worker(resolvedURI, resolvedOptions);
  1968. } catch (error) {
  1969. if (!isModuleType) {
  1970. return getWebWorker(url, baseURI, workerData, false, useBlobURI);
  1971. } else {
  1972. throw error;
  1973. }
  1974. }
  1975. }
  1976. webWorkerURI = resolvedURI;
  1977. webWorkerOptions = resolvedOptions;
  1978. } else {
  1979. worker = new Worker(webWorkerURI, webWorkerOptions);
  1980. }
  1981. worker.addEventListener(MESSAGE_EVENT_TYPE, event => onMessage(event, workerData));
  1982. return worker;
  1983. }
  1984. function sendMessage(message, { worker, writer, onTaskFinished, transferStreams }) {
  1985. try {
  1986. const { value, readable, writable } = message;
  1987. const transferables = [];
  1988. if (value) {
  1989. message.value = value;
  1990. transferables.push(message.value.buffer);
  1991. }
  1992. if (transferStreams && transferStreamsSupported) {
  1993. if (readable) {
  1994. transferables.push(readable);
  1995. }
  1996. if (writable) {
  1997. transferables.push(writable);
  1998. }
  1999. } else {
  2000. message.readable = message.writable = null;
  2001. }
  2002. if (transferables.length) {
  2003. try {
  2004. worker.postMessage(message, transferables);
  2005. return true;
  2006. } catch {
  2007. transferStreamsSupported = false;
  2008. message.readable = message.writable = null;
  2009. worker.postMessage(message);
  2010. }
  2011. } else {
  2012. worker.postMessage(message);
  2013. }
  2014. } catch (error) {
  2015. if (writer) {
  2016. writer.releaseLock();
  2017. }
  2018. onTaskFinished();
  2019. throw error;
  2020. }
  2021. }
  2022. async function onMessage({ data }, workerData) {
  2023. const { type, value, messageId, result, error } = data;
  2024. const { reader, writer, resolveResult, rejectResult, onTaskFinished } = workerData;
  2025. try {
  2026. if (error) {
  2027. const { message, stack, code, name, outputSize } = error;
  2028. const responseError = new Error(message);
  2029. Object.assign(responseError, { stack, code, name, outputSize });
  2030. close(responseError);
  2031. } else {
  2032. if (type == MESSAGE_PULL) {
  2033. const { value, done } = await reader.read();
  2034. sendMessage({ type: MESSAGE_DATA, value, done, messageId }, workerData);
  2035. }
  2036. if (type == MESSAGE_DATA) {
  2037. await writer.ready;
  2038. await writer.write(new Uint8Array(value));
  2039. sendMessage({ type: MESSAGE_ACK_DATA, messageId }, workerData);
  2040. }
  2041. if (type == MESSAGE_CLOSE) {
  2042. close(null, result);
  2043. }
  2044. }
  2045. } catch (error) {
  2046. sendMessage({ type: MESSAGE_CLOSE, messageId }, workerData);
  2047. close(error);
  2048. }
  2049. function close(error, result) {
  2050. if (error) {
  2051. rejectResult(error);
  2052. } else {
  2053. resolveResult(result);
  2054. }
  2055. if (writer) {
  2056. writer.releaseLock();
  2057. }
  2058. onTaskFinished();
  2059. }
  2060. }
  2061. /*
  2062. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  2063. Redistribution and use in source and binary forms, with or without
  2064. modification, are permitted provided that the following conditions are met:
  2065. 1. Redistributions of source code must retain the above copyright notice,
  2066. this list of conditions and the following disclaimer.
  2067. 2. Redistributions in binary form must reproduce the above copyright
  2068. notice, this list of conditions and the following disclaimer in
  2069. the documentation and/or other materials provided with the distribution.
  2070. 3. The names of the authors may not be used to endorse or promote products
  2071. derived from this software without specific prior written permission.
  2072. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  2073. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  2074. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  2075. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  2076. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  2077. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  2078. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  2079. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  2080. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  2081. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2082. */
  2083. let pool = [];
  2084. const pendingRequests = [];
  2085. let indexWorker = 0;
  2086. async function runWorker(stream, workerOptions) {
  2087. const { options, config } = workerOptions;
  2088. const { transferStreams, useWebWorkers, useCompressionStream, compressed, signed, encrypted } = options;
  2089. const { workerURI, maxWorkers } = config;
  2090. workerOptions.transferStreams = transferStreams || transferStreams === UNDEFINED_VALUE;
  2091. const streamCopy = !compressed && !signed && !encrypted && !workerOptions.transferStreams;
  2092. workerOptions.useWebWorkers = !streamCopy && (useWebWorkers || (useWebWorkers === UNDEFINED_VALUE && config.useWebWorkers));
  2093. workerOptions.workerURI = workerOptions.useWebWorkers && workerURI ? workerURI : UNDEFINED_VALUE;
  2094. options.useCompressionStream = useCompressionStream || (useCompressionStream === UNDEFINED_VALUE && config.useCompressionStream);
  2095. return (await getWorker()).run();
  2096. // deno-lint-ignore require-await
  2097. async function getWorker() {
  2098. const workerData = pool.find(workerData => !workerData.busy);
  2099. if (workerData) {
  2100. clearTerminateTimeout(workerData);
  2101. return new CodecWorker(workerData, stream, workerOptions, onTaskFinished);
  2102. } else if (pool.length < maxWorkers) {
  2103. const workerData = { indexWorker };
  2104. indexWorker++;
  2105. pool.push(workerData);
  2106. return new CodecWorker(workerData, stream, workerOptions, onTaskFinished);
  2107. } else {
  2108. return new Promise(resolve => pendingRequests.push({ resolve, stream, workerOptions }));
  2109. }
  2110. }
  2111. function onTaskFinished(workerData) {
  2112. if (pendingRequests.length) {
  2113. const [{ resolve, stream, workerOptions }] = pendingRequests.splice(0, 1);
  2114. resolve(new CodecWorker(workerData, stream, workerOptions, onTaskFinished));
  2115. } else if (workerData.worker) {
  2116. clearTerminateTimeout(workerData);
  2117. terminateWorker(workerData, workerOptions);
  2118. } else {
  2119. pool = pool.filter(data => data != workerData);
  2120. }
  2121. }
  2122. }
  2123. function terminateWorker(workerData, workerOptions) {
  2124. const { config } = workerOptions;
  2125. const { terminateWorkerTimeout } = config;
  2126. if (Number.isFinite(terminateWorkerTimeout) && terminateWorkerTimeout >= 0) {
  2127. if (workerData.terminated) {
  2128. workerData.terminated = false;
  2129. } else {
  2130. workerData.terminateTimeout = setTimeout(async () => {
  2131. pool = pool.filter(data => data != workerData);
  2132. try {
  2133. await workerData.terminate();
  2134. } catch {
  2135. // ignored
  2136. }
  2137. }, terminateWorkerTimeout);
  2138. }
  2139. }
  2140. }
  2141. function clearTerminateTimeout(workerData) {
  2142. const { terminateTimeout } = workerData;
  2143. if (terminateTimeout) {
  2144. clearTimeout(terminateTimeout);
  2145. workerData.terminateTimeout = null;
  2146. }
  2147. }
  2148. async function terminateWorkers() {
  2149. await Promise.allSettled(pool.map(workerData => {
  2150. clearTerminateTimeout(workerData);
  2151. return workerData.terminate();
  2152. }));
  2153. }
  2154. /*
  2155. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  2156. Redistribution and use in source and binary forms, with or without
  2157. modification, are permitted provided that the following conditions are met:
  2158. 1. Redistributions of source code must retain the above copyright notice,
  2159. this list of conditions and the following disclaimer.
  2160. 2. Redistributions in binary form must reproduce the above copyright
  2161. notice, this list of conditions and the following disclaimer in
  2162. the documentation and/or other materials provided with the distribution.
  2163. 3. The names of the authors may not be used to endorse or promote products
  2164. derived from this software without specific prior written permission.
  2165. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  2166. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  2167. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  2168. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  2169. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  2170. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  2171. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  2172. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  2173. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  2174. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2175. */
  2176. const ERR_HTTP_STATUS = "HTTP error ";
  2177. const ERR_HTTP_RANGE = "HTTP Range not supported";
  2178. const ERR_ITERATOR_COMPLETED_TOO_SOON = "Writer iterator completed too soon";
  2179. const ERR_WRITER_NOT_INITIALIZED = "Writer not initialized";
  2180. const CONTENT_TYPE_TEXT_PLAIN = "text/plain";
  2181. const HTTP_HEADER_CONTENT_LENGTH = "Content-Length";
  2182. const HTTP_HEADER_CONTENT_RANGE = "Content-Range";
  2183. const HTTP_HEADER_ACCEPT_RANGES = "Accept-Ranges";
  2184. const HTTP_HEADER_RANGE = "Range";
  2185. const HTTP_HEADER_CONTENT_TYPE = "Content-Type";
  2186. const HTTP_METHOD_HEAD = "HEAD";
  2187. const HTTP_METHOD_GET = "GET";
  2188. const HTTP_RANGE_UNIT = "bytes";
  2189. const DEFAULT_CHUNK_SIZE = 64 * 1024;
  2190. const DEFAULT_BUFFER_SIZE = 256 * 1024;
  2191. const PROPERTY_NAME_WRITABLE = "writable";
  2192. class Stream {
  2193. constructor() {
  2194. this.size = 0;
  2195. }
  2196. init() {
  2197. this.initialized = true;
  2198. }
  2199. }
  2200. class Reader extends Stream {
  2201. get readable() {
  2202. const reader = this;
  2203. const { chunkSize = DEFAULT_CHUNK_SIZE } = reader;
  2204. const readable = new ReadableStream({
  2205. start() {
  2206. this.chunkOffset = 0;
  2207. },
  2208. async pull(controller) {
  2209. const { offset = 0, size, diskNumberStart } = readable;
  2210. const { chunkOffset } = this;
  2211. const dataSize = size === UNDEFINED_VALUE ? chunkSize : Math.min(chunkSize, size - chunkOffset);
  2212. const data = await readUint8Array(reader, offset + chunkOffset, dataSize, diskNumberStart);
  2213. controller.enqueue(data);
  2214. if ((chunkOffset + chunkSize > size) || (size === UNDEFINED_VALUE && !data.length && dataSize)) {
  2215. controller.close();
  2216. } else {
  2217. this.chunkOffset += chunkSize;
  2218. }
  2219. }
  2220. });
  2221. return readable;
  2222. }
  2223. }
  2224. class Writer extends Stream {
  2225. constructor() {
  2226. super();
  2227. const writer = this;
  2228. const writable = new WritableStream({
  2229. write(chunk) {
  2230. if (!writer.initialized) {
  2231. throw new Error(ERR_WRITER_NOT_INITIALIZED);
  2232. }
  2233. return writer.writeUint8Array(chunk);
  2234. }
  2235. });
  2236. Object.defineProperty(writer, PROPERTY_NAME_WRITABLE, {
  2237. get() {
  2238. return writable;
  2239. }
  2240. });
  2241. }
  2242. writeUint8Array() {
  2243. // abstract
  2244. }
  2245. }
  2246. class Data64URIReader extends Reader {
  2247. constructor(dataURI) {
  2248. super();
  2249. let dataEnd = dataURI.length;
  2250. while (dataURI.charAt(dataEnd - 1) == "=") {
  2251. dataEnd--;
  2252. }
  2253. const dataStart = dataURI.indexOf(",") + 1;
  2254. Object.assign(this, {
  2255. dataURI,
  2256. dataStart,
  2257. size: Math.floor((dataEnd - dataStart) * 0.75)
  2258. });
  2259. }
  2260. readUint8Array(offset, length) {
  2261. const {
  2262. dataStart,
  2263. dataURI
  2264. } = this;
  2265. const dataArray = new Uint8Array(length);
  2266. const start = Math.floor(offset / 3) * 4;
  2267. const bytes = atob(dataURI.substring(start + dataStart, Math.ceil((offset + length) / 3) * 4 + dataStart));
  2268. const delta = offset - Math.floor(start / 4) * 3;
  2269. let effectiveLength = 0;
  2270. for (let indexByte = delta; indexByte < delta + length && indexByte < bytes.length; indexByte++) {
  2271. dataArray[indexByte - delta] = bytes.charCodeAt(indexByte);
  2272. effectiveLength++;
  2273. }
  2274. if (effectiveLength < dataArray.length) {
  2275. return dataArray.subarray(0, effectiveLength);
  2276. } else {
  2277. return dataArray;
  2278. }
  2279. }
  2280. }
  2281. class Data64URIWriter extends Writer {
  2282. constructor(contentType) {
  2283. super();
  2284. Object.assign(this, {
  2285. data: "data:" + (contentType || "") + ";base64,",
  2286. pending: []
  2287. });
  2288. }
  2289. writeUint8Array(array) {
  2290. const writer = this;
  2291. let indexArray = 0;
  2292. let dataString = writer.pending;
  2293. const delta = writer.pending.length;
  2294. writer.pending = "";
  2295. for (indexArray = 0; indexArray < (Math.floor((delta + array.length) / 3) * 3) - delta; indexArray++) {
  2296. dataString += String.fromCharCode(array[indexArray]);
  2297. }
  2298. for (; indexArray < array.length; indexArray++) {
  2299. writer.pending += String.fromCharCode(array[indexArray]);
  2300. }
  2301. if (dataString.length) {
  2302. if (dataString.length > 2) {
  2303. writer.data += btoa(dataString);
  2304. } else {
  2305. writer.pending += dataString;
  2306. }
  2307. }
  2308. }
  2309. getData() {
  2310. return this.data + btoa(this.pending);
  2311. }
  2312. }
  2313. class BlobReader extends Reader {
  2314. constructor(blob) {
  2315. super();
  2316. Object.assign(this, {
  2317. blob,
  2318. size: blob.size
  2319. });
  2320. }
  2321. async readUint8Array(offset, length) {
  2322. const reader = this;
  2323. const offsetEnd = offset + length;
  2324. const blob = offset || offsetEnd < reader.size ? reader.blob.slice(offset, offsetEnd) : reader.blob;
  2325. let arrayBuffer = await blob.arrayBuffer();
  2326. if (arrayBuffer.byteLength > length) {
  2327. arrayBuffer = arrayBuffer.slice(offset, offsetEnd);
  2328. }
  2329. return new Uint8Array(arrayBuffer);
  2330. }
  2331. }
  2332. class BlobWriter extends Stream {
  2333. constructor(contentType) {
  2334. super();
  2335. const writer = this;
  2336. const transformStream = new TransformStream();
  2337. const headers = [];
  2338. if (contentType) {
  2339. headers.push([HTTP_HEADER_CONTENT_TYPE, contentType]);
  2340. }
  2341. Object.defineProperty(writer, PROPERTY_NAME_WRITABLE, {
  2342. get() {
  2343. return transformStream.writable;
  2344. }
  2345. });
  2346. writer.blob = new Response(transformStream.readable, { headers }).blob();
  2347. }
  2348. getData() {
  2349. return this.blob;
  2350. }
  2351. }
  2352. class TextReader extends BlobReader {
  2353. constructor(text) {
  2354. super(new Blob([text], { type: CONTENT_TYPE_TEXT_PLAIN }));
  2355. }
  2356. }
  2357. class TextWriter extends BlobWriter {
  2358. constructor(encoding) {
  2359. super(encoding);
  2360. Object.assign(this, {
  2361. encoding,
  2362. utf8: !encoding || encoding.toLowerCase() == "utf-8"
  2363. });
  2364. }
  2365. async getData() {
  2366. const {
  2367. encoding,
  2368. utf8
  2369. } = this;
  2370. const blob = await super.getData();
  2371. if (blob.text && utf8) {
  2372. return blob.text();
  2373. } else {
  2374. const reader = new FileReader();
  2375. return new Promise((resolve, reject) => {
  2376. Object.assign(reader, {
  2377. onload: ({ target }) => resolve(target.result),
  2378. onerror: () => reject(reader.error)
  2379. });
  2380. reader.readAsText(blob, encoding);
  2381. });
  2382. }
  2383. }
  2384. }
  2385. class FetchReader extends Reader {
  2386. constructor(url, options) {
  2387. super();
  2388. createHttpReader(this, url, options);
  2389. }
  2390. async init() {
  2391. await initHttpReader(this, sendFetchRequest, getFetchRequestData);
  2392. super.init();
  2393. }
  2394. readUint8Array(index, length) {
  2395. return readUint8ArrayHttpReader(this, index, length, sendFetchRequest, getFetchRequestData);
  2396. }
  2397. }
  2398. class XHRReader extends Reader {
  2399. constructor(url, options) {
  2400. super();
  2401. createHttpReader(this, url, options);
  2402. }
  2403. async init() {
  2404. await initHttpReader(this, sendXMLHttpRequest, getXMLHttpRequestData);
  2405. super.init();
  2406. }
  2407. readUint8Array(index, length) {
  2408. return readUint8ArrayHttpReader(this, index, length, sendXMLHttpRequest, getXMLHttpRequestData);
  2409. }
  2410. }
  2411. function createHttpReader(httpReader, url, options) {
  2412. const {
  2413. preventHeadRequest,
  2414. useRangeHeader,
  2415. forceRangeRequests,
  2416. combineSizeEocd
  2417. } = options;
  2418. options = Object.assign({}, options);
  2419. delete options.preventHeadRequest;
  2420. delete options.useRangeHeader;
  2421. delete options.forceRangeRequests;
  2422. delete options.combineSizeEocd;
  2423. delete options.useXHR;
  2424. Object.assign(httpReader, {
  2425. url,
  2426. options,
  2427. preventHeadRequest,
  2428. useRangeHeader,
  2429. forceRangeRequests,
  2430. combineSizeEocd
  2431. });
  2432. }
  2433. async function initHttpReader(httpReader, sendRequest, getRequestData) {
  2434. const {
  2435. url,
  2436. preventHeadRequest,
  2437. useRangeHeader,
  2438. forceRangeRequests,
  2439. combineSizeEocd
  2440. } = httpReader;
  2441. if (isHttpFamily(url) && (useRangeHeader || forceRangeRequests) && (typeof preventHeadRequest == "undefined" || preventHeadRequest)) {
  2442. const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, combineSizeEocd ? -END_OF_CENTRAL_DIR_LENGTH : undefined));
  2443. const acceptRanges = response.headers.get(HTTP_HEADER_ACCEPT_RANGES);
  2444. if (!forceRangeRequests && (!acceptRanges || acceptRanges.toLowerCase() != HTTP_RANGE_UNIT)) {
  2445. throw new Error(ERR_HTTP_RANGE);
  2446. } else {
  2447. if (combineSizeEocd) {
  2448. httpReader.eocdCache = new Uint8Array(await response.arrayBuffer());
  2449. }
  2450. let contentSize;
  2451. const contentRangeHeader = response.headers.get(HTTP_HEADER_CONTENT_RANGE);
  2452. if (contentRangeHeader) {
  2453. const splitHeader = contentRangeHeader.trim().split(/\s*\/\s*/);
  2454. if (splitHeader.length) {
  2455. const headerValue = splitHeader[1];
  2456. if (headerValue && headerValue != "*") {
  2457. contentSize = Number(headerValue);
  2458. }
  2459. }
  2460. }
  2461. if (contentSize === UNDEFINED_VALUE) {
  2462. await getContentLength(httpReader, sendRequest, getRequestData);
  2463. } else {
  2464. httpReader.size = contentSize;
  2465. }
  2466. }
  2467. } else {
  2468. await getContentLength(httpReader, sendRequest, getRequestData);
  2469. }
  2470. }
  2471. async function readUint8ArrayHttpReader(httpReader, index, length, sendRequest, getRequestData) {
  2472. const {
  2473. useRangeHeader,
  2474. forceRangeRequests,
  2475. eocdCache,
  2476. size,
  2477. options
  2478. } = httpReader;
  2479. if (useRangeHeader || forceRangeRequests) {
  2480. if (eocdCache && index == size - END_OF_CENTRAL_DIR_LENGTH && length == END_OF_CENTRAL_DIR_LENGTH) {
  2481. return eocdCache;
  2482. }
  2483. if (index >= size || length === 0) {
  2484. return new Uint8Array();
  2485. } else {
  2486. if (index + length > size) {
  2487. length = size - index;
  2488. }
  2489. const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
  2490. if (response.status != 206) {
  2491. throw new Error(ERR_HTTP_RANGE);
  2492. }
  2493. return new Uint8Array(await response.arrayBuffer());
  2494. }
  2495. } else {
  2496. const { data } = httpReader;
  2497. if (!data) {
  2498. await getRequestData(httpReader, options);
  2499. }
  2500. return new Uint8Array(httpReader.data.subarray(index, index + length));
  2501. }
  2502. }
  2503. function getRangeHeaders(httpReader, index = 0, length = 1) {
  2504. return Object.assign({}, getHeaders(httpReader), { [HTTP_HEADER_RANGE]: HTTP_RANGE_UNIT + "=" + (index < 0 ? index : index + "-" + (index + length - 1)) });
  2505. }
  2506. function getHeaders({ options }) {
  2507. const { headers } = options;
  2508. if (headers) {
  2509. if (Symbol.iterator in headers) {
  2510. return Object.fromEntries(headers);
  2511. } else {
  2512. return headers;
  2513. }
  2514. }
  2515. }
  2516. async function getFetchRequestData(httpReader) {
  2517. await getRequestData(httpReader, sendFetchRequest);
  2518. }
  2519. async function getXMLHttpRequestData(httpReader) {
  2520. await getRequestData(httpReader, sendXMLHttpRequest);
  2521. }
  2522. async function getRequestData(httpReader, sendRequest) {
  2523. const response = await sendRequest(HTTP_METHOD_GET, httpReader, getHeaders(httpReader));
  2524. httpReader.data = new Uint8Array(await response.arrayBuffer());
  2525. if (!httpReader.size) {
  2526. httpReader.size = httpReader.data.length;
  2527. }
  2528. }
  2529. async function getContentLength(httpReader, sendRequest, getRequestData) {
  2530. if (httpReader.preventHeadRequest) {
  2531. await getRequestData(httpReader, httpReader.options);
  2532. } else {
  2533. const response = await sendRequest(HTTP_METHOD_HEAD, httpReader, getHeaders(httpReader));
  2534. const contentLength = response.headers.get(HTTP_HEADER_CONTENT_LENGTH);
  2535. if (contentLength) {
  2536. httpReader.size = Number(contentLength);
  2537. } else {
  2538. await getRequestData(httpReader, httpReader.options);
  2539. }
  2540. }
  2541. }
  2542. async function sendFetchRequest(method, { options, url }, headers) {
  2543. const response = await fetch(url, Object.assign({}, options, { method, headers }));
  2544. if (response.status < 400) {
  2545. return response;
  2546. } else {
  2547. throw response.status == 416 ? new Error(ERR_HTTP_RANGE) : new Error(ERR_HTTP_STATUS + (response.statusText || response.status));
  2548. }
  2549. }
  2550. function sendXMLHttpRequest(method, { url }, headers) {
  2551. return new Promise((resolve, reject) => {
  2552. const request = new XMLHttpRequest();
  2553. request.addEventListener("load", () => {
  2554. if (request.status < 400) {
  2555. const headers = [];
  2556. request.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(header => {
  2557. const splitHeader = header.trim().split(/\s*:\s*/);
  2558. splitHeader[0] = splitHeader[0].trim().replace(/^[a-z]|-[a-z]/g, value => value.toUpperCase());
  2559. headers.push(splitHeader);
  2560. });
  2561. resolve({
  2562. status: request.status,
  2563. arrayBuffer: () => request.response,
  2564. headers: new Map(headers)
  2565. });
  2566. } else {
  2567. reject(request.status == 416 ? new Error(ERR_HTTP_RANGE) : new Error(ERR_HTTP_STATUS + (request.statusText || request.status)));
  2568. }
  2569. }, false);
  2570. request.addEventListener("error", event => reject(event.detail ? event.detail.error : new Error("Network error")), false);
  2571. request.open(method, url);
  2572. if (headers) {
  2573. for (const entry of Object.entries(headers)) {
  2574. request.setRequestHeader(entry[0], entry[1]);
  2575. }
  2576. }
  2577. request.responseType = "arraybuffer";
  2578. request.send();
  2579. });
  2580. }
  2581. class HttpReader extends Reader {
  2582. constructor(url, options = {}) {
  2583. super();
  2584. Object.assign(this, {
  2585. url,
  2586. reader: options.useXHR ? new XHRReader(url, options) : new FetchReader(url, options)
  2587. });
  2588. }
  2589. set size(value) {
  2590. // ignored
  2591. }
  2592. get size() {
  2593. return this.reader.size;
  2594. }
  2595. async init() {
  2596. await this.reader.init();
  2597. super.init();
  2598. }
  2599. readUint8Array(index, length) {
  2600. return this.reader.readUint8Array(index, length);
  2601. }
  2602. }
  2603. class HttpRangeReader extends HttpReader {
  2604. constructor(url, options = {}) {
  2605. options.useRangeHeader = true;
  2606. super(url, options);
  2607. }
  2608. }
  2609. class Uint8ArrayReader extends Reader {
  2610. constructor(array) {
  2611. super();
  2612. array = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
  2613. Object.assign(this, {
  2614. array,
  2615. size: array.length
  2616. });
  2617. }
  2618. readUint8Array(index, length) {
  2619. return this.array.slice(index, index + length);
  2620. }
  2621. }
  2622. class Uint8ArrayWriter extends Writer {
  2623. constructor(defaultBufferSize) {
  2624. super();
  2625. this.defaultBufferSize = defaultBufferSize || DEFAULT_BUFFER_SIZE;
  2626. }
  2627. init(initSize = 0) {
  2628. Object.assign(this, {
  2629. offset: 0,
  2630. array: new Uint8Array(initSize > 0 ? initSize : this.defaultBufferSize)
  2631. });
  2632. super.init();
  2633. }
  2634. writeUint8Array(array) {
  2635. const writer = this;
  2636. const requiredLength = writer.offset + array.length;
  2637. if (requiredLength > writer.array.length) {
  2638. let newLength = writer.array.length ? writer.array.length * 2 : writer.defaultBufferSize;
  2639. while (newLength < requiredLength) {
  2640. newLength *= 2;
  2641. }
  2642. const previousArray = writer.array;
  2643. writer.array = new Uint8Array(newLength);
  2644. writer.array.set(previousArray);
  2645. }
  2646. writer.array.set(array, writer.offset);
  2647. writer.offset += array.length;
  2648. }
  2649. getData() {
  2650. if (this.offset === this.array.length) {
  2651. return this.array;
  2652. } else {
  2653. return this.array.slice(0, this.offset);
  2654. }
  2655. }
  2656. }
  2657. class SplitDataReader extends Reader {
  2658. constructor(readers) {
  2659. super();
  2660. this.readers = readers;
  2661. }
  2662. async init() {
  2663. const reader = this;
  2664. const { readers } = reader;
  2665. reader.lastDiskNumber = 0;
  2666. reader.lastDiskOffset = 0;
  2667. await Promise.all(readers.map(async (diskReader, indexDiskReader) => {
  2668. await diskReader.init();
  2669. if (indexDiskReader != readers.length - 1) {
  2670. reader.lastDiskOffset += diskReader.size;
  2671. }
  2672. reader.size += diskReader.size;
  2673. }));
  2674. super.init();
  2675. }
  2676. async readUint8Array(offset, length, diskNumber = 0) {
  2677. const reader = this;
  2678. const { readers } = this;
  2679. let result;
  2680. let currentDiskNumber = diskNumber;
  2681. if (currentDiskNumber == -1) {
  2682. currentDiskNumber = readers.length - 1;
  2683. }
  2684. let currentReaderOffset = offset;
  2685. while (readers[currentDiskNumber] && currentReaderOffset >= readers[currentDiskNumber].size) {
  2686. currentReaderOffset -= readers[currentDiskNumber].size;
  2687. currentDiskNumber++;
  2688. }
  2689. const currentReader = readers[currentDiskNumber];
  2690. if (currentReader) {
  2691. const currentReaderSize = currentReader.size;
  2692. if (currentReaderOffset + length <= currentReaderSize) {
  2693. result = await readUint8Array(currentReader, currentReaderOffset, length);
  2694. } else {
  2695. const chunkLength = currentReaderSize - currentReaderOffset;
  2696. result = new Uint8Array(length);
  2697. const firstPart = await readUint8Array(currentReader, currentReaderOffset, chunkLength);
  2698. result.set(firstPart, 0);
  2699. const secondPart = await reader.readUint8Array(offset + chunkLength, length - chunkLength, diskNumber);
  2700. result.set(secondPart, chunkLength);
  2701. if (firstPart.length + secondPart.length < length) {
  2702. result = result.subarray(0, firstPart.length + secondPart.length);
  2703. }
  2704. }
  2705. } else {
  2706. result = new Uint8Array();
  2707. }
  2708. reader.lastDiskNumber = Math.max(currentDiskNumber, reader.lastDiskNumber);
  2709. return result;
  2710. }
  2711. }
  2712. class SplitDataWriter extends Stream {
  2713. constructor(writerGenerator, maxSize = 4294967295) {
  2714. super();
  2715. const writer = this;
  2716. Object.assign(writer, {
  2717. diskNumber: 0,
  2718. diskOffset: 0,
  2719. size: 0,
  2720. maxSize,
  2721. availableSize: maxSize
  2722. });
  2723. let diskSourceWriter, diskWritable, diskWriter;
  2724. const writable = new WritableStream({
  2725. async write(chunk) {
  2726. const { availableSize } = writer;
  2727. if (!diskWriter) {
  2728. const { value, done } = await writerGenerator.next();
  2729. if (done && !value) {
  2730. throw new Error(ERR_ITERATOR_COMPLETED_TOO_SOON);
  2731. } else {
  2732. diskSourceWriter = value;
  2733. diskSourceWriter.size = 0;
  2734. if (diskSourceWriter.maxSize) {
  2735. writer.maxSize = diskSourceWriter.maxSize;
  2736. }
  2737. writer.availableSize = writer.maxSize;
  2738. await initStream(diskSourceWriter);
  2739. diskWritable = value.writable;
  2740. diskWriter = diskWritable.getWriter();
  2741. }
  2742. await this.write(chunk);
  2743. } else if (chunk.length >= availableSize) {
  2744. await writeChunk(chunk.subarray(0, availableSize));
  2745. await closeDisk();
  2746. writer.diskOffset += diskSourceWriter.size;
  2747. writer.diskNumber++;
  2748. diskWriter = null;
  2749. await this.write(chunk.subarray(availableSize));
  2750. } else {
  2751. await writeChunk(chunk);
  2752. }
  2753. },
  2754. async close() {
  2755. await diskWriter.ready;
  2756. await closeDisk();
  2757. }
  2758. });
  2759. Object.defineProperty(writer, PROPERTY_NAME_WRITABLE, {
  2760. get() {
  2761. return writable;
  2762. }
  2763. });
  2764. async function writeChunk(chunk) {
  2765. const chunkLength = chunk.length;
  2766. if (chunkLength) {
  2767. await diskWriter.ready;
  2768. await diskWriter.write(chunk);
  2769. diskSourceWriter.size += chunkLength;
  2770. writer.size += chunkLength;
  2771. writer.availableSize -= chunkLength;
  2772. }
  2773. }
  2774. async function closeDisk() {
  2775. await diskWriter.close();
  2776. }
  2777. }
  2778. }
  2779. class GenericReader {
  2780. constructor(reader) {
  2781. if (Array.isArray(reader)) {
  2782. reader = new SplitDataReader(reader);
  2783. }
  2784. if (reader instanceof ReadableStream) {
  2785. reader = {
  2786. readable: reader
  2787. };
  2788. }
  2789. return reader;
  2790. }
  2791. }
  2792. class GenericWriter {
  2793. constructor(writer) {
  2794. if (writer.writable === UNDEFINED_VALUE && typeof writer.next == FUNCTION_TYPE) {
  2795. writer = new SplitDataWriter(writer);
  2796. }
  2797. if (writer instanceof WritableStream) {
  2798. writer = {
  2799. writable: writer
  2800. };
  2801. }
  2802. if (writer.size === UNDEFINED_VALUE) {
  2803. writer.size = 0;
  2804. }
  2805. if (!(writer instanceof SplitDataWriter)) {
  2806. Object.assign(writer, {
  2807. diskNumber: 0,
  2808. diskOffset: 0,
  2809. availableSize: INFINITY_VALUE,
  2810. maxSize: INFINITY_VALUE
  2811. });
  2812. }
  2813. return writer;
  2814. }
  2815. }
  2816. function isHttpFamily(url) {
  2817. const { baseURI } = getConfiguration();
  2818. const { protocol } = new URL(url, baseURI);
  2819. return protocol == "http:" || protocol == "https:";
  2820. }
  2821. async function initStream(stream, initSize) {
  2822. if (stream.init && !stream.initialized) {
  2823. await stream.init(initSize);
  2824. } else {
  2825. return Promise.resolve();
  2826. }
  2827. }
  2828. function readUint8Array(reader, offset, size, diskNumber) {
  2829. return reader.readUint8Array(offset, size, diskNumber);
  2830. }
  2831. /*
  2832. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  2833. Redistribution and use in source and binary forms, with or without
  2834. modification, are permitted provided that the following conditions are met:
  2835. 1. Redistributions of source code must retain the above copyright notice,
  2836. this list of conditions and the following disclaimer.
  2837. 2. Redistributions in binary form must reproduce the above copyright
  2838. notice, this list of conditions and the following disclaimer in
  2839. the documentation and/or other materials provided with the distribution.
  2840. 3. The names of the authors may not be used to endorse or promote products
  2841. derived from this software without specific prior written permission.
  2842. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  2843. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  2844. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  2845. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  2846. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  2847. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  2848. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  2849. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  2850. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  2851. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2852. */
  2853. /* global TextDecoder */
  2854. const CP437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ".split("");
  2855. const VALID_CP437 = CP437.length == 256;
  2856. function decodeCP437(stringValue) {
  2857. if (VALID_CP437) {
  2858. let result = "";
  2859. for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
  2860. result += CP437[stringValue[indexCharacter]];
  2861. }
  2862. return result;
  2863. } else {
  2864. return new TextDecoder().decode(stringValue);
  2865. }
  2866. }
  2867. /*
  2868. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  2869. Redistribution and use in source and binary forms, with or without
  2870. modification, are permitted provided that the following conditions are met:
  2871. 1. Redistributions of source code must retain the above copyright notice,
  2872. this list of conditions and the following disclaimer.
  2873. 2. Redistributions in binary form must reproduce the above copyright
  2874. notice, this list of conditions and the following disclaimer in
  2875. the documentation and/or other materials provided with the distribution.
  2876. 3. The names of the authors may not be used to endorse or promote products
  2877. derived from this software without specific prior written permission.
  2878. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  2879. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  2880. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  2881. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  2882. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  2883. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  2884. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  2885. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  2886. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  2887. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2888. */
  2889. function decodeText(value, encoding) {
  2890. if (encoding && encoding.trim().toLowerCase() == "cp437") {
  2891. return decodeCP437(value);
  2892. } else {
  2893. return new TextDecoder(encoding).decode(value);
  2894. }
  2895. }
  2896. /*
  2897. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  2898. Redistribution and use in source and binary forms, with or without
  2899. modification, are permitted provided that the following conditions are met:
  2900. 1. Redistributions of source code must retain the above copyright notice,
  2901. this list of conditions and the following disclaimer.
  2902. 2. Redistributions in binary form must reproduce the above copyright
  2903. notice, this list of conditions and the following disclaimer in
  2904. the documentation and/or other materials provided with the distribution.
  2905. 3. The names of the authors may not be used to endorse or promote products
  2906. derived from this software without specific prior written permission.
  2907. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  2908. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  2909. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  2910. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  2911. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  2912. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  2913. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  2914. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  2915. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  2916. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  2917. */
  2918. const PROPERTY_NAME_FILENAME = "filename";
  2919. const PROPERTY_NAME_RAW_FILENAME = "rawFilename";
  2920. const PROPERTY_NAME_COMMENT = "comment";
  2921. const PROPERTY_NAME_RAW_COMMENT = "rawComment";
  2922. const PROPERTY_NAME_UNCOMPRESSED_SIZE = "uncompressedSize";
  2923. const PROPERTY_NAME_COMPRESSED_SIZE = "compressedSize";
  2924. const PROPERTY_NAME_OFFSET = "offset";
  2925. const PROPERTY_NAME_DISK_NUMBER_START = "diskNumberStart";
  2926. const PROPERTY_NAME_LAST_MODIFICATION_DATE = "lastModDate";
  2927. const PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE = "rawLastModDate";
  2928. const PROPERTY_NAME_LAST_ACCESS_DATE = "lastAccessDate";
  2929. const PROPERTY_NAME_RAW_LAST_ACCESS_DATE = "rawLastAccessDate";
  2930. const PROPERTY_NAME_CREATION_DATE = "creationDate";
  2931. const PROPERTY_NAME_RAW_CREATION_DATE = "rawCreationDate";
  2932. const PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES = "internalFileAttributes";
  2933. const PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES = "externalFileAttributes";
  2934. const PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW = "msdosAttributesRaw";
  2935. const PROPERTY_NAME_MSDOS_ATTRIBUTES = "msdosAttributes";
  2936. const PROPERTY_NAME_MS_DOS_COMPATIBLE = "msDosCompatible";
  2937. const PROPERTY_NAME_ZIP64 = "zip64";
  2938. const PROPERTY_NAME_ENCRYPTED = "encrypted";
  2939. const PROPERTY_NAME_VERSION = "version";
  2940. const PROPERTY_NAME_VERSION_MADE_BY = "versionMadeBy";
  2941. const PROPERTY_NAME_ZIPCRYPTO = "zipCrypto";
  2942. const PROPERTY_NAME_DIRECTORY = "directory";
  2943. const PROPERTY_NAME_EXECUTABLE = "executable";
  2944. const PROPERTY_NAME_COMPRESSION_METHOD = "compressionMethod";
  2945. const PROPERTY_NAME_SIGNATURE = "signature";
  2946. const PROPERTY_NAME_EXTRA_FIELD = "extraField";
  2947. const PROPERTY_NAME_EXTRA_FIELD_INFOZIP = "extraFieldInfoZip";
  2948. const PROPERTY_NAME_EXTRA_FIELD_UNIX = "extraFieldUnix";
  2949. const PROPERTY_NAME_UID = "uid";
  2950. const PROPERTY_NAME_GID = "gid";
  2951. const PROPERTY_NAME_UNIX_MODE = "unixMode";
  2952. const PROPERTY_NAME_SETUID = "setuid";
  2953. const PROPERTY_NAME_SETGID = "setgid";
  2954. const PROPERTY_NAME_STICKY = "sticky";
  2955. const PROPERTY_NAME_BITFLAG = "bitFlag";
  2956. const PROPERTY_NAME_FILENAME_UTF8 = "filenameUTF8";
  2957. const PROPERTY_NAME_COMMENT_UTF8 = "commentUTF8";
  2958. const PROPERTY_NAME_RAW_EXTRA_FIELD = "rawExtraField";
  2959. const PROPERTY_NAME_EXTRA_FIELD_ZIP64 = "extraFieldZip64";
  2960. const PROPERTY_NAME_EXTRA_FIELD_UNICODE_PATH = "extraFieldUnicodePath";
  2961. const PROPERTY_NAME_EXTRA_FIELD_UNICODE_COMMENT = "extraFieldUnicodeComment";
  2962. const PROPERTY_NAME_EXTRA_FIELD_AES = "extraFieldAES";
  2963. const PROPERTY_NAME_EXTRA_FIELD_NTFS = "extraFieldNTFS";
  2964. const PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP = "extraFieldExtendedTimestamp";
  2965. const PROPERTY_NAMES = [
  2966. PROPERTY_NAME_FILENAME,
  2967. PROPERTY_NAME_RAW_FILENAME,
  2968. PROPERTY_NAME_UNCOMPRESSED_SIZE,
  2969. PROPERTY_NAME_COMPRESSED_SIZE,
  2970. PROPERTY_NAME_LAST_MODIFICATION_DATE,
  2971. PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE,
  2972. PROPERTY_NAME_COMMENT,
  2973. PROPERTY_NAME_RAW_COMMENT,
  2974. PROPERTY_NAME_LAST_ACCESS_DATE,
  2975. PROPERTY_NAME_CREATION_DATE,
  2976. PROPERTY_NAME_RAW_CREATION_DATE,
  2977. PROPERTY_NAME_OFFSET,
  2978. PROPERTY_NAME_DISK_NUMBER_START,
  2979. PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES,
  2980. PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES,
  2981. PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW,
  2982. PROPERTY_NAME_MSDOS_ATTRIBUTES,
  2983. PROPERTY_NAME_MS_DOS_COMPATIBLE,
  2984. PROPERTY_NAME_ZIP64,
  2985. PROPERTY_NAME_ENCRYPTED,
  2986. PROPERTY_NAME_VERSION,
  2987. PROPERTY_NAME_VERSION_MADE_BY,
  2988. PROPERTY_NAME_ZIPCRYPTO,
  2989. PROPERTY_NAME_DIRECTORY,
  2990. PROPERTY_NAME_EXECUTABLE,
  2991. PROPERTY_NAME_COMPRESSION_METHOD,
  2992. PROPERTY_NAME_SIGNATURE,
  2993. PROPERTY_NAME_EXTRA_FIELD,
  2994. PROPERTY_NAME_EXTRA_FIELD_UNIX,
  2995. PROPERTY_NAME_EXTRA_FIELD_INFOZIP,
  2996. PROPERTY_NAME_UID,
  2997. PROPERTY_NAME_GID,
  2998. PROPERTY_NAME_UNIX_MODE,
  2999. PROPERTY_NAME_SETUID,
  3000. PROPERTY_NAME_SETGID,
  3001. PROPERTY_NAME_STICKY,
  3002. PROPERTY_NAME_BITFLAG,
  3003. PROPERTY_NAME_FILENAME_UTF8,
  3004. PROPERTY_NAME_COMMENT_UTF8,
  3005. PROPERTY_NAME_RAW_EXTRA_FIELD,
  3006. PROPERTY_NAME_EXTRA_FIELD_ZIP64,
  3007. PROPERTY_NAME_EXTRA_FIELD_UNICODE_PATH,
  3008. PROPERTY_NAME_EXTRA_FIELD_UNICODE_COMMENT,
  3009. PROPERTY_NAME_EXTRA_FIELD_AES,
  3010. PROPERTY_NAME_EXTRA_FIELD_NTFS,
  3011. PROPERTY_NAME_EXTRA_FIELD_EXTENDED_TIMESTAMP
  3012. ];
  3013. class Entry {
  3014. constructor(data) {
  3015. PROPERTY_NAMES.forEach(name => this[name] = data[name]);
  3016. }
  3017. }
  3018. /*
  3019. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  3020. Redistribution and use in source and binary forms, with or without
  3021. modification, are permitted provided that the following conditions are met:
  3022. 1. Redistributions of source code must retain the above copyright notice,
  3023. this list of conditions and the following disclaimer.
  3024. 2. Redistributions in binary form must reproduce the above copyright
  3025. notice, this list of conditions and the following disclaimer in
  3026. the documentation and/or other materials provided with the distribution.
  3027. 3. The names of the authors may not be used to endorse or promote products
  3028. derived from this software without specific prior written permission.
  3029. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  3030. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  3031. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  3032. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  3033. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  3034. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  3035. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  3036. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  3037. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  3038. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3039. */
  3040. const OPTION_FILENAME_ENCODING = "filenameEncoding";
  3041. const OPTION_COMMENT_ENCODING = "commentEncoding";
  3042. const OPTION_DECODE_TEXT = "decodeText";
  3043. const OPTION_EXTRACT_PREPENDED_DATA = "extractPrependedData";
  3044. const OPTION_EXTRACT_APPENDED_DATA = "extractAppendedData";
  3045. const OPTION_PASSWORD = "password";
  3046. const OPTION_RAW_PASSWORD = "rawPassword";
  3047. const OPTION_PASS_THROUGH = "passThrough";
  3048. const OPTION_SIGNAL = "signal";
  3049. const OPTION_CHECK_PASSWORD_ONLY = "checkPasswordOnly";
  3050. const OPTION_CHECK_OVERLAPPING_ENTRY_ONLY = "checkOverlappingEntryOnly";
  3051. const OPTION_CHECK_OVERLAPPING_ENTRY = "checkOverlappingEntry";
  3052. const OPTION_CHECK_SIGNATURE = "checkSignature";
  3053. const OPTION_USE_WEB_WORKERS = "useWebWorkers";
  3054. const OPTION_USE_COMPRESSION_STREAM = "useCompressionStream";
  3055. const OPTION_TRANSFER_STREAMS = "transferStreams";
  3056. const OPTION_PREVENT_CLOSE = "preventClose";
  3057. const OPTION_ENCRYPTION_STRENGTH = "encryptionStrength";
  3058. const OPTION_EXTENDED_TIMESTAMP = "extendedTimestamp";
  3059. const OPTION_KEEP_ORDER = "keepOrder";
  3060. const OPTION_LEVEL = "level";
  3061. const OPTION_BUFFERED_WRITE = "bufferedWrite";
  3062. const OPTION_CREATE_TEMP_STREAM = "createTempStream";
  3063. const OPTION_DATA_DESCRIPTOR_SIGNATURE = "dataDescriptorSignature";
  3064. const OPTION_USE_UNICODE_FILE_NAMES = "useUnicodeFileNames";
  3065. const OPTION_DATA_DESCRIPTOR = "dataDescriptor";
  3066. const OPTION_SUPPORT_ZIP64_SPLIT_FILE = "supportZip64SplitFile";
  3067. const OPTION_ENCODE_TEXT = "encodeText";
  3068. const OPTION_OFFSET = "offset";
  3069. const OPTION_USDZ = "usdz";
  3070. const OPTION_UNIX_EXTRA_FIELD_TYPE = "unixExtraFieldType";
  3071. /*
  3072. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  3073. Redistribution and use in source and binary forms, with or without
  3074. modification, are permitted provided that the following conditions are met:
  3075. 1. Redistributions of source code must retain the above copyright notice,
  3076. this list of conditions and the following disclaimer.
  3077. 2. Redistributions in binary form must reproduce the above copyright
  3078. notice, this list of conditions and the following disclaimer in
  3079. the documentation and/or other materials provided with the distribution.
  3080. 3. The names of the authors may not be used to endorse or promote products
  3081. derived from this software without specific prior written permission.
  3082. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  3083. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  3084. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  3085. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  3086. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  3087. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  3088. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  3089. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  3090. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  3091. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3092. */
  3093. const ERR_BAD_FORMAT = "File format is not recognized";
  3094. const ERR_EOCDR_NOT_FOUND = "End of central directory not found";
  3095. const ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = "End of Zip64 central directory locator not found";
  3096. const ERR_CENTRAL_DIRECTORY_NOT_FOUND = "Central directory header not found";
  3097. const ERR_LOCAL_FILE_HEADER_NOT_FOUND = "Local file header not found";
  3098. const ERR_EXTRAFIELD_ZIP64_NOT_FOUND = "Zip64 extra field not found";
  3099. const ERR_ENCRYPTED = "File contains encrypted entry";
  3100. const ERR_UNSUPPORTED_ENCRYPTION = "Encryption method not supported";
  3101. const ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
  3102. const ERR_SPLIT_ZIP_FILE = "Split zip file";
  3103. const ERR_OVERLAPPING_ENTRY = "Overlapping entry found";
  3104. const CHARSET_UTF8 = "utf-8";
  3105. const PROPERTY_NAME_UTF8_SUFFIX = "UTF8";
  3106. const CHARSET_CP437 = "cp437";
  3107. const ZIP64_PROPERTIES = [
  3108. [PROPERTY_NAME_UNCOMPRESSED_SIZE, MAX_32_BITS],
  3109. [PROPERTY_NAME_COMPRESSED_SIZE, MAX_32_BITS],
  3110. [PROPERTY_NAME_OFFSET, MAX_32_BITS],
  3111. [PROPERTY_NAME_DISK_NUMBER_START, MAX_16_BITS]
  3112. ];
  3113. const ZIP64_EXTRACTION = {
  3114. [MAX_16_BITS]: {
  3115. getValue: getUint32,
  3116. bytes: 4
  3117. },
  3118. [MAX_32_BITS]: {
  3119. getValue: getBigUint64,
  3120. bytes: 8
  3121. }
  3122. };
  3123. class ZipReader {
  3124. constructor(reader, options = {}) {
  3125. Object.assign(this, {
  3126. reader: new GenericReader(reader),
  3127. options,
  3128. config: getConfiguration(),
  3129. readRanges: []
  3130. });
  3131. }
  3132. async* getEntriesGenerator(options = {}) {
  3133. const zipReader = this;
  3134. let { reader } = zipReader;
  3135. const { config } = zipReader;
  3136. await initStream(reader);
  3137. if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) {
  3138. reader = new BlobReader(await new Response(reader.readable).blob());
  3139. await initStream(reader);
  3140. }
  3141. if (reader.size < END_OF_CENTRAL_DIR_LENGTH) {
  3142. throw new Error(ERR_BAD_FORMAT);
  3143. }
  3144. reader.chunkSize = getChunkSize(config);
  3145. const endOfDirectoryInfo = await seekSignature(reader, END_OF_CENTRAL_DIR_SIGNATURE, reader.size, END_OF_CENTRAL_DIR_LENGTH, MAX_16_BITS * 16);
  3146. if (!endOfDirectoryInfo) {
  3147. const signatureArray = await readUint8Array(reader, 0, 4);
  3148. const signatureView = getDataView$1(signatureArray);
  3149. if (getUint32(signatureView) == SPLIT_ZIP_FILE_SIGNATURE) {
  3150. throw new Error(ERR_SPLIT_ZIP_FILE);
  3151. } else {
  3152. throw new Error(ERR_EOCDR_NOT_FOUND);
  3153. }
  3154. }
  3155. const endOfDirectoryView = getDataView$1(endOfDirectoryInfo);
  3156. let directoryDataLength = getUint32(endOfDirectoryView, 12);
  3157. let directoryDataOffset = getUint32(endOfDirectoryView, 16);
  3158. const commentOffset = endOfDirectoryInfo.offset;
  3159. const commentLength = getUint16(endOfDirectoryView, 20);
  3160. const appendedDataOffset = commentOffset + END_OF_CENTRAL_DIR_LENGTH + commentLength;
  3161. let lastDiskNumber = getUint16(endOfDirectoryView, 4);
  3162. const expectedLastDiskNumber = reader.lastDiskNumber || 0;
  3163. let diskNumber = getUint16(endOfDirectoryView, 6);
  3164. let filesLength = getUint16(endOfDirectoryView, 8);
  3165. let prependedDataLength = 0;
  3166. let startOffset = 0;
  3167. if (directoryDataOffset == MAX_32_BITS || directoryDataLength == MAX_32_BITS || filesLength == MAX_16_BITS || diskNumber == MAX_16_BITS) {
  3168. const endOfDirectoryLocatorArray = await readUint8Array(reader, endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH);
  3169. const endOfDirectoryLocatorView = getDataView$1(endOfDirectoryLocatorArray);
  3170. if (getUint32(endOfDirectoryLocatorView, 0) == ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) {
  3171. directoryDataOffset = getBigUint64(endOfDirectoryLocatorView, 8);
  3172. let endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH, -1);
  3173. let endOfDirectoryView = getDataView$1(endOfDirectoryArray);
  3174. const expectedDirectoryDataOffset = endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH - ZIP64_END_OF_CENTRAL_DIR_LENGTH;
  3175. if (getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {
  3176. const originalDirectoryDataOffset = directoryDataOffset;
  3177. directoryDataOffset = expectedDirectoryDataOffset;
  3178. if (directoryDataOffset > originalDirectoryDataOffset) {
  3179. prependedDataLength = directoryDataOffset - originalDirectoryDataOffset;
  3180. }
  3181. endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH, -1);
  3182. endOfDirectoryView = getDataView$1(endOfDirectoryArray);
  3183. }
  3184. if (getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) {
  3185. throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);
  3186. }
  3187. if (lastDiskNumber == MAX_16_BITS) {
  3188. lastDiskNumber = getUint32(endOfDirectoryView, 16);
  3189. }
  3190. if (diskNumber == MAX_16_BITS) {
  3191. diskNumber = getUint32(endOfDirectoryView, 20);
  3192. }
  3193. if (filesLength == MAX_16_BITS) {
  3194. filesLength = getBigUint64(endOfDirectoryView, 32);
  3195. }
  3196. if (directoryDataLength == MAX_32_BITS) {
  3197. directoryDataLength = getBigUint64(endOfDirectoryView, 40);
  3198. }
  3199. directoryDataOffset -= directoryDataLength;
  3200. }
  3201. }
  3202. if (directoryDataOffset >= reader.size) {
  3203. prependedDataLength = reader.size - directoryDataOffset - directoryDataLength - END_OF_CENTRAL_DIR_LENGTH;
  3204. directoryDataOffset = reader.size - directoryDataLength - END_OF_CENTRAL_DIR_LENGTH;
  3205. }
  3206. if (expectedLastDiskNumber != lastDiskNumber) {
  3207. throw new Error(ERR_SPLIT_ZIP_FILE);
  3208. }
  3209. if (directoryDataOffset < 0) {
  3210. throw new Error(ERR_BAD_FORMAT);
  3211. }
  3212. let offset = 0;
  3213. let directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength, diskNumber);
  3214. let directoryView = getDataView$1(directoryArray);
  3215. if (directoryDataLength) {
  3216. const expectedDirectoryDataOffset = endOfDirectoryInfo.offset - directoryDataLength;
  3217. if (getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {
  3218. const originalDirectoryDataOffset = directoryDataOffset;
  3219. directoryDataOffset = expectedDirectoryDataOffset;
  3220. if (directoryDataOffset > originalDirectoryDataOffset) {
  3221. prependedDataLength += directoryDataOffset - originalDirectoryDataOffset;
  3222. }
  3223. directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength, diskNumber);
  3224. directoryView = getDataView$1(directoryArray);
  3225. }
  3226. }
  3227. const expectedDirectoryDataLength = endOfDirectoryInfo.offset - directoryDataOffset - (reader.lastDiskOffset || 0);
  3228. if (directoryDataLength != expectedDirectoryDataLength && expectedDirectoryDataLength >= 0) {
  3229. directoryDataLength = expectedDirectoryDataLength;
  3230. directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength, diskNumber);
  3231. directoryView = getDataView$1(directoryArray);
  3232. }
  3233. if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
  3234. throw new Error(ERR_BAD_FORMAT);
  3235. }
  3236. const filenameEncoding = getOptionValue$1(zipReader, options, OPTION_FILENAME_ENCODING);
  3237. const commentEncoding = getOptionValue$1(zipReader, options, OPTION_COMMENT_ENCODING);
  3238. for (let indexFile = 0; indexFile < filesLength; indexFile++) {
  3239. const fileEntry = new ZipEntry$1(reader, config, zipReader.options);
  3240. if (getUint32(directoryView, offset) != CENTRAL_FILE_HEADER_SIGNATURE) {
  3241. throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);
  3242. }
  3243. readCommonHeader(fileEntry, directoryView, offset + 6);
  3244. const languageEncodingFlag = Boolean(fileEntry.bitFlag.languageEncodingFlag);
  3245. const filenameOffset = offset + 46;
  3246. const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
  3247. const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
  3248. const versionMadeBy = getUint16(directoryView, offset + 4);
  3249. const msDosCompatible = versionMadeBy >> 8 == 0;
  3250. const unixCompatible = versionMadeBy >> 8 == 3;
  3251. const rawFilename = directoryArray.subarray(filenameOffset, extraFieldOffset);
  3252. const commentLength = getUint16(directoryView, offset + 32);
  3253. const endOffset = commentOffset + commentLength;
  3254. const rawComment = directoryArray.subarray(commentOffset, endOffset);
  3255. const filenameUTF8 = languageEncodingFlag;
  3256. const commentUTF8 = languageEncodingFlag;
  3257. const externalFileAttributes = getUint32(directoryView, offset + 38);
  3258. const msdosAttributesRaw = externalFileAttributes & MAX_8_BITS;
  3259. const msdosAttributes = {
  3260. readOnly: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_READONLY_MASK),
  3261. hidden: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_HIDDEN_MASK),
  3262. system: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_SYSTEM_MASK),
  3263. directory: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_DIR_MASK),
  3264. archive: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_ARCHIVE_MASK)
  3265. };
  3266. const offsetFileEntry = getUint32(directoryView, offset + 42) + prependedDataLength;
  3267. const decode = getOptionValue$1(zipReader, options, OPTION_DECODE_TEXT) || decodeText;
  3268. const rawFilenameEncoding = filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437;
  3269. const rawCommentEncoding = commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437;
  3270. let filename = decode(rawFilename, rawFilenameEncoding);
  3271. if (filename === UNDEFINED_VALUE) {
  3272. filename = decodeText(rawFilename, rawFilenameEncoding);
  3273. }
  3274. let comment = decode(rawComment, rawCommentEncoding);
  3275. if (comment === UNDEFINED_VALUE) {
  3276. comment = decodeText(rawComment, rawCommentEncoding);
  3277. }
  3278. Object.assign(fileEntry, {
  3279. versionMadeBy,
  3280. msDosCompatible,
  3281. compressedSize: 0,
  3282. uncompressedSize: 0,
  3283. commentLength,
  3284. offset: offsetFileEntry,
  3285. diskNumberStart: getUint16(directoryView, offset + 34),
  3286. internalFileAttributes: getUint16(directoryView, offset + 36),
  3287. externalFileAttributes,
  3288. msdosAttributesRaw,
  3289. msdosAttributes,
  3290. rawFilename,
  3291. filenameUTF8,
  3292. commentUTF8,
  3293. rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset),
  3294. rawComment,
  3295. filename,
  3296. comment
  3297. });
  3298. startOffset = Math.max(offsetFileEntry, startOffset);
  3299. readCommonFooter(fileEntry, fileEntry, directoryView, offset + 6);
  3300. const unixExternalUpper = (fileEntry.externalFileAttributes >> 16) & MAX_16_BITS;
  3301. if (fileEntry.unixMode === UNDEFINED_VALUE && (unixExternalUpper & (FILE_ATTR_UNIX_DEFAULT_MASK | FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_TYPE_DIR)) != 0) {
  3302. fileEntry.unixMode = unixExternalUpper;
  3303. }
  3304. const setuid = Boolean(fileEntry.unixMode & FILE_ATTR_UNIX_SETUID_MASK);
  3305. const setgid = Boolean(fileEntry.unixMode & FILE_ATTR_UNIX_SETGID_MASK);
  3306. const sticky = Boolean(fileEntry.unixMode & FILE_ATTR_UNIX_STICKY_MASK);
  3307. const executable = (fileEntry.unixMode !== UNDEFINED_VALUE)
  3308. ? ((fileEntry.unixMode & FILE_ATTR_UNIX_EXECUTABLE_MASK) != 0)
  3309. : (unixCompatible && ((unixExternalUpper & FILE_ATTR_UNIX_EXECUTABLE_MASK) != 0));
  3310. const modeIsDir = fileEntry.unixMode !== UNDEFINED_VALUE && ((fileEntry.unixMode & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_DIR);
  3311. const upperIsDir = ((unixExternalUpper & FILE_ATTR_UNIX_TYPE_MASK) == FILE_ATTR_UNIX_TYPE_DIR);
  3312. Object.assign(fileEntry, {
  3313. setuid,
  3314. setgid,
  3315. sticky,
  3316. unixExternalUpper,
  3317. internalFileAttribute: fileEntry.internalFileAttributes,
  3318. externalFileAttribute: fileEntry.externalFileAttributes,
  3319. executable,
  3320. directory: modeIsDir || upperIsDir || (msDosCompatible && msdosAttributes.directory) || (filename.endsWith(DIRECTORY_SIGNATURE) && !fileEntry.uncompressedSize),
  3321. zipCrypto: fileEntry.encrypted && !fileEntry.extraFieldAES
  3322. });
  3323. const entry = new Entry(fileEntry);
  3324. entry.getData = (writer, options) => fileEntry.getData(writer, entry, zipReader.readRanges, options);
  3325. entry.arrayBuffer = async options => {
  3326. const writer = new TransformStream();
  3327. const [arrayBuffer] = await Promise.all([
  3328. new Response(writer.readable).arrayBuffer(),
  3329. fileEntry.getData(writer, entry, zipReader.readRanges, options)]);
  3330. return arrayBuffer;
  3331. };
  3332. offset = endOffset;
  3333. const { onprogress } = options;
  3334. if (onprogress) {
  3335. try {
  3336. await onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
  3337. } catch {
  3338. // ignored
  3339. }
  3340. }
  3341. yield entry;
  3342. }
  3343. const extractPrependedData = getOptionValue$1(zipReader, options, OPTION_EXTRACT_PREPENDED_DATA);
  3344. const extractAppendedData = getOptionValue$1(zipReader, options, OPTION_EXTRACT_APPENDED_DATA);
  3345. if (extractPrependedData) {
  3346. zipReader.prependedData = startOffset > 0 ? await readUint8Array(reader, 0, startOffset) : new Uint8Array();
  3347. }
  3348. zipReader.comment = commentLength ? await readUint8Array(reader, commentOffset + END_OF_CENTRAL_DIR_LENGTH, commentLength) : new Uint8Array();
  3349. if (extractAppendedData) {
  3350. zipReader.appendedData = appendedDataOffset < reader.size ? await readUint8Array(reader, appendedDataOffset, reader.size - appendedDataOffset) : new Uint8Array();
  3351. }
  3352. return true;
  3353. }
  3354. async getEntries(options = {}) {
  3355. const entries = [];
  3356. for await (const entry of this.getEntriesGenerator(options)) {
  3357. entries.push(entry);
  3358. }
  3359. return entries;
  3360. }
  3361. async close() {
  3362. }
  3363. }
  3364. class ZipReaderStream {
  3365. constructor(options = {}) {
  3366. const { readable, writable } = new TransformStream();
  3367. const gen = new ZipReader(readable, options).getEntriesGenerator();
  3368. this.readable = new ReadableStream({
  3369. async pull(controller) {
  3370. const { done, value } = await gen.next();
  3371. if (done)
  3372. return controller.close();
  3373. const chunk = {
  3374. ...value,
  3375. readable: (function () {
  3376. const { readable, writable } = new TransformStream();
  3377. if (value.getData) {
  3378. value.getData(writable);
  3379. return readable;
  3380. }
  3381. })()
  3382. };
  3383. delete chunk.getData;
  3384. controller.enqueue(chunk);
  3385. }
  3386. });
  3387. this.writable = writable;
  3388. }
  3389. }
  3390. let ZipEntry$1 = class ZipEntry {
  3391. constructor(reader, config, options) {
  3392. Object.assign(this, {
  3393. reader,
  3394. config,
  3395. options
  3396. });
  3397. }
  3398. async getData(writer, fileEntry, readRanges, options = {}) {
  3399. const zipEntry = this;
  3400. const {
  3401. reader,
  3402. offset,
  3403. diskNumberStart,
  3404. extraFieldAES,
  3405. extraFieldZip64,
  3406. compressionMethod,
  3407. config,
  3408. bitFlag,
  3409. signature,
  3410. rawLastModDate,
  3411. uncompressedSize,
  3412. compressedSize
  3413. } = zipEntry;
  3414. const {
  3415. dataDescriptor
  3416. } = bitFlag;
  3417. const localDirectory = fileEntry.localDirectory = {};
  3418. const dataArray = await readUint8Array(reader, offset, HEADER_SIZE, diskNumberStart);
  3419. const dataView = getDataView$1(dataArray);
  3420. let password = getOptionValue$1(zipEntry, options, OPTION_PASSWORD);
  3421. let rawPassword = getOptionValue$1(zipEntry, options, OPTION_RAW_PASSWORD);
  3422. const passThrough = getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH);
  3423. password = password && password.length && password;
  3424. rawPassword = rawPassword && rawPassword.length && rawPassword;
  3425. if (extraFieldAES) {
  3426. if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
  3427. throw new Error(ERR_UNSUPPORTED_COMPRESSION);
  3428. }
  3429. }
  3430. if ((compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE && compressionMethod != COMPRESSION_METHOD_DEFLATE_64) && !passThrough) {
  3431. throw new Error(ERR_UNSUPPORTED_COMPRESSION);
  3432. }
  3433. if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
  3434. throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);
  3435. }
  3436. readCommonHeader(localDirectory, dataView, 4);
  3437. const {
  3438. extraFieldLength,
  3439. filenameLength,
  3440. lastAccessDate,
  3441. creationDate
  3442. } = localDirectory;
  3443. localDirectory.rawExtraField = extraFieldLength ?
  3444. await readUint8Array(reader, offset + HEADER_SIZE + filenameLength, extraFieldLength, diskNumberStart) :
  3445. new Uint8Array();
  3446. readCommonFooter(zipEntry, localDirectory, dataView, 4, true);
  3447. Object.assign(fileEntry, { lastAccessDate, creationDate });
  3448. const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough;
  3449. const zipCrypto = encrypted && !extraFieldAES;
  3450. if (!passThrough) {
  3451. fileEntry.zipCrypto = zipCrypto;
  3452. }
  3453. if (encrypted) {
  3454. if (!zipCrypto && extraFieldAES.strength === UNDEFINED_VALUE) {
  3455. throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
  3456. } else if (!password && !rawPassword) {
  3457. throw new Error(ERR_ENCRYPTED);
  3458. }
  3459. }
  3460. const dataOffset = offset + HEADER_SIZE + filenameLength + extraFieldLength;
  3461. const size = compressedSize;
  3462. const readable = reader.readable;
  3463. Object.assign(readable, {
  3464. diskNumberStart,
  3465. offset: dataOffset,
  3466. size
  3467. });
  3468. const signal = getOptionValue$1(zipEntry, options, OPTION_SIGNAL);
  3469. const checkPasswordOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_PASSWORD_ONLY);
  3470. let checkOverlappingEntry = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY);
  3471. const checkOverlappingEntryOnly = getOptionValue$1(zipEntry, options, OPTION_CHECK_OVERLAPPING_ENTRY_ONLY);
  3472. if (checkOverlappingEntryOnly) {
  3473. checkOverlappingEntry = true;
  3474. }
  3475. const { onstart, onprogress, onend } = options;
  3476. const deflate64 = compressionMethod == COMPRESSION_METHOD_DEFLATE_64;
  3477. let useCompressionStream = getOptionValue$1(zipEntry, options, OPTION_USE_COMPRESSION_STREAM);
  3478. if (deflate64) {
  3479. useCompressionStream = false;
  3480. }
  3481. const workerOptions = {
  3482. options: {
  3483. codecType: CODEC_INFLATE,
  3484. password,
  3485. rawPassword,
  3486. zipCrypto,
  3487. encryptionStrength: extraFieldAES && extraFieldAES.strength,
  3488. signed: getOptionValue$1(zipEntry, options, OPTION_CHECK_SIGNATURE) && !passThrough,
  3489. passwordVerification: zipCrypto && (dataDescriptor ? ((rawLastModDate >>> 8) & MAX_8_BITS) : ((signature >>> 24) & MAX_8_BITS)),
  3490. outputSize: passThrough ? compressedSize : uncompressedSize,
  3491. signature,
  3492. compressed: compressionMethod != 0 && !passThrough,
  3493. encrypted: zipEntry.encrypted && !passThrough,
  3494. useWebWorkers: getOptionValue$1(zipEntry, options, OPTION_USE_WEB_WORKERS),
  3495. useCompressionStream,
  3496. transferStreams: getOptionValue$1(zipEntry, options, OPTION_TRANSFER_STREAMS),
  3497. deflate64,
  3498. checkPasswordOnly
  3499. },
  3500. config,
  3501. streamOptions: { signal, size, onstart, onprogress, onend }
  3502. };
  3503. if (checkOverlappingEntry) {
  3504. await detectOverlappingEntry({
  3505. reader,
  3506. fileEntry,
  3507. offset,
  3508. diskNumberStart,
  3509. signature,
  3510. compressedSize,
  3511. uncompressedSize,
  3512. dataOffset,
  3513. dataDescriptor: dataDescriptor || localDirectory.bitFlag.dataDescriptor,
  3514. extraFieldZip64: extraFieldZip64 || localDirectory.extraFieldZip64,
  3515. readRanges
  3516. });
  3517. }
  3518. let writable;
  3519. try {
  3520. if (!checkOverlappingEntryOnly) {
  3521. if (checkPasswordOnly) {
  3522. writer = new WritableStream();
  3523. }
  3524. writer = new GenericWriter(writer);
  3525. await initStream(writer, passThrough ? compressedSize : uncompressedSize);
  3526. ({ writable } = writer);
  3527. const { outputSize } = await runWorker({ readable, writable }, workerOptions);
  3528. writer.size += outputSize;
  3529. if (outputSize != (passThrough ? compressedSize : uncompressedSize)) {
  3530. throw new Error(ERR_INVALID_UNCOMPRESSED_SIZE);
  3531. }
  3532. }
  3533. } catch (error) {
  3534. if (error.outputSize !== UNDEFINED_VALUE) {
  3535. writer.size += error.outputSize;
  3536. }
  3537. if (!checkPasswordOnly || error.message != ERR_ABORT_CHECK_PASSWORD) {
  3538. throw error;
  3539. }
  3540. } finally {
  3541. const preventClose = getOptionValue$1(zipEntry, options, OPTION_PREVENT_CLOSE);
  3542. if (!preventClose && writable && !writable.locked) {
  3543. await writable.getWriter().close();
  3544. }
  3545. }
  3546. return checkPasswordOnly || checkOverlappingEntryOnly ? UNDEFINED_VALUE : writer.getData ? writer.getData() : writable;
  3547. }
  3548. };
  3549. function readCommonHeader(directory, dataView, offset) {
  3550. const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset + 2);
  3551. const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;
  3552. const rawLastModDate = getUint32(dataView, offset + 6);
  3553. Object.assign(directory, {
  3554. encrypted,
  3555. version: getUint16(dataView, offset),
  3556. bitFlag: {
  3557. level: (rawBitFlag & BITFLAG_LEVEL) >> 1,
  3558. dataDescriptor: (rawBitFlag & BITFLAG_DATA_DESCRIPTOR) == BITFLAG_DATA_DESCRIPTOR,
  3559. languageEncodingFlag: (rawBitFlag & BITFLAG_LANG_ENCODING_FLAG) == BITFLAG_LANG_ENCODING_FLAG
  3560. },
  3561. rawLastModDate,
  3562. lastModDate: getDate(rawLastModDate),
  3563. filenameLength: getUint16(dataView, offset + 22),
  3564. extraFieldLength: getUint16(dataView, offset + 24)
  3565. });
  3566. }
  3567. function readCommonFooter(fileEntry, directory, dataView, offset, localDirectory) {
  3568. const { rawExtraField } = directory;
  3569. const extraField = directory.extraField = new Map();
  3570. const rawExtraFieldView = getDataView$1(new Uint8Array(rawExtraField));
  3571. let offsetExtraField = 0;
  3572. try {
  3573. while (offsetExtraField < rawExtraField.length) {
  3574. const type = getUint16(rawExtraFieldView, offsetExtraField);
  3575. const size = getUint16(rawExtraFieldView, offsetExtraField + 2);
  3576. extraField.set(type, {
  3577. type,
  3578. data: rawExtraField.slice(offsetExtraField + 4, offsetExtraField + 4 + size)
  3579. });
  3580. offsetExtraField += 4 + size;
  3581. }
  3582. } catch {
  3583. // ignored
  3584. }
  3585. const compressionMethod = getUint16(dataView, offset + 4);
  3586. Object.assign(directory, {
  3587. signature: getUint32(dataView, offset + HEADER_OFFSET_SIGNATURE),
  3588. compressedSize: getUint32(dataView, offset + HEADER_OFFSET_COMPRESSED_SIZE),
  3589. uncompressedSize: getUint32(dataView, offset + HEADER_OFFSET_UNCOMPRESSED_SIZE)
  3590. });
  3591. const extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);
  3592. if (extraFieldZip64) {
  3593. readExtraFieldZip64(extraFieldZip64, directory);
  3594. directory.extraFieldZip64 = extraFieldZip64;
  3595. }
  3596. const extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);
  3597. if (extraFieldUnicodePath) {
  3598. readExtraFieldUnicode(extraFieldUnicodePath, PROPERTY_NAME_FILENAME, PROPERTY_NAME_RAW_FILENAME, directory, fileEntry);
  3599. directory.extraFieldUnicodePath = extraFieldUnicodePath;
  3600. }
  3601. const extraFieldUnicodeComment = extraField.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);
  3602. if (extraFieldUnicodeComment) {
  3603. readExtraFieldUnicode(extraFieldUnicodeComment, PROPERTY_NAME_COMMENT, PROPERTY_NAME_RAW_COMMENT, directory, fileEntry);
  3604. directory.extraFieldUnicodeComment = extraFieldUnicodeComment;
  3605. }
  3606. const extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);
  3607. if (extraFieldAES) {
  3608. readExtraFieldAES(extraFieldAES, directory, compressionMethod);
  3609. directory.extraFieldAES = extraFieldAES;
  3610. } else {
  3611. directory.compressionMethod = compressionMethod;
  3612. }
  3613. const extraFieldNTFS = extraField.get(EXTRAFIELD_TYPE_NTFS);
  3614. if (extraFieldNTFS) {
  3615. readExtraFieldNTFS(extraFieldNTFS, directory);
  3616. directory.extraFieldNTFS = extraFieldNTFS;
  3617. }
  3618. const extraFieldUnix = extraField.get(EXTRAFIELD_TYPE_UNIX);
  3619. if (extraFieldUnix) {
  3620. readExtraFieldUnix(extraFieldUnix, directory, false);
  3621. directory.extraFieldUnix = extraFieldUnix;
  3622. } else {
  3623. const extraFieldInfoZip = extraField.get(EXTRAFIELD_TYPE_INFOZIP);
  3624. if (extraFieldInfoZip) {
  3625. readExtraFieldUnix(extraFieldInfoZip, directory, true);
  3626. directory.extraFieldInfoZip = extraFieldInfoZip;
  3627. }
  3628. }
  3629. const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
  3630. if (extraFieldExtendedTimestamp) {
  3631. readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory);
  3632. directory.extraFieldExtendedTimestamp = extraFieldExtendedTimestamp;
  3633. }
  3634. const extraFieldUSDZ = extraField.get(EXTRAFIELD_TYPE_USDZ);
  3635. if (extraFieldUSDZ) {
  3636. directory.extraFieldUSDZ = extraFieldUSDZ;
  3637. }
  3638. }
  3639. function readExtraFieldZip64(extraFieldZip64, directory) {
  3640. directory.zip64 = true;
  3641. const extraFieldView = getDataView$1(extraFieldZip64.data);
  3642. const missingProperties = ZIP64_PROPERTIES.filter(([propertyName, max]) => directory[propertyName] == max);
  3643. for (let indexMissingProperty = 0, offset = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) {
  3644. const [propertyName, max] = missingProperties[indexMissingProperty];
  3645. if (directory[propertyName] == max) {
  3646. const extraction = ZIP64_EXTRACTION[max];
  3647. directory[propertyName] = extraFieldZip64[propertyName] = extraction.getValue(extraFieldView, offset);
  3648. offset += extraction.bytes;
  3649. } else if (extraFieldZip64[propertyName]) {
  3650. throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
  3651. }
  3652. }
  3653. }
  3654. function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
  3655. const extraFieldView = getDataView$1(extraFieldUnicode.data);
  3656. const crc32 = new Crc32();
  3657. crc32.append(fileEntry[rawPropertyName]);
  3658. const dataViewSignature = getDataView$1(new Uint8Array(4));
  3659. dataViewSignature.setUint32(0, crc32.get(), true);
  3660. const signature = getUint32(extraFieldView, 1);
  3661. Object.assign(extraFieldUnicode, {
  3662. version: getUint8(extraFieldView, 0),
  3663. [propertyName]: decodeText(extraFieldUnicode.data.subarray(5)),
  3664. valid: !fileEntry.bitFlag.languageEncodingFlag && signature == getUint32(dataViewSignature, 0)
  3665. });
  3666. if (extraFieldUnicode.valid) {
  3667. directory[propertyName] = extraFieldUnicode[propertyName];
  3668. directory[propertyName + PROPERTY_NAME_UTF8_SUFFIX] = true;
  3669. }
  3670. }
  3671. function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
  3672. const extraFieldView = getDataView$1(extraFieldAES.data);
  3673. const strength = getUint8(extraFieldView, 4);
  3674. Object.assign(extraFieldAES, {
  3675. vendorVersion: getUint8(extraFieldView, 0),
  3676. vendorId: getUint8(extraFieldView, 2),
  3677. strength,
  3678. originalCompressionMethod: compressionMethod,
  3679. compressionMethod: getUint16(extraFieldView, 5)
  3680. });
  3681. directory.compressionMethod = extraFieldAES.compressionMethod;
  3682. }
  3683. function readExtraFieldNTFS(extraFieldNTFS, directory) {
  3684. const extraFieldView = getDataView$1(extraFieldNTFS.data);
  3685. let offsetExtraField = 4;
  3686. let tag1Data;
  3687. try {
  3688. while (offsetExtraField < extraFieldNTFS.data.length && !tag1Data) {
  3689. const tagValue = getUint16(extraFieldView, offsetExtraField);
  3690. const attributeSize = getUint16(extraFieldView, offsetExtraField + 2);
  3691. if (tagValue == EXTRAFIELD_TYPE_NTFS_TAG1) {
  3692. tag1Data = extraFieldNTFS.data.slice(offsetExtraField + 4, offsetExtraField + 4 + attributeSize);
  3693. }
  3694. offsetExtraField += 4 + attributeSize;
  3695. }
  3696. } catch {
  3697. // ignored
  3698. }
  3699. try {
  3700. if (tag1Data && tag1Data.length == 24) {
  3701. const tag1View = getDataView$1(tag1Data);
  3702. const rawLastModDate = tag1View.getBigUint64(0, true);
  3703. const rawLastAccessDate = tag1View.getBigUint64(8, true);
  3704. const rawCreationDate = tag1View.getBigUint64(16, true);
  3705. Object.assign(extraFieldNTFS, {
  3706. rawLastModDate,
  3707. rawLastAccessDate,
  3708. rawCreationDate
  3709. });
  3710. const lastModDate = getDateNTFS(rawLastModDate);
  3711. const lastAccessDate = getDateNTFS(rawLastAccessDate);
  3712. const creationDate = getDateNTFS(rawCreationDate);
  3713. const extraFieldData = { lastModDate, lastAccessDate, creationDate };
  3714. Object.assign(extraFieldNTFS, extraFieldData);
  3715. Object.assign(directory, extraFieldData);
  3716. }
  3717. } catch {
  3718. // ignored
  3719. }
  3720. }
  3721. function readExtraFieldUnix(extraField, directory, isInfoZip) {
  3722. try {
  3723. const view = getDataView$1(new Uint8Array(extraField.data));
  3724. let offset = 0;
  3725. const version = getUint8(view, offset++);
  3726. const uidSize = getUint8(view, offset++);
  3727. const uidBytes = extraField.data.subarray(offset, offset + uidSize);
  3728. offset += uidSize;
  3729. const uid = unpackUnixId(uidBytes);
  3730. const gidSize = getUint8(view, offset++);
  3731. const gidBytes = extraField.data.subarray(offset, offset + gidSize);
  3732. offset += gidSize;
  3733. const gid = unpackUnixId(gidBytes);
  3734. let unixMode = UNDEFINED_VALUE;
  3735. if (!isInfoZip && offset + 2 <= extraField.data.length) {
  3736. const base = extraField.data;
  3737. const modeView = new DataView(base.buffer, base.byteOffset + offset, 2);
  3738. unixMode = modeView.getUint16(0, true);
  3739. }
  3740. Object.assign(extraField, { version, uid, gid, unixMode });
  3741. if (uid !== UNDEFINED_VALUE) {
  3742. directory.uid = uid;
  3743. }
  3744. if (gid !== UNDEFINED_VALUE) {
  3745. directory.gid = gid;
  3746. }
  3747. if (unixMode !== UNDEFINED_VALUE) {
  3748. directory.unixMode = unixMode;
  3749. }
  3750. } catch {
  3751. // ignored
  3752. }
  3753. }
  3754. function unpackUnixId(bytes) {
  3755. const buffer = new Uint8Array(4);
  3756. buffer.set(bytes, 0);
  3757. const view = new DataView(buffer.buffer, buffer.byteOffset, 4);
  3758. return view.getUint32(0, true);
  3759. }
  3760. function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory, localDirectory) {
  3761. const extraFieldView = getDataView$1(extraFieldExtendedTimestamp.data);
  3762. const flags = getUint8(extraFieldView, 0);
  3763. const timeProperties = [];
  3764. const timeRawProperties = [];
  3765. if (localDirectory) {
  3766. if ((flags & 0x1) == 0x1) {
  3767. timeProperties.push(PROPERTY_NAME_LAST_MODIFICATION_DATE);
  3768. timeRawProperties.push(PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE);
  3769. }
  3770. if ((flags & 0x2) == 0x2) {
  3771. timeProperties.push(PROPERTY_NAME_LAST_ACCESS_DATE);
  3772. timeRawProperties.push(PROPERTY_NAME_RAW_LAST_ACCESS_DATE);
  3773. }
  3774. if ((flags & 0x4) == 0x4) {
  3775. timeProperties.push(PROPERTY_NAME_CREATION_DATE);
  3776. timeRawProperties.push(PROPERTY_NAME_RAW_CREATION_DATE);
  3777. }
  3778. } else if (extraFieldExtendedTimestamp.data.length >= 5) {
  3779. timeProperties.push(PROPERTY_NAME_LAST_MODIFICATION_DATE);
  3780. timeRawProperties.push(PROPERTY_NAME_RAW_LAST_MODIFICATION_DATE);
  3781. }
  3782. let offset = 1;
  3783. timeProperties.forEach((propertyName, indexProperty) => {
  3784. if (extraFieldExtendedTimestamp.data.length >= offset + 4) {
  3785. const time = getUint32(extraFieldView, offset);
  3786. directory[propertyName] = extraFieldExtendedTimestamp[propertyName] = new Date(time * 1000);
  3787. const rawPropertyName = timeRawProperties[indexProperty];
  3788. extraFieldExtendedTimestamp[rawPropertyName] = time;
  3789. }
  3790. offset += 4;
  3791. });
  3792. }
  3793. async function detectOverlappingEntry({
  3794. reader,
  3795. fileEntry,
  3796. offset,
  3797. diskNumberStart,
  3798. signature,
  3799. compressedSize,
  3800. uncompressedSize,
  3801. dataOffset,
  3802. dataDescriptor,
  3803. extraFieldZip64,
  3804. readRanges
  3805. }) {
  3806. let diskOffset = 0;
  3807. if (diskNumberStart) {
  3808. for (let indexReader = 0; indexReader < diskNumberStart; indexReader++) {
  3809. const diskReader = reader.readers[indexReader];
  3810. diskOffset += diskReader.size;
  3811. }
  3812. }
  3813. let dataDescriptorLength = 0;
  3814. if (dataDescriptor) {
  3815. if (extraFieldZip64) {
  3816. dataDescriptorLength = DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH;
  3817. } else {
  3818. dataDescriptorLength = DATA_DESCRIPTOR_RECORD_LENGTH;
  3819. }
  3820. }
  3821. if (dataDescriptorLength) {
  3822. const dataDescriptorArray = await readUint8Array(reader, dataOffset + compressedSize, dataDescriptorLength + DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH, diskNumberStart);
  3823. const dataDescriptorSignature = getUint32(getDataView$1(dataDescriptorArray), 0) == DATA_DESCRIPTOR_RECORD_SIGNATURE;
  3824. if (dataDescriptorSignature) {
  3825. const readSignature = getUint32(getDataView$1(dataDescriptorArray), 4);
  3826. let readCompressedSize;
  3827. let readUncompressedSize;
  3828. if (extraFieldZip64) {
  3829. readCompressedSize = getBigUint64(getDataView$1(dataDescriptorArray), 8);
  3830. readUncompressedSize = getBigUint64(getDataView$1(dataDescriptorArray), 16);
  3831. } else {
  3832. readCompressedSize = getUint32(getDataView$1(dataDescriptorArray), 8);
  3833. readUncompressedSize = getUint32(getDataView$1(dataDescriptorArray), 12);
  3834. }
  3835. const matchSignature = (fileEntry.encrypted && !fileEntry.zipCrypto) || readSignature == signature;
  3836. if (matchSignature &&
  3837. readCompressedSize == compressedSize &&
  3838. readUncompressedSize == uncompressedSize) {
  3839. dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
  3840. }
  3841. }
  3842. }
  3843. const range = {
  3844. start: diskOffset + offset,
  3845. end: diskOffset + dataOffset + compressedSize + dataDescriptorLength,
  3846. fileEntry
  3847. };
  3848. for (const otherRange of readRanges) {
  3849. if (otherRange.fileEntry != fileEntry && range.start >= otherRange.start && range.start < otherRange.end) {
  3850. const error = new Error(ERR_OVERLAPPING_ENTRY);
  3851. error.overlappingEntry = otherRange.fileEntry;
  3852. throw error;
  3853. }
  3854. }
  3855. readRanges.push(range);
  3856. }
  3857. async function seekSignature(reader, signature, startOffset, minimumBytes, maximumLength) {
  3858. const signatureArray = new Uint8Array(4);
  3859. const signatureView = getDataView$1(signatureArray);
  3860. setUint32$1(signatureView, 0, signature);
  3861. const maximumBytes = minimumBytes + maximumLength;
  3862. return (await seek(minimumBytes)) || await seek(Math.min(maximumBytes, startOffset));
  3863. async function seek(length) {
  3864. const offset = startOffset - length;
  3865. const bytes = await readUint8Array(reader, offset, length);
  3866. for (let indexByte = bytes.length - minimumBytes; indexByte >= 0; indexByte--) {
  3867. if (bytes[indexByte] == signatureArray[0] && bytes[indexByte + 1] == signatureArray[1] &&
  3868. bytes[indexByte + 2] == signatureArray[2] && bytes[indexByte + 3] == signatureArray[3]) {
  3869. return {
  3870. offset: offset + indexByte,
  3871. buffer: bytes.slice(indexByte, indexByte + minimumBytes).buffer
  3872. };
  3873. }
  3874. }
  3875. }
  3876. }
  3877. function getOptionValue$1(zipReader, options, name) {
  3878. return options[name] === UNDEFINED_VALUE ? zipReader.options[name] : options[name];
  3879. }
  3880. function getDate(timeRaw) {
  3881. const date = (timeRaw & 0xffff0000) >> 16, time = timeRaw & MAX_16_BITS;
  3882. try {
  3883. return new Date(1980 + ((date & 0xFE00) >> 9), ((date & 0x01E0) >> 5) - 1, date & 0x001F, (time & 0xF800) >> 11, (time & 0x07E0) >> 5, (time & 0x001F) * 2, 0);
  3884. } catch {
  3885. // ignored
  3886. }
  3887. }
  3888. function getDateNTFS(timeRaw) {
  3889. return new Date((Number((timeRaw / BigInt(10000)) - BigInt(11644473600000))));
  3890. }
  3891. function getUint8(view, offset) {
  3892. return view.getUint8(offset);
  3893. }
  3894. function getUint16(view, offset) {
  3895. return view.getUint16(offset, true);
  3896. }
  3897. function getUint32(view, offset) {
  3898. return view.getUint32(offset, true);
  3899. }
  3900. function getBigUint64(view, offset) {
  3901. return Number(view.getBigUint64(offset, true));
  3902. }
  3903. function setUint32$1(view, offset, value) {
  3904. view.setUint32(offset, value, true);
  3905. }
  3906. function getDataView$1(array) {
  3907. return new DataView(array.buffer);
  3908. }
  3909. /*
  3910. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  3911. Redistribution and use in source and binary forms, with or without
  3912. modification, are permitted provided that the following conditions are met:
  3913. 1. Redistributions of source code must retain the above copyright notice,
  3914. this list of conditions and the following disclaimer.
  3915. 2. Redistributions in binary form must reproduce the above copyright
  3916. notice, this list of conditions and the following disclaimer in
  3917. the documentation and/or other materials provided with the distribution.
  3918. 3. The names of the authors may not be used to endorse or promote products
  3919. derived from this software without specific prior written permission.
  3920. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  3921. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  3922. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  3923. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  3924. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  3925. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  3926. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  3927. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  3928. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  3929. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  3930. */
  3931. const ERR_DUPLICATED_NAME = "File already exists";
  3932. const ERR_INVALID_COMMENT = "Zip file comment exceeds 64KB";
  3933. const ERR_INVALID_ENTRY_COMMENT = "File entry comment exceeds 64KB";
  3934. const ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB";
  3935. const ERR_INVALID_VERSION = "Version exceeds 65535";
  3936. const ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
  3937. const ERR_INVALID_EXTRAFIELD_TYPE = "Extra field type exceeds 65535";
  3938. const ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
  3939. const ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported (set the 'zip64' option to 'true')";
  3940. const ERR_UNDEFINED_UNCOMPRESSED_SIZE = "Undefined uncompressed size";
  3941. const ERR_ZIP_NOT_EMPTY = "Zip file not empty";
  3942. const ERR_INVALID_UID = "Invalid uid (must be integer 0..2^32-1)";
  3943. const ERR_INVALID_GID = "Invalid gid (must be integer 0..2^32-1)";
  3944. const ERR_INVALID_UNIX_MODE = "Invalid UNIX mode (must be integer 0..65535)";
  3945. const ERR_INVALID_UNIX_EXTRA_FIELD_TYPE = "Invalid unixExtraFieldType (must be 'infozip' or 'unix')";
  3946. const ERR_INVALID_MSDOS_ATTRIBUTES = "Invalid msdosAttributesRaw (must be integer 0..255)";
  3947. const ERR_INVALID_MSDOS_DATA = "Invalid msdosAttributes (must be an object with boolean flags)";
  3948. const EXTRAFIELD_DATA_AES = new Uint8Array([0x07, 0x00, 0x02, 0x00, 0x41, 0x45, 0x03, 0x00, 0x00]);
  3949. const INFOZIP_EXTRA_FIELD_TYPE = "infozip";
  3950. const UNIX_EXTRA_FIELD_TYPE = "unix";
  3951. let workers = 0;
  3952. const pendingEntries = [];
  3953. class ZipWriter {
  3954. constructor(writer, options = {}) {
  3955. writer = new GenericWriter(writer);
  3956. const addSplitZipSignature =
  3957. writer.availableSize !== UNDEFINED_VALUE && writer.availableSize > 0 && writer.availableSize !== INFINITY_VALUE &&
  3958. writer.maxSize !== UNDEFINED_VALUE && writer.maxSize > 0 && writer.maxSize !== INFINITY_VALUE;
  3959. Object.assign(this, {
  3960. writer,
  3961. addSplitZipSignature,
  3962. options,
  3963. config: getConfiguration(),
  3964. files: new Map(),
  3965. filenames: new Set(),
  3966. offset: options[OPTION_OFFSET] === UNDEFINED_VALUE ? writer.size || writer.writable.size || 0 : options[OPTION_OFFSET],
  3967. pendingEntriesSize: 0,
  3968. pendingAddFileCalls: new Set(),
  3969. bufferedWrites: 0
  3970. });
  3971. }
  3972. async prependZip(reader) {
  3973. if (this.filenames.size) {
  3974. throw new Error(ERR_ZIP_NOT_EMPTY);
  3975. }
  3976. reader = new GenericReader(reader);
  3977. const zipReader = new ZipReader(reader.readable);
  3978. const entries = await zipReader.getEntries();
  3979. await zipReader.close();
  3980. await reader.readable.pipeTo(this.writer.writable, { preventClose: true, preventAbort: true });
  3981. this.writer.size = this.offset = reader.size;
  3982. this.filenames = new Set(entries.map(entry => entry.filename));
  3983. this.files = new Map(entries.map(entry => {
  3984. const {
  3985. version,
  3986. compressionMethod,
  3987. lastModDate,
  3988. lastAccessDate,
  3989. creationDate,
  3990. rawFilename,
  3991. bitFlag,
  3992. encrypted,
  3993. uncompressedSize,
  3994. compressedSize,
  3995. diskOffset,
  3996. diskNumber,
  3997. zip64
  3998. } = entry;
  3999. let {
  4000. rawExtraFieldZip64,
  4001. rawExtraFieldAES,
  4002. rawExtraFieldExtendedTimestamp,
  4003. rawExtraFieldNTFS,
  4004. rawExtraFieldUnix,
  4005. rawExtraField,
  4006. } = entry;
  4007. const { level, languageEncodingFlag, dataDescriptor } = bitFlag;
  4008. rawExtraFieldZip64 = rawExtraFieldZip64 || new Uint8Array();
  4009. rawExtraFieldAES = rawExtraFieldAES || new Uint8Array();
  4010. rawExtraFieldExtendedTimestamp = rawExtraFieldExtendedTimestamp || new Uint8Array();
  4011. rawExtraFieldNTFS = rawExtraFieldNTFS || new Uint8Array();
  4012. rawExtraFieldUnix = entry.rawExtraFieldUnix || new Uint8Array();
  4013. rawExtraField = rawExtraField || new Uint8Array();
  4014. const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
  4015. const zip64UncompressedSize = zip64 && uncompressedSize > MAX_32_BITS;
  4016. const zip64CompressedSize = zip64 && compressedSize > MAX_32_BITS;
  4017. const {
  4018. headerArray,
  4019. headerView
  4020. } = getHeaderArrayData({
  4021. version,
  4022. bitFlag: getBitFlag(level, languageEncodingFlag, dataDescriptor, encrypted, compressionMethod),
  4023. compressionMethod,
  4024. uncompressedSize,
  4025. compressedSize,
  4026. lastModDate,
  4027. rawFilename,
  4028. zip64CompressedSize,
  4029. zip64UncompressedSize,
  4030. extraFieldLength
  4031. });
  4032. Object.assign(entry, {
  4033. zip64UncompressedSize,
  4034. zip64CompressedSize,
  4035. zip64Offset: zip64 && this.offset - diskOffset > MAX_32_BITS,
  4036. zip64DiskNumberStart: zip64 && diskNumber > MAX_16_BITS,
  4037. rawExtraFieldZip64,
  4038. rawExtraFieldAES,
  4039. rawExtraFieldExtendedTimestamp,
  4040. rawExtraFieldNTFS,
  4041. rawExtraFieldUnix,
  4042. rawExtraField,
  4043. extendedTimestamp: rawExtraFieldExtendedTimestamp.length > 0 || rawExtraFieldNTFS.length > 0,
  4044. extraFieldExtendedTimestampFlag: 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0),
  4045. headerArray,
  4046. headerView
  4047. });
  4048. return [entry.filename, entry];
  4049. }));
  4050. }
  4051. async add(name = "", reader, options = {}) {
  4052. const zipWriter = this;
  4053. const {
  4054. pendingAddFileCalls,
  4055. config
  4056. } = zipWriter;
  4057. if (workers < config.maxWorkers) {
  4058. workers++;
  4059. } else {
  4060. await new Promise(resolve => pendingEntries.push(resolve));
  4061. }
  4062. let promiseAddFile;
  4063. try {
  4064. name = name.trim();
  4065. if (zipWriter.filenames.has(name)) {
  4066. throw new Error(ERR_DUPLICATED_NAME);
  4067. }
  4068. zipWriter.filenames.add(name);
  4069. promiseAddFile = addFile(zipWriter, name, reader, options);
  4070. pendingAddFileCalls.add(promiseAddFile);
  4071. return await promiseAddFile;
  4072. } catch (error) {
  4073. zipWriter.filenames.delete(name);
  4074. throw error;
  4075. } finally {
  4076. pendingAddFileCalls.delete(promiseAddFile);
  4077. const pendingEntry = pendingEntries.shift();
  4078. if (pendingEntry) {
  4079. pendingEntry();
  4080. } else {
  4081. workers--;
  4082. }
  4083. }
  4084. }
  4085. remove(entry) {
  4086. const { filenames, files } = this;
  4087. if (typeof entry == "string") {
  4088. entry = files.get(entry);
  4089. }
  4090. if (entry && entry.filename !== UNDEFINED_VALUE) {
  4091. const { filename } = entry;
  4092. if (filenames.has(filename) && files.has(filename)) {
  4093. filenames.delete(filename);
  4094. files.delete(filename);
  4095. return true;
  4096. }
  4097. }
  4098. return false;
  4099. }
  4100. async close(comment = new Uint8Array(), options = {}) {
  4101. const zipWriter = this;
  4102. const { pendingAddFileCalls, writer } = this;
  4103. const { writable } = writer;
  4104. while (pendingAddFileCalls.size) {
  4105. await Promise.allSettled(Array.from(pendingAddFileCalls));
  4106. }
  4107. await closeFile(zipWriter, comment, options);
  4108. const preventClose = getOptionValue(zipWriter, options, OPTION_PREVENT_CLOSE);
  4109. if (!preventClose) {
  4110. await writable.getWriter().close();
  4111. }
  4112. return writer.getData ? writer.getData() : writable;
  4113. }
  4114. }
  4115. class ZipWriterStream {
  4116. constructor(options = {}) {
  4117. const { readable, writable } = new TransformStream();
  4118. this.readable = readable;
  4119. this.zipWriter = new ZipWriter(writable, options);
  4120. }
  4121. transform(path) {
  4122. const { readable, writable } = new TransformStream({
  4123. flush: () => { this.zipWriter.close(); }
  4124. });
  4125. this.zipWriter.add(path, readable);
  4126. return { readable: this.readable, writable };
  4127. }
  4128. writable(path) {
  4129. const { readable, writable } = new TransformStream();
  4130. this.zipWriter.add(path, readable);
  4131. return writable;
  4132. }
  4133. close(comment = UNDEFINED_VALUE, options = {}) {
  4134. return this.zipWriter.close(comment, options);
  4135. }
  4136. }
  4137. async function addFile(zipWriter, name, reader, options) {
  4138. name = name.trim();
  4139. let msDosCompatible = getOptionValue(zipWriter, options, PROPERTY_NAME_MS_DOS_COMPATIBLE);
  4140. let versionMadeBy = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION_MADE_BY, msDosCompatible ? 20 : 768);
  4141. const executable = getOptionValue(zipWriter, options, PROPERTY_NAME_EXECUTABLE);
  4142. const uid = getOptionValue(zipWriter, options, PROPERTY_NAME_UID);
  4143. const gid = getOptionValue(zipWriter, options, PROPERTY_NAME_GID);
  4144. let unixMode = getOptionValue(zipWriter, options, PROPERTY_NAME_UNIX_MODE);
  4145. const unixExtraFieldType = getOptionValue(zipWriter, options, OPTION_UNIX_EXTRA_FIELD_TYPE);
  4146. let setuid = getOptionValue(zipWriter, options, PROPERTY_NAME_SETUID);
  4147. let setgid = getOptionValue(zipWriter, options, PROPERTY_NAME_SETGID);
  4148. let sticky = getOptionValue(zipWriter, options, PROPERTY_NAME_STICKY);
  4149. if (uid !== UNDEFINED_VALUE && (uid < 0 || uid > MAX_32_BITS)) {
  4150. throw new Error(ERR_INVALID_UID);
  4151. }
  4152. if (gid !== UNDEFINED_VALUE && (gid < 0 || gid > MAX_32_BITS)) {
  4153. throw new Error(ERR_INVALID_GID);
  4154. }
  4155. if (unixMode !== UNDEFINED_VALUE && (unixMode < 0 || unixMode > MAX_16_BITS)) {
  4156. throw new Error(ERR_INVALID_UNIX_MODE);
  4157. }
  4158. if (unixExtraFieldType !== UNDEFINED_VALUE && unixExtraFieldType !== INFOZIP_EXTRA_FIELD_TYPE && unixExtraFieldType !== UNIX_EXTRA_FIELD_TYPE) {
  4159. throw new Error(ERR_INVALID_UNIX_EXTRA_FIELD_TYPE);
  4160. }
  4161. let msdosAttributesRaw = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES_RAW);
  4162. let msdosAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_MSDOS_ATTRIBUTES);
  4163. const hasUnixMetadata = uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE || unixMode !== UNDEFINED_VALUE || unixExtraFieldType;
  4164. const hasMsDosProvided = msdosAttributesRaw !== UNDEFINED_VALUE || msdosAttributes !== UNDEFINED_VALUE;
  4165. if (hasUnixMetadata) {
  4166. msDosCompatible = false;
  4167. versionMadeBy = (versionMadeBy & MAX_16_BITS) | (3 << 8);
  4168. } else if (hasMsDosProvided) {
  4169. msDosCompatible = true;
  4170. versionMadeBy = (versionMadeBy & MAX_8_BITS);
  4171. }
  4172. if (msdosAttributesRaw !== UNDEFINED_VALUE && (msdosAttributesRaw < 0 || msdosAttributesRaw > MAX_8_BITS)) {
  4173. throw new Error(ERR_INVALID_MSDOS_ATTRIBUTES);
  4174. }
  4175. if (msdosAttributes && typeof msdosAttributes !== OBJECT_TYPE) {
  4176. throw new Error(ERR_INVALID_MSDOS_DATA);
  4177. }
  4178. if (versionMadeBy > MAX_16_BITS) {
  4179. throw new Error(ERR_INVALID_VERSION);
  4180. }
  4181. let externalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_EXTERNAL_FILE_ATTRIBUTES, 0);
  4182. if (!options[PROPERTY_NAME_DIRECTORY] && name.endsWith(DIRECTORY_SIGNATURE)) {
  4183. options[PROPERTY_NAME_DIRECTORY] = true;
  4184. }
  4185. const directory = getOptionValue(zipWriter, options, PROPERTY_NAME_DIRECTORY);
  4186. if (directory) {
  4187. if (!name.endsWith(DIRECTORY_SIGNATURE)) {
  4188. name += DIRECTORY_SIGNATURE;
  4189. }
  4190. if (externalFileAttributes === 0) {
  4191. externalFileAttributes = FILE_ATTR_MSDOS_DIR_MASK;
  4192. if (!msDosCompatible) {
  4193. externalFileAttributes |= (FILE_ATTR_UNIX_TYPE_DIR | FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_DEFAULT_MASK) << 16;
  4194. }
  4195. }
  4196. } else if (!msDosCompatible && externalFileAttributes === 0) {
  4197. if (executable) {
  4198. externalFileAttributes = (FILE_ATTR_UNIX_EXECUTABLE_MASK | FILE_ATTR_UNIX_DEFAULT_MASK) << 16;
  4199. } else {
  4200. externalFileAttributes = FILE_ATTR_UNIX_DEFAULT_MASK << 16;
  4201. }
  4202. }
  4203. let unixExternalUpper;
  4204. if (!msDosCompatible) {
  4205. unixExternalUpper = (externalFileAttributes >> 16) & MAX_16_BITS;
  4206. unixMode = unixMode === UNDEFINED_VALUE ? unixExternalUpper : (unixMode & MAX_16_BITS);
  4207. if (setuid) {
  4208. unixMode |= FILE_ATTR_UNIX_SETUID_MASK;
  4209. } else {
  4210. setuid = Boolean(unixMode & FILE_ATTR_UNIX_SETUID_MASK);
  4211. }
  4212. if (setgid) {
  4213. unixMode |= FILE_ATTR_UNIX_SETGID_MASK;
  4214. } else {
  4215. setgid = Boolean(unixMode & FILE_ATTR_UNIX_SETGID_MASK);
  4216. }
  4217. if (sticky) {
  4218. unixMode |= FILE_ATTR_UNIX_STICKY_MASK;
  4219. } else {
  4220. sticky = Boolean(unixMode & FILE_ATTR_UNIX_STICKY_MASK);
  4221. }
  4222. if (directory) {
  4223. unixMode |= FILE_ATTR_UNIX_TYPE_DIR;
  4224. }
  4225. externalFileAttributes = ((unixMode & MAX_16_BITS) << 16) | (externalFileAttributes & MAX_8_BITS);
  4226. }
  4227. ({ msdosAttributesRaw, msdosAttributes } = normalizeMsdosAttributes(msdosAttributesRaw, msdosAttributes));
  4228. if (hasMsDosProvided) {
  4229. externalFileAttributes = (externalFileAttributes & MAX_32_BITS) | (msdosAttributesRaw & MAX_8_BITS);
  4230. }
  4231. const encode = getOptionValue(zipWriter, options, OPTION_ENCODE_TEXT, encodeText);
  4232. let rawFilename = encode(name);
  4233. if (rawFilename === UNDEFINED_VALUE) {
  4234. rawFilename = encodeText(name);
  4235. }
  4236. if (getLength(rawFilename) > MAX_16_BITS) {
  4237. throw new Error(ERR_INVALID_ENTRY_NAME);
  4238. }
  4239. const comment = options[PROPERTY_NAME_COMMENT] || "";
  4240. let rawComment = encode(comment);
  4241. if (rawComment === UNDEFINED_VALUE) {
  4242. rawComment = encodeText(comment);
  4243. }
  4244. if (getLength(rawComment) > MAX_16_BITS) {
  4245. throw new Error(ERR_INVALID_ENTRY_COMMENT);
  4246. }
  4247. const version = getOptionValue(zipWriter, options, PROPERTY_NAME_VERSION, VERSION_DEFLATE);
  4248. if (version > MAX_16_BITS) {
  4249. throw new Error(ERR_INVALID_VERSION);
  4250. }
  4251. const lastModDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_MODIFICATION_DATE, new Date());
  4252. const lastAccessDate = getOptionValue(zipWriter, options, PROPERTY_NAME_LAST_ACCESS_DATE);
  4253. const creationDate = getOptionValue(zipWriter, options, PROPERTY_NAME_CREATION_DATE);
  4254. const internalFileAttributes = getOptionValue(zipWriter, options, PROPERTY_NAME_INTERNAL_FILE_ATTRIBUTES, 0);
  4255. const passThrough = getOptionValue(zipWriter, options, OPTION_PASS_THROUGH);
  4256. let password, rawPassword;
  4257. if (!passThrough) {
  4258. password = getOptionValue(zipWriter, options, OPTION_PASSWORD);
  4259. rawPassword = getOptionValue(zipWriter, options, OPTION_RAW_PASSWORD);
  4260. }
  4261. const encryptionStrength = getOptionValue(zipWriter, options, OPTION_ENCRYPTION_STRENGTH, 3);
  4262. const zipCrypto = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIPCRYPTO);
  4263. const extendedTimestamp = getOptionValue(zipWriter, options, OPTION_EXTENDED_TIMESTAMP, true);
  4264. const keepOrder = getOptionValue(zipWriter, options, OPTION_KEEP_ORDER, true);
  4265. const useWebWorkers = getOptionValue(zipWriter, options, OPTION_USE_WEB_WORKERS);
  4266. const transferStreams = getOptionValue(zipWriter, options, OPTION_TRANSFER_STREAMS, true);
  4267. const bufferedWrite = getOptionValue(zipWriter, options, OPTION_BUFFERED_WRITE);
  4268. const createTempStream = getOptionValue(zipWriter, options, OPTION_CREATE_TEMP_STREAM);
  4269. const dataDescriptorSignature = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR_SIGNATURE, false);
  4270. const signal = getOptionValue(zipWriter, options, OPTION_SIGNAL);
  4271. const useUnicodeFileNames = getOptionValue(zipWriter, options, OPTION_USE_UNICODE_FILE_NAMES, true);
  4272. const compressionMethod = getOptionValue(zipWriter, options, PROPERTY_NAME_COMPRESSION_METHOD);
  4273. let level = getOptionValue(zipWriter, options, OPTION_LEVEL);
  4274. let useCompressionStream = getOptionValue(zipWriter, options, OPTION_USE_COMPRESSION_STREAM);
  4275. let dataDescriptor = getOptionValue(zipWriter, options, OPTION_DATA_DESCRIPTOR);
  4276. if (bufferedWrite && dataDescriptor === UNDEFINED_VALUE) {
  4277. dataDescriptor = false;
  4278. }
  4279. if (dataDescriptor === UNDEFINED_VALUE || zipCrypto) {
  4280. dataDescriptor = true;
  4281. }
  4282. if (level !== UNDEFINED_VALUE && level != 6) {
  4283. useCompressionStream = false;
  4284. }
  4285. if (!useCompressionStream && (zipWriter.config.CompressionStream === UNDEFINED_VALUE && zipWriter.config.CompressionStreamZlib === UNDEFINED_VALUE)) {
  4286. level = 0;
  4287. }
  4288. let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
  4289. if (!zipCrypto && (password !== UNDEFINED_VALUE || rawPassword !== UNDEFINED_VALUE) && !(encryptionStrength >= 1 && encryptionStrength <= 3)) {
  4290. throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
  4291. }
  4292. let rawExtraField = new Uint8Array();
  4293. const extraField = options[PROPERTY_NAME_EXTRA_FIELD];
  4294. if (extraField) {
  4295. let extraFieldSize = 0;
  4296. let offset = 0;
  4297. extraField.forEach(data => extraFieldSize += 4 + getLength(data));
  4298. rawExtraField = new Uint8Array(extraFieldSize);
  4299. extraField.forEach((data, type) => {
  4300. if (type > MAX_16_BITS) {
  4301. throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);
  4302. }
  4303. if (getLength(data) > MAX_16_BITS) {
  4304. throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
  4305. }
  4306. arraySet(rawExtraField, new Uint16Array([type]), offset);
  4307. arraySet(rawExtraField, new Uint16Array([getLength(data)]), offset + 2);
  4308. arraySet(rawExtraField, data, offset + 4);
  4309. offset += 4 + getLength(data);
  4310. });
  4311. }
  4312. let maximumCompressedSize = 0;
  4313. let maximumEntrySize = 0;
  4314. let uncompressedSize = 0;
  4315. if (passThrough) {
  4316. uncompressedSize = options[PROPERTY_NAME_UNCOMPRESSED_SIZE];
  4317. if (uncompressedSize === UNDEFINED_VALUE) {
  4318. throw new Error(ERR_UNDEFINED_UNCOMPRESSED_SIZE);
  4319. }
  4320. }
  4321. const zip64Enabled = zip64 === true;
  4322. if (reader) {
  4323. reader = new GenericReader(reader);
  4324. await initStream(reader);
  4325. if (!passThrough) {
  4326. if (reader.size === UNDEFINED_VALUE) {
  4327. dataDescriptor = true;
  4328. if (zip64 || zip64 === UNDEFINED_VALUE) {
  4329. zip64 = true;
  4330. uncompressedSize = maximumCompressedSize = MAX_32_BITS + 1;
  4331. }
  4332. } else {
  4333. options.uncompressedSize = uncompressedSize = reader.size;
  4334. maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
  4335. }
  4336. } else {
  4337. options.uncompressedSize = uncompressedSize;
  4338. maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
  4339. }
  4340. }
  4341. const { diskOffset, diskNumber } = zipWriter.writer;
  4342. const zip64UncompressedSize = zip64Enabled || uncompressedSize > MAX_32_BITS;
  4343. const zip64CompressedSize = zip64Enabled || maximumCompressedSize > MAX_32_BITS;
  4344. if (zip64UncompressedSize || zip64CompressedSize) {
  4345. if (zip64 === false) {
  4346. throw new Error(ERR_UNSUPPORTED_FORMAT);
  4347. } else {
  4348. zip64 = true;
  4349. }
  4350. }
  4351. zip64 = zip64 || false;
  4352. const encrypted = getOptionValue(zipWriter, options, PROPERTY_NAME_ENCRYPTED);
  4353. options = Object.assign({}, options, {
  4354. rawFilename,
  4355. rawComment,
  4356. version,
  4357. versionMadeBy,
  4358. lastModDate,
  4359. lastAccessDate,
  4360. creationDate,
  4361. rawExtraField,
  4362. zip64,
  4363. zip64UncompressedSize,
  4364. zip64CompressedSize,
  4365. password,
  4366. rawPassword,
  4367. level,
  4368. useWebWorkers,
  4369. transferStreams,
  4370. encryptionStrength,
  4371. extendedTimestamp,
  4372. zipCrypto,
  4373. bufferedWrite,
  4374. createTempStream,
  4375. keepOrder,
  4376. useUnicodeFileNames,
  4377. dataDescriptor,
  4378. dataDescriptorSignature,
  4379. signal,
  4380. msDosCompatible,
  4381. internalFileAttribute: internalFileAttributes,
  4382. internalFileAttributes,
  4383. externalFileAttribute: externalFileAttributes,
  4384. externalFileAttributes,
  4385. useCompressionStream,
  4386. passThrough,
  4387. encrypted: Boolean((password && getLength(password)) || (rawPassword && getLength(rawPassword))) || (passThrough && encrypted),
  4388. signature: options[PROPERTY_NAME_SIGNATURE],
  4389. compressionMethod,
  4390. uncompressedSize,
  4391. offset: zipWriter.offset - diskOffset,
  4392. diskNumberStart: diskNumber,
  4393. uid,
  4394. gid,
  4395. setuid,
  4396. setgid,
  4397. sticky,
  4398. unixMode,
  4399. msdosAttributesRaw,
  4400. msdosAttributes,
  4401. unixExternalUpper
  4402. });
  4403. const headerInfo = getHeaderInfo(options);
  4404. const dataDescriptorInfo = getDataDescriptorInfo(options);
  4405. const metadataSize = getLength(headerInfo.localHeaderArray, dataDescriptorInfo.dataDescriptorArray);
  4406. maximumEntrySize = metadataSize + maximumCompressedSize;
  4407. if (zipWriter.options[OPTION_USDZ]) {
  4408. maximumEntrySize += maximumEntrySize + 64;
  4409. }
  4410. zipWriter.pendingEntriesSize += maximumEntrySize;
  4411. let fileEntry;
  4412. try {
  4413. fileEntry = await getFileEntry(zipWriter, name, reader, { headerInfo, dataDescriptorInfo, metadataSize }, options);
  4414. } finally {
  4415. zipWriter.pendingEntriesSize -= maximumEntrySize;
  4416. }
  4417. Object.assign(fileEntry, { name, comment, extraField });
  4418. return new Entry(fileEntry);
  4419. }
  4420. async function getFileEntry(zipWriter, name, reader, entryInfo, options) {
  4421. const {
  4422. files,
  4423. writer
  4424. } = zipWriter;
  4425. const {
  4426. keepOrder,
  4427. dataDescriptor,
  4428. signal
  4429. } = options;
  4430. const {
  4431. headerInfo
  4432. } = entryInfo;
  4433. const usdz = zipWriter.options[OPTION_USDZ];
  4434. const previousFileEntry = Array.from(files.values()).pop();
  4435. let fileEntry = {};
  4436. let bufferedWrite;
  4437. let releaseLockWriter;
  4438. let releaseLockCurrentFileEntry;
  4439. let writingBufferedEntryData;
  4440. let writingEntryData;
  4441. let fileWriter;
  4442. files.set(name, fileEntry);
  4443. try {
  4444. let lockPreviousFileEntry;
  4445. if (keepOrder) {
  4446. lockPreviousFileEntry = previousFileEntry && previousFileEntry.lock;
  4447. requestLockCurrentFileEntry();
  4448. }
  4449. if ((options.bufferedWrite || !keepOrder || zipWriter.writerLocked || zipWriter.bufferedWrites || !dataDescriptor) && !usdz) {
  4450. if (options.createTempStream) {
  4451. fileWriter = await options.createTempStream();
  4452. } else {
  4453. fileWriter = new TransformStream(UNDEFINED_VALUE, UNDEFINED_VALUE, { highWaterMark: INFINITY_VALUE });
  4454. }
  4455. fileWriter.size = 0;
  4456. bufferedWrite = true;
  4457. zipWriter.bufferedWrites++;
  4458. await initStream(writer);
  4459. } else {
  4460. fileWriter = writer;
  4461. await requestLockWriter();
  4462. }
  4463. await initStream(fileWriter);
  4464. const { writable, diskOffset } = writer;
  4465. if (zipWriter.addSplitZipSignature) {
  4466. delete zipWriter.addSplitZipSignature;
  4467. const signatureArray = new Uint8Array(4);
  4468. const signatureArrayView = getDataView(signatureArray);
  4469. setUint32(signatureArrayView, 0, SPLIT_ZIP_FILE_SIGNATURE);
  4470. await writeData(writer, signatureArray);
  4471. zipWriter.offset += 4;
  4472. }
  4473. if (usdz) {
  4474. appendExtraFieldUSDZ(entryInfo, zipWriter.offset - diskOffset);
  4475. }
  4476. const {
  4477. localHeaderView,
  4478. localHeaderArray
  4479. } = headerInfo;
  4480. if (!bufferedWrite) {
  4481. await lockPreviousFileEntry;
  4482. await skipDiskIfNeeded(writable);
  4483. }
  4484. const { diskNumber } = writer;
  4485. fileEntry.diskNumberStart = diskNumber;
  4486. if (!bufferedWrite) {
  4487. writingEntryData = true;
  4488. await writeData(fileWriter, localHeaderArray);
  4489. }
  4490. fileEntry = await createFileEntry(reader, fileWriter, fileEntry, entryInfo, zipWriter.config, options);
  4491. if (!bufferedWrite) {
  4492. writingEntryData = false;
  4493. }
  4494. files.set(name, fileEntry);
  4495. fileEntry.filename = name;
  4496. if (bufferedWrite) {
  4497. await Promise.all([fileWriter.writable.getWriter().close(), lockPreviousFileEntry]);
  4498. await requestLockWriter();
  4499. writingBufferedEntryData = true;
  4500. fileEntry.diskNumberStart = writer.diskNumber;
  4501. fileEntry.offset = zipWriter.offset - writer.diskOffset;
  4502. updateLocalHeader(fileEntry, localHeaderView, options);
  4503. await skipDiskIfNeeded(writable);
  4504. await writeData(writer, localHeaderArray);
  4505. await fileWriter.readable.pipeTo(writable, { preventClose: true, preventAbort: true, signal });
  4506. writer.size += fileWriter.size;
  4507. writingBufferedEntryData = false;
  4508. } else {
  4509. fileEntry.offset = zipWriter.offset - diskOffset;
  4510. }
  4511. zipWriter.offset += fileEntry.size;
  4512. return fileEntry;
  4513. } catch (error) {
  4514. if (writingBufferedEntryData || writingEntryData) {
  4515. zipWriter.hasCorruptedEntries = true;
  4516. if (error) {
  4517. try {
  4518. error.corruptedEntry = true;
  4519. } catch {
  4520. // ignored
  4521. }
  4522. }
  4523. if (bufferedWrite) {
  4524. zipWriter.offset += fileWriter.size;
  4525. } else {
  4526. zipWriter.offset = fileWriter.size;
  4527. }
  4528. }
  4529. files.delete(name);
  4530. throw error;
  4531. } finally {
  4532. if (bufferedWrite) {
  4533. zipWriter.bufferedWrites--;
  4534. }
  4535. if (releaseLockCurrentFileEntry) {
  4536. releaseLockCurrentFileEntry();
  4537. }
  4538. if (releaseLockWriter) {
  4539. releaseLockWriter();
  4540. }
  4541. }
  4542. function requestLockCurrentFileEntry() {
  4543. fileEntry.lock = new Promise(resolve => releaseLockCurrentFileEntry = resolve);
  4544. }
  4545. async function requestLockWriter() {
  4546. zipWriter.writerLocked = true;
  4547. const { lockWriter } = zipWriter;
  4548. zipWriter.lockWriter = new Promise(resolve => releaseLockWriter = () => {
  4549. zipWriter.writerLocked = false;
  4550. resolve();
  4551. });
  4552. await lockWriter;
  4553. }
  4554. async function skipDiskIfNeeded(writable) {
  4555. if (getLength(headerInfo.localHeaderArray) > writer.availableSize) {
  4556. writer.availableSize = 0;
  4557. await writeData(writable, new Uint8Array());
  4558. }
  4559. }
  4560. }
  4561. async function createFileEntry(reader, writer, { diskNumberStart, lock }, entryInfo, config, options) {
  4562. const {
  4563. headerInfo,
  4564. dataDescriptorInfo,
  4565. metadataSize
  4566. } = entryInfo;
  4567. const {
  4568. headerArray,
  4569. headerView,
  4570. lastModDate,
  4571. rawLastModDate,
  4572. encrypted,
  4573. compressed,
  4574. version,
  4575. compressionMethod,
  4576. rawExtraFieldZip64,
  4577. localExtraFieldZip64Length,
  4578. rawExtraFieldExtendedTimestamp,
  4579. extraFieldExtendedTimestampFlag,
  4580. rawExtraFieldNTFS,
  4581. rawExtraFieldUnix,
  4582. rawExtraFieldAES,
  4583. } = headerInfo;
  4584. const { dataDescriptorArray } = dataDescriptorInfo;
  4585. const {
  4586. rawFilename,
  4587. lastAccessDate,
  4588. creationDate,
  4589. password,
  4590. rawPassword,
  4591. level,
  4592. zip64,
  4593. zip64UncompressedSize,
  4594. zip64CompressedSize,
  4595. zipCrypto,
  4596. dataDescriptor,
  4597. directory,
  4598. executable,
  4599. versionMadeBy,
  4600. rawComment,
  4601. rawExtraField,
  4602. useWebWorkers,
  4603. transferStreams,
  4604. onstart,
  4605. onprogress,
  4606. onend,
  4607. signal,
  4608. encryptionStrength,
  4609. extendedTimestamp,
  4610. msDosCompatible,
  4611. internalFileAttributes,
  4612. externalFileAttributes,
  4613. uid,
  4614. gid,
  4615. unixMode,
  4616. setuid,
  4617. setgid,
  4618. sticky,
  4619. unixExternalUpper,
  4620. msdosAttributesRaw,
  4621. msdosAttributes,
  4622. useCompressionStream,
  4623. passThrough
  4624. } = options;
  4625. const fileEntry = {
  4626. lock,
  4627. versionMadeBy,
  4628. zip64,
  4629. directory: Boolean(directory),
  4630. executable: Boolean(executable),
  4631. filenameUTF8: true,
  4632. rawFilename,
  4633. commentUTF8: true,
  4634. rawComment,
  4635. rawExtraFieldZip64,
  4636. localExtraFieldZip64Length,
  4637. rawExtraFieldExtendedTimestamp,
  4638. rawExtraFieldNTFS,
  4639. rawExtraFieldUnix,
  4640. rawExtraFieldAES,
  4641. rawExtraField,
  4642. extendedTimestamp,
  4643. msDosCompatible,
  4644. internalFileAttributes,
  4645. externalFileAttributes,
  4646. diskNumberStart,
  4647. uid,
  4648. gid,
  4649. unixMode,
  4650. setuid,
  4651. setgid,
  4652. sticky,
  4653. unixExternalUpper,
  4654. msdosAttributesRaw,
  4655. msdosAttributes
  4656. };
  4657. let {
  4658. signature,
  4659. uncompressedSize
  4660. } = options;
  4661. let compressedSize = 0;
  4662. if (!passThrough) {
  4663. uncompressedSize = 0;
  4664. }
  4665. const { writable } = writer;
  4666. if (reader) {
  4667. reader.chunkSize = getChunkSize(config);
  4668. const readable = reader.readable;
  4669. const size = reader.size;
  4670. const workerOptions = {
  4671. options: {
  4672. codecType: CODEC_DEFLATE,
  4673. level,
  4674. rawPassword,
  4675. password,
  4676. encryptionStrength,
  4677. zipCrypto: encrypted && zipCrypto,
  4678. passwordVerification: encrypted && zipCrypto && (rawLastModDate >> 8) & MAX_8_BITS,
  4679. signed: !passThrough,
  4680. compressed: compressed && !passThrough,
  4681. encrypted: encrypted && !passThrough,
  4682. useWebWorkers,
  4683. useCompressionStream,
  4684. transferStreams
  4685. },
  4686. config,
  4687. streamOptions: { signal, size, onstart, onprogress, onend }
  4688. };
  4689. try {
  4690. const result = await runWorker({ readable, writable }, workerOptions);
  4691. compressedSize = result.outputSize;
  4692. writer.size += compressedSize;
  4693. if (!passThrough) {
  4694. uncompressedSize = result.inputSize;
  4695. signature = result.signature;
  4696. }
  4697. } catch (error) {
  4698. if (error.outputSize !== UNDEFINED_VALUE) {
  4699. writer.size += error.outputSize;
  4700. }
  4701. throw error;
  4702. }
  4703. }
  4704. setEntryInfo({
  4705. signature,
  4706. compressedSize,
  4707. uncompressedSize,
  4708. headerInfo,
  4709. dataDescriptorInfo
  4710. }, options);
  4711. if (dataDescriptor) {
  4712. await writeData(writer, dataDescriptorArray);
  4713. }
  4714. Object.assign(fileEntry, {
  4715. uncompressedSize,
  4716. compressedSize,
  4717. lastModDate,
  4718. rawLastModDate,
  4719. creationDate,
  4720. lastAccessDate,
  4721. encrypted,
  4722. zipCrypto,
  4723. size: metadataSize + compressedSize,
  4724. compressionMethod,
  4725. version,
  4726. headerArray,
  4727. headerView,
  4728. signature,
  4729. extraFieldExtendedTimestampFlag,
  4730. zip64UncompressedSize,
  4731. zip64CompressedSize
  4732. });
  4733. return fileEntry;
  4734. }
  4735. function getHeaderInfo(options) {
  4736. const {
  4737. rawFilename,
  4738. lastModDate,
  4739. lastAccessDate,
  4740. creationDate,
  4741. level,
  4742. zip64,
  4743. zipCrypto,
  4744. useUnicodeFileNames,
  4745. dataDescriptor,
  4746. directory,
  4747. rawExtraField,
  4748. encryptionStrength,
  4749. extendedTimestamp,
  4750. passThrough,
  4751. encrypted,
  4752. zip64UncompressedSize,
  4753. zip64CompressedSize,
  4754. uncompressedSize
  4755. } = options;
  4756. let { version, compressionMethod } = options;
  4757. const compressed = !directory && (level > 0 || (level === UNDEFINED_VALUE && compressionMethod !== 0));
  4758. let rawLocalExtraFieldZip64;
  4759. const uncompressedFile = passThrough || !compressed;
  4760. const zip64ExtraFieldComplete = zip64 && (options.bufferedWrite || ((!zip64UncompressedSize && !zip64CompressedSize) || uncompressedFile));
  4761. if (zip64) {
  4762. let rawLocalExtraFieldZip64Length = 4;
  4763. if (zip64UncompressedSize) {
  4764. rawLocalExtraFieldZip64Length += 8;
  4765. }
  4766. if (zip64CompressedSize) {
  4767. rawLocalExtraFieldZip64Length += 8;
  4768. }
  4769. rawLocalExtraFieldZip64 = new Uint8Array(rawLocalExtraFieldZip64Length);
  4770. const rawLocalExtraFieldZip64View = getDataView(rawLocalExtraFieldZip64);
  4771. setUint16(rawLocalExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);
  4772. setUint16(rawLocalExtraFieldZip64View, 2, getLength(rawLocalExtraFieldZip64) - 4);
  4773. if (zip64ExtraFieldComplete) {
  4774. const rawLocalExtraFieldZip64View = getDataView(rawLocalExtraFieldZip64);
  4775. let rawLocalExtraFieldZip64Offset = 4;
  4776. if (zip64UncompressedSize) {
  4777. setBigUint64(rawLocalExtraFieldZip64View, rawLocalExtraFieldZip64Offset, BigInt(uncompressedSize));
  4778. rawLocalExtraFieldZip64Offset += 8;
  4779. }
  4780. if (zip64CompressedSize && uncompressedFile) {
  4781. setBigUint64(rawLocalExtraFieldZip64View, rawLocalExtraFieldZip64Offset, BigInt(uncompressedSize));
  4782. rawLocalExtraFieldZip64Offset += 8;
  4783. }
  4784. if (rawLocalExtraFieldZip64Offset == 4) {
  4785. rawLocalExtraFieldZip64 = new Uint8Array();
  4786. }
  4787. }
  4788. } else {
  4789. rawLocalExtraFieldZip64 = new Uint8Array();
  4790. }
  4791. let rawExtraFieldAES;
  4792. if (encrypted && !zipCrypto) {
  4793. rawExtraFieldAES = new Uint8Array(getLength(EXTRAFIELD_DATA_AES) + 2);
  4794. const extraFieldAESView = getDataView(rawExtraFieldAES);
  4795. setUint16(extraFieldAESView, 0, EXTRAFIELD_TYPE_AES);
  4796. arraySet(rawExtraFieldAES, EXTRAFIELD_DATA_AES, 2);
  4797. setUint8(extraFieldAESView, 8, encryptionStrength);
  4798. } else {
  4799. rawExtraFieldAES = new Uint8Array();
  4800. }
  4801. let rawExtraFieldNTFS;
  4802. let rawExtraFieldExtendedTimestamp;
  4803. let extraFieldExtendedTimestampFlag;
  4804. if (extendedTimestamp) {
  4805. rawExtraFieldExtendedTimestamp = new Uint8Array(9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0));
  4806. const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
  4807. setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
  4808. setUint16(extraFieldExtendedTimestampView, 2, getLength(rawExtraFieldExtendedTimestamp) - 4);
  4809. extraFieldExtendedTimestampFlag = 0x1 + (lastAccessDate ? 0x2 : 0) + (creationDate ? 0x4 : 0);
  4810. setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
  4811. let offset = 5;
  4812. setUint32(extraFieldExtendedTimestampView, offset, Math.floor(lastModDate.getTime() / 1000));
  4813. offset += 4;
  4814. if (lastAccessDate) {
  4815. setUint32(extraFieldExtendedTimestampView, offset, Math.floor(lastAccessDate.getTime() / 1000));
  4816. offset += 4;
  4817. }
  4818. if (creationDate) {
  4819. setUint32(extraFieldExtendedTimestampView, offset, Math.floor(creationDate.getTime() / 1000));
  4820. }
  4821. try {
  4822. rawExtraFieldNTFS = new Uint8Array(36);
  4823. const extraFieldNTFSView = getDataView(rawExtraFieldNTFS);
  4824. const lastModTimeNTFS = getTimeNTFS(lastModDate);
  4825. setUint16(extraFieldNTFSView, 0, EXTRAFIELD_TYPE_NTFS);
  4826. setUint16(extraFieldNTFSView, 2, 32);
  4827. setUint16(extraFieldNTFSView, 8, EXTRAFIELD_TYPE_NTFS_TAG1);
  4828. setUint16(extraFieldNTFSView, 10, 24);
  4829. setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
  4830. setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
  4831. setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
  4832. } catch {
  4833. rawExtraFieldNTFS = new Uint8Array();
  4834. }
  4835. } else {
  4836. rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array();
  4837. }
  4838. let rawExtraFieldUnix;
  4839. try {
  4840. const { uid, gid, unixMode, setuid, setgid, sticky, unixExtraFieldType } = options;
  4841. if (unixExtraFieldType && (uid !== UNDEFINED_VALUE || gid !== UNDEFINED_VALUE || unixMode !== UNDEFINED_VALUE)) {
  4842. const uidBytes = packUnixId(uid);
  4843. const gidBytes = packUnixId(gid);
  4844. let modeArray = new Uint8Array();
  4845. if (unixExtraFieldType == UNIX_EXTRA_FIELD_TYPE && unixMode !== UNDEFINED_VALUE) {
  4846. let modeToWrite = unixMode & MAX_16_BITS;
  4847. if (setuid) {
  4848. modeToWrite |= FILE_ATTR_UNIX_SETUID_MASK;
  4849. }
  4850. if (setgid) {
  4851. modeToWrite |= FILE_ATTR_UNIX_SETGID_MASK;
  4852. }
  4853. if (sticky) {
  4854. modeToWrite |= FILE_ATTR_UNIX_STICKY_MASK;
  4855. }
  4856. modeArray = new Uint8Array(2);
  4857. const modeDataView = new DataView(modeArray.buffer);
  4858. modeDataView.setUint16(0, modeToWrite, true);
  4859. }
  4860. const payloadLength = 3 + uidBytes.length + gidBytes.length + modeArray.length;
  4861. rawExtraFieldUnix = new Uint8Array(4 + payloadLength);
  4862. const rawExtraFieldUnixView = getDataView(rawExtraFieldUnix);
  4863. setUint16(rawExtraFieldUnixView, 0, unixExtraFieldType == INFOZIP_EXTRA_FIELD_TYPE ? EXTRAFIELD_TYPE_INFOZIP : EXTRAFIELD_TYPE_UNIX);
  4864. setUint16(rawExtraFieldUnixView, 2, payloadLength);
  4865. setUint8(rawExtraFieldUnixView, 4, 1);
  4866. setUint8(rawExtraFieldUnixView, 5, uidBytes.length);
  4867. let offset = 6;
  4868. arraySet(rawExtraFieldUnix, uidBytes, offset);
  4869. offset += uidBytes.length;
  4870. setUint8(rawExtraFieldUnixView, offset, gidBytes.length);
  4871. offset++;
  4872. arraySet(rawExtraFieldUnix, gidBytes, offset);
  4873. offset += gidBytes.length;
  4874. arraySet(rawExtraFieldUnix, modeArray, offset);
  4875. } else {
  4876. rawExtraFieldUnix = new Uint8Array();
  4877. }
  4878. } catch {
  4879. rawExtraFieldUnix = new Uint8Array();
  4880. }
  4881. if (compressionMethod === UNDEFINED_VALUE) {
  4882. compressionMethod = compressed ? COMPRESSION_METHOD_DEFLATE : COMPRESSION_METHOD_STORE;
  4883. }
  4884. if (zip64) {
  4885. version = version > VERSION_ZIP64 ? version : VERSION_ZIP64;
  4886. }
  4887. if (encrypted && !zipCrypto) {
  4888. version = version > VERSION_AES ? version : VERSION_AES;
  4889. rawExtraFieldAES[9] = compressionMethod;
  4890. compressionMethod = COMPRESSION_METHOD_AES;
  4891. }
  4892. const localExtraFieldZip64Length = zip64ExtraFieldComplete ? getLength(rawLocalExtraFieldZip64) : 0;
  4893. const extraFieldLength = localExtraFieldZip64Length + getLength(rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
  4894. const {
  4895. headerArray,
  4896. headerView,
  4897. rawLastModDate
  4898. } = getHeaderArrayData({
  4899. version,
  4900. bitFlag: getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod),
  4901. compressionMethod,
  4902. uncompressedSize,
  4903. lastModDate: lastModDate < MIN_DATE ? MIN_DATE : lastModDate > MAX_DATE ? MAX_DATE : lastModDate,
  4904. rawFilename,
  4905. zip64CompressedSize,
  4906. zip64UncompressedSize,
  4907. extraFieldLength
  4908. });
  4909. let localHeaderOffset = HEADER_SIZE;
  4910. const localHeaderArray = new Uint8Array(localHeaderOffset + getLength(rawFilename) + extraFieldLength);
  4911. const localHeaderView = getDataView(localHeaderArray);
  4912. setUint32(localHeaderView, 0, LOCAL_FILE_HEADER_SIGNATURE);
  4913. arraySet(localHeaderArray, headerArray, 4);
  4914. arraySet(localHeaderArray, rawFilename, localHeaderOffset);
  4915. localHeaderOffset += getLength(rawFilename);
  4916. if (zip64ExtraFieldComplete) {
  4917. arraySet(localHeaderArray, rawLocalExtraFieldZip64, localHeaderOffset);
  4918. }
  4919. localHeaderOffset += localExtraFieldZip64Length;
  4920. arraySet(localHeaderArray, rawExtraFieldAES, localHeaderOffset);
  4921. localHeaderOffset += getLength(rawExtraFieldAES);
  4922. arraySet(localHeaderArray, rawExtraFieldExtendedTimestamp, localHeaderOffset);
  4923. localHeaderOffset += getLength(rawExtraFieldExtendedTimestamp);
  4924. arraySet(localHeaderArray, rawExtraFieldNTFS, localHeaderOffset);
  4925. localHeaderOffset += getLength(rawExtraFieldNTFS);
  4926. arraySet(localHeaderArray, rawExtraFieldUnix, localHeaderOffset);
  4927. localHeaderOffset += getLength(rawExtraFieldUnix);
  4928. arraySet(localHeaderArray, rawExtraField, localHeaderOffset);
  4929. if (dataDescriptor) {
  4930. setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + 4, 0);
  4931. setUint32(localHeaderView, HEADER_OFFSET_UNCOMPRESSED_SIZE + 4, 0);
  4932. }
  4933. return {
  4934. localHeaderArray,
  4935. localHeaderView,
  4936. headerArray,
  4937. headerView,
  4938. lastModDate,
  4939. rawLastModDate,
  4940. encrypted,
  4941. compressed,
  4942. version,
  4943. compressionMethod,
  4944. extraFieldExtendedTimestampFlag,
  4945. rawExtraFieldZip64: new Uint8Array(),
  4946. localExtraFieldZip64Length,
  4947. rawExtraFieldExtendedTimestamp,
  4948. rawExtraFieldNTFS,
  4949. rawExtraFieldUnix,
  4950. rawExtraFieldAES,
  4951. extraFieldLength
  4952. };
  4953. }
  4954. function appendExtraFieldUSDZ(entryInfo, zipWriterOffset) {
  4955. const { headerInfo } = entryInfo;
  4956. let { localHeaderArray, extraFieldLength } = headerInfo;
  4957. let localHeaderArrayView = getDataView(localHeaderArray);
  4958. let extraBytesLength = 64 - ((zipWriterOffset + getLength(localHeaderArray)) % 64);
  4959. if (extraBytesLength < 4) {
  4960. extraBytesLength += 64;
  4961. }
  4962. const rawExtraFieldUSDZ = new Uint8Array(extraBytesLength);
  4963. const extraFieldUSDZView = getDataView(rawExtraFieldUSDZ);
  4964. setUint16(extraFieldUSDZView, 0, EXTRAFIELD_TYPE_USDZ);
  4965. setUint16(extraFieldUSDZView, 2, extraBytesLength - 2);
  4966. const previousLocalHeaderArray = localHeaderArray;
  4967. headerInfo.localHeaderArray = localHeaderArray = new Uint8Array(getLength(previousLocalHeaderArray) + extraBytesLength);
  4968. arraySet(localHeaderArray, previousLocalHeaderArray);
  4969. arraySet(localHeaderArray, rawExtraFieldUSDZ, getLength(previousLocalHeaderArray));
  4970. localHeaderArrayView = getDataView(localHeaderArray);
  4971. setUint16(localHeaderArrayView, 28, extraFieldLength + extraBytesLength);
  4972. entryInfo.metadataSize += extraBytesLength;
  4973. }
  4974. function packUnixId(id) {
  4975. if (id === UNDEFINED_VALUE) {
  4976. return new Uint8Array();
  4977. } else {
  4978. const dataArray = new Uint8Array(4);
  4979. const dataView = getDataView(dataArray);
  4980. dataView.setUint32(0, id, true);
  4981. let length = 4;
  4982. while (length > 1 && dataArray[length - 1] === 0) {
  4983. length--;
  4984. }
  4985. return dataArray.subarray(0, length);
  4986. }
  4987. }
  4988. function normalizeMsdosAttributes(msdosAttributesRaw, msdosAttributes) {
  4989. if (msdosAttributesRaw !== UNDEFINED_VALUE) {
  4990. msdosAttributesRaw = msdosAttributesRaw & MAX_8_BITS;
  4991. } else if (msdosAttributes !== UNDEFINED_VALUE) {
  4992. const { readOnly, hidden, system, directory: msdDir, archive } = msdosAttributes;
  4993. let raw = 0;
  4994. if (readOnly) raw |= FILE_ATTR_MSDOS_READONLY_MASK;
  4995. if (hidden) raw |= FILE_ATTR_MSDOS_HIDDEN_MASK;
  4996. if (system) raw |= FILE_ATTR_MSDOS_SYSTEM_MASK;
  4997. if (msdDir) raw |= FILE_ATTR_MSDOS_DIR_MASK;
  4998. if (archive) raw |= FILE_ATTR_MSDOS_ARCHIVE_MASK;
  4999. msdosAttributesRaw = raw & MAX_8_BITS;
  5000. }
  5001. if (msdosAttributes === UNDEFINED_VALUE) {
  5002. msdosAttributes = {
  5003. readOnly: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_READONLY_MASK),
  5004. hidden: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_HIDDEN_MASK),
  5005. system: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_SYSTEM_MASK),
  5006. directory: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_DIR_MASK),
  5007. archive: Boolean(msdosAttributesRaw & FILE_ATTR_MSDOS_ARCHIVE_MASK)
  5008. };
  5009. }
  5010. return { msdosAttributesRaw, msdosAttributes };
  5011. }
  5012. function getDataDescriptorInfo({
  5013. zip64,
  5014. dataDescriptor,
  5015. dataDescriptorSignature
  5016. }) {
  5017. let dataDescriptorArray = new Uint8Array();
  5018. let dataDescriptorView, dataDescriptorOffset = 0;
  5019. let dataDescriptorLength = zip64 ? DATA_DESCRIPTOR_RECORD_ZIP_64_LENGTH : DATA_DESCRIPTOR_RECORD_LENGTH;
  5020. if (dataDescriptorSignature) {
  5021. dataDescriptorLength += DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
  5022. }
  5023. if (dataDescriptor) {
  5024. dataDescriptorArray = new Uint8Array(dataDescriptorLength);
  5025. dataDescriptorView = getDataView(dataDescriptorArray);
  5026. if (dataDescriptorSignature) {
  5027. dataDescriptorOffset = DATA_DESCRIPTOR_RECORD_SIGNATURE_LENGTH;
  5028. setUint32(dataDescriptorView, 0, DATA_DESCRIPTOR_RECORD_SIGNATURE);
  5029. }
  5030. }
  5031. return {
  5032. dataDescriptorArray,
  5033. dataDescriptorView,
  5034. dataDescriptorOffset
  5035. };
  5036. }
  5037. function setEntryInfo({
  5038. signature,
  5039. compressedSize,
  5040. uncompressedSize,
  5041. headerInfo,
  5042. dataDescriptorInfo
  5043. }, {
  5044. zip64,
  5045. zipCrypto,
  5046. dataDescriptor
  5047. }) {
  5048. const {
  5049. headerView,
  5050. encrypted
  5051. } = headerInfo;
  5052. const {
  5053. dataDescriptorView,
  5054. dataDescriptorOffset
  5055. } = dataDescriptorInfo;
  5056. if ((!encrypted || zipCrypto) && signature !== UNDEFINED_VALUE) {
  5057. setUint32(headerView, HEADER_OFFSET_SIGNATURE, signature);
  5058. if (dataDescriptor) {
  5059. setUint32(dataDescriptorView, dataDescriptorOffset, signature);
  5060. }
  5061. }
  5062. if (zip64) {
  5063. if (dataDescriptor) {
  5064. setBigUint64(dataDescriptorView, dataDescriptorOffset + 4, BigInt(compressedSize));
  5065. setBigUint64(dataDescriptorView, dataDescriptorOffset + 12, BigInt(uncompressedSize));
  5066. }
  5067. } else {
  5068. setUint32(headerView, HEADER_OFFSET_COMPRESSED_SIZE, compressedSize);
  5069. setUint32(headerView, HEADER_OFFSET_UNCOMPRESSED_SIZE, uncompressedSize);
  5070. if (dataDescriptor) {
  5071. setUint32(dataDescriptorView, dataDescriptorOffset + 4, compressedSize);
  5072. setUint32(dataDescriptorView, dataDescriptorOffset + 8, uncompressedSize);
  5073. }
  5074. }
  5075. }
  5076. function updateLocalHeader({
  5077. rawFilename,
  5078. encrypted,
  5079. zip64,
  5080. localExtraFieldZip64Length,
  5081. signature,
  5082. compressedSize,
  5083. uncompressedSize,
  5084. zip64UncompressedSize,
  5085. zip64CompressedSize
  5086. }, localHeaderView, { dataDescriptor }) {
  5087. if (!dataDescriptor) {
  5088. if (!encrypted) {
  5089. setUint32(localHeaderView, HEADER_OFFSET_SIGNATURE + 4, signature);
  5090. }
  5091. if (!zip64CompressedSize) {
  5092. setUint32(localHeaderView, HEADER_OFFSET_COMPRESSED_SIZE + 4, compressedSize);
  5093. }
  5094. if (!zip64UncompressedSize) {
  5095. setUint32(localHeaderView, HEADER_OFFSET_UNCOMPRESSED_SIZE + 4, uncompressedSize);
  5096. }
  5097. }
  5098. if (zip64 && localExtraFieldZip64Length) {
  5099. let localHeaderOffset = HEADER_SIZE + getLength(rawFilename) + 4;
  5100. if (zip64UncompressedSize) {
  5101. setBigUint64(localHeaderView, localHeaderOffset, BigInt(uncompressedSize));
  5102. localHeaderOffset += 8;
  5103. }
  5104. if (zip64CompressedSize) {
  5105. setBigUint64(localHeaderView, localHeaderOffset, BigInt(compressedSize));
  5106. localHeaderOffset += 8;
  5107. }
  5108. }
  5109. }
  5110. async function closeFile(zipWriter, comment, options) {
  5111. const { files, writer } = zipWriter;
  5112. const { diskOffset } = writer;
  5113. let { diskNumber } = writer;
  5114. let offset = 0;
  5115. let directoryDataLength = 0;
  5116. let directoryOffset = zipWriter.offset - diskOffset;
  5117. let filesLength = files.size;
  5118. for (const [, fileEntry] of files) {
  5119. const {
  5120. rawFilename,
  5121. rawExtraFieldAES,
  5122. rawComment,
  5123. rawExtraFieldNTFS,
  5124. rawExtraFieldUnix,
  5125. rawExtraField,
  5126. extendedTimestamp,
  5127. extraFieldExtendedTimestampFlag,
  5128. lastModDate,
  5129. zip64UncompressedSize,
  5130. zip64CompressedSize,
  5131. uncompressedSize,
  5132. compressedSize
  5133. } = fileEntry;
  5134. const zip64Offset = fileEntry.offset > MAX_32_BITS;
  5135. const zip64DiskNumberStart = fileEntry.diskNumberStart > MAX_16_BITS;
  5136. let rawExtraFieldZip64;
  5137. if (zip64Offset || zip64DiskNumberStart || zip64UncompressedSize || zip64CompressedSize) {
  5138. let length = 4;
  5139. if (zip64UncompressedSize) length += 8;
  5140. if (zip64CompressedSize) length += 8;
  5141. if (zip64Offset) length += 8;
  5142. if (zip64DiskNumberStart) length += 4;
  5143. rawExtraFieldZip64 = new Uint8Array(length);
  5144. const zip64View = getDataView(rawExtraFieldZip64);
  5145. setUint16(zip64View, 0, EXTRAFIELD_TYPE_ZIP64);
  5146. setUint16(zip64View, 2, length - 4);
  5147. let zip64FieldOffset = 4;
  5148. if (zip64UncompressedSize) { setBigUint64(zip64View, zip64FieldOffset, BigInt(uncompressedSize)); zip64FieldOffset += 8; }
  5149. if (zip64CompressedSize) { setBigUint64(zip64View, zip64FieldOffset, BigInt(compressedSize)); zip64FieldOffset += 8; }
  5150. if (zip64Offset) { setBigUint64(zip64View, zip64FieldOffset, BigInt(fileEntry.offset)); zip64FieldOffset += 8; }
  5151. if (zip64DiskNumberStart) { setUint32(zip64View, zip64FieldOffset, fileEntry.diskNumberStart); }
  5152. } else {
  5153. rawExtraFieldZip64 = new Uint8Array();
  5154. }
  5155. fileEntry.rawExtraFieldZip64 = rawExtraFieldZip64;
  5156. fileEntry.zip64Offset = zip64Offset;
  5157. fileEntry.zip64DiskNumberStart = zip64DiskNumberStart;
  5158. let rawExtraFieldTimestamp;
  5159. if (extendedTimestamp) {
  5160. rawExtraFieldTimestamp = new Uint8Array(9);
  5161. const extraFieldExtendedTimestampView = getDataView(rawExtraFieldTimestamp);
  5162. setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
  5163. setUint16(extraFieldExtendedTimestampView, 2, 5);
  5164. setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
  5165. setUint32(extraFieldExtendedTimestampView, 5, Math.floor(lastModDate.getTime() / 1000));
  5166. } else {
  5167. rawExtraFieldTimestamp = new Uint8Array();
  5168. }
  5169. fileEntry.rawExtraFieldExtendedTimestamp = rawExtraFieldTimestamp;
  5170. directoryDataLength += 46 +
  5171. getLength(
  5172. rawFilename,
  5173. rawComment,
  5174. rawExtraFieldZip64,
  5175. rawExtraFieldAES,
  5176. rawExtraFieldNTFS,
  5177. rawExtraFieldUnix,
  5178. rawExtraFieldTimestamp,
  5179. rawExtraField);
  5180. }
  5181. const directoryArray = new Uint8Array(directoryDataLength);
  5182. const directoryView = getDataView(directoryArray);
  5183. await initStream(writer);
  5184. let directoryDiskOffset = 0;
  5185. for (const [indexFileEntry, fileEntry] of Array.from(files.values()).entries()) {
  5186. const {
  5187. offset: fileEntryOffset,
  5188. rawFilename,
  5189. rawExtraFieldZip64,
  5190. rawExtraFieldAES,
  5191. rawExtraFieldExtendedTimestamp,
  5192. rawExtraFieldNTFS,
  5193. rawExtraFieldUnix,
  5194. rawExtraField,
  5195. rawComment,
  5196. versionMadeBy,
  5197. headerArray,
  5198. headerView,
  5199. zip64UncompressedSize,
  5200. zip64CompressedSize,
  5201. zip64DiskNumberStart,
  5202. zip64Offset,
  5203. internalFileAttributes,
  5204. externalFileAttributes,
  5205. diskNumberStart,
  5206. uncompressedSize,
  5207. compressedSize
  5208. } = fileEntry;
  5209. const extraFieldLength = getLength(rawExtraFieldZip64, rawExtraFieldAES, rawExtraFieldExtendedTimestamp, rawExtraFieldNTFS, rawExtraFieldUnix, rawExtraField);
  5210. setUint32(directoryView, offset, CENTRAL_FILE_HEADER_SIGNATURE);
  5211. setUint16(directoryView, offset + 4, versionMadeBy);
  5212. if (!zip64UncompressedSize) {
  5213. setUint32(headerView, HEADER_OFFSET_UNCOMPRESSED_SIZE, uncompressedSize);
  5214. }
  5215. if (!zip64CompressedSize) {
  5216. setUint32(headerView, HEADER_OFFSET_COMPRESSED_SIZE, compressedSize);
  5217. }
  5218. arraySet(directoryArray, headerArray, offset + 6);
  5219. let directoryOffset = offset + HEADER_SIZE;
  5220. setUint16(directoryView, directoryOffset, extraFieldLength);
  5221. directoryOffset += 2;
  5222. setUint16(directoryView, directoryOffset, getLength(rawComment));
  5223. directoryOffset += 2;
  5224. setUint16(directoryView, directoryOffset, zip64DiskNumberStart ? MAX_16_BITS : diskNumberStart);
  5225. directoryOffset += 2;
  5226. setUint16(directoryView, directoryOffset, internalFileAttributes);
  5227. directoryOffset += 2;
  5228. if (externalFileAttributes) {
  5229. setUint32(directoryView, directoryOffset, externalFileAttributes);
  5230. }
  5231. directoryOffset += 4;
  5232. setUint32(directoryView, directoryOffset, zip64Offset ? MAX_32_BITS : fileEntryOffset);
  5233. directoryOffset += 4;
  5234. arraySet(directoryArray, rawFilename, directoryOffset);
  5235. directoryOffset += getLength(rawFilename);
  5236. arraySet(directoryArray, rawExtraFieldZip64, directoryOffset);
  5237. directoryOffset += getLength(rawExtraFieldZip64);
  5238. arraySet(directoryArray, rawExtraFieldAES, directoryOffset);
  5239. directoryOffset += getLength(rawExtraFieldAES);
  5240. arraySet(directoryArray, rawExtraFieldExtendedTimestamp, directoryOffset);
  5241. directoryOffset += getLength(rawExtraFieldExtendedTimestamp);
  5242. arraySet(directoryArray, rawExtraFieldNTFS, directoryOffset);
  5243. directoryOffset += getLength(rawExtraFieldNTFS);
  5244. arraySet(directoryArray, rawExtraFieldUnix, directoryOffset);
  5245. directoryOffset += getLength(rawExtraFieldUnix);
  5246. arraySet(directoryArray, rawExtraField, directoryOffset);
  5247. directoryOffset += getLength(rawExtraField);
  5248. arraySet(directoryArray, rawComment, directoryOffset);
  5249. directoryOffset += getLength(rawComment);
  5250. if (offset - directoryDiskOffset > writer.availableSize) {
  5251. writer.availableSize = 0;
  5252. await writeData(writer, directoryArray.slice(directoryDiskOffset, offset));
  5253. directoryDiskOffset = offset;
  5254. }
  5255. offset = directoryOffset;
  5256. if (options.onprogress) {
  5257. try {
  5258. await options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
  5259. } catch {
  5260. // ignored
  5261. }
  5262. }
  5263. }
  5264. await writeData(writer, directoryDiskOffset ? directoryArray.slice(directoryDiskOffset) : directoryArray);
  5265. let lastDiskNumber = writer.diskNumber;
  5266. const { availableSize } = writer;
  5267. if (availableSize < END_OF_CENTRAL_DIR_LENGTH) {
  5268. lastDiskNumber++;
  5269. }
  5270. let zip64 = getOptionValue(zipWriter, options, PROPERTY_NAME_ZIP64);
  5271. if (directoryOffset > MAX_32_BITS || directoryDataLength > MAX_32_BITS || filesLength > MAX_16_BITS || lastDiskNumber > MAX_16_BITS) {
  5272. if (zip64 === false) {
  5273. throw new Error(ERR_UNSUPPORTED_FORMAT);
  5274. } else {
  5275. zip64 = true;
  5276. }
  5277. }
  5278. const endOfdirectoryArray = new Uint8Array(zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH);
  5279. const endOfdirectoryView = getDataView(endOfdirectoryArray);
  5280. offset = 0;
  5281. if (zip64) {
  5282. setUint32(endOfdirectoryView, 0, ZIP64_END_OF_CENTRAL_DIR_SIGNATURE);
  5283. setBigUint64(endOfdirectoryView, 4, BigInt(44));
  5284. setUint16(endOfdirectoryView, 12, 45);
  5285. setUint16(endOfdirectoryView, 14, 45);
  5286. setUint32(endOfdirectoryView, 16, lastDiskNumber);
  5287. setUint32(endOfdirectoryView, 20, diskNumber);
  5288. setBigUint64(endOfdirectoryView, 24, BigInt(filesLength));
  5289. setBigUint64(endOfdirectoryView, 32, BigInt(filesLength));
  5290. setBigUint64(endOfdirectoryView, 40, BigInt(directoryDataLength));
  5291. setBigUint64(endOfdirectoryView, 48, BigInt(directoryOffset));
  5292. setUint32(endOfdirectoryView, 56, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE);
  5293. setBigUint64(endOfdirectoryView, 64, BigInt(directoryOffset) + BigInt(directoryDataLength));
  5294. setUint32(endOfdirectoryView, 72, lastDiskNumber + 1);
  5295. const supportZip64SplitFile = getOptionValue(zipWriter, options, OPTION_SUPPORT_ZIP64_SPLIT_FILE, true);
  5296. if (supportZip64SplitFile) {
  5297. lastDiskNumber = MAX_16_BITS;
  5298. diskNumber = MAX_16_BITS;
  5299. }
  5300. filesLength = MAX_16_BITS;
  5301. directoryOffset = MAX_32_BITS;
  5302. directoryDataLength = MAX_32_BITS;
  5303. offset += ZIP64_END_OF_CENTRAL_DIR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH;
  5304. }
  5305. setUint32(endOfdirectoryView, offset, END_OF_CENTRAL_DIR_SIGNATURE);
  5306. setUint16(endOfdirectoryView, offset + 4, lastDiskNumber);
  5307. setUint16(endOfdirectoryView, offset + 6, diskNumber);
  5308. setUint16(endOfdirectoryView, offset + 8, filesLength);
  5309. setUint16(endOfdirectoryView, offset + 10, filesLength);
  5310. setUint32(endOfdirectoryView, offset + 12, directoryDataLength);
  5311. setUint32(endOfdirectoryView, offset + 16, directoryOffset);
  5312. const commentLength = getLength(comment);
  5313. if (commentLength) {
  5314. if (commentLength <= MAX_16_BITS) {
  5315. setUint16(endOfdirectoryView, offset + 20, commentLength);
  5316. } else {
  5317. throw new Error(ERR_INVALID_COMMENT);
  5318. }
  5319. }
  5320. await writeData(writer, endOfdirectoryArray);
  5321. if (commentLength) {
  5322. await writeData(writer, comment);
  5323. }
  5324. }
  5325. async function writeData(writer, array) {
  5326. const { writable } = writer;
  5327. const streamWriter = writable.getWriter();
  5328. try {
  5329. await streamWriter.ready;
  5330. writer.size += getLength(array);
  5331. await streamWriter.write(array);
  5332. } finally {
  5333. streamWriter.releaseLock();
  5334. }
  5335. }
  5336. function getTimeNTFS(date) {
  5337. if (date) {
  5338. return ((BigInt(date.getTime()) + BigInt(11644473600000)) * BigInt(10000));
  5339. }
  5340. }
  5341. function getOptionValue(zipWriter, options, name, defaultValue) {
  5342. const result = options[name] === UNDEFINED_VALUE ? zipWriter.options[name] : options[name];
  5343. return result === UNDEFINED_VALUE ? defaultValue : result;
  5344. }
  5345. function getMaximumCompressedSize(uncompressedSize) {
  5346. return uncompressedSize + (5 * (Math.floor(uncompressedSize / 16383) + 1));
  5347. }
  5348. function setUint8(view, offset, value) {
  5349. view.setUint8(offset, value);
  5350. }
  5351. function setUint16(view, offset, value) {
  5352. view.setUint16(offset, value, true);
  5353. }
  5354. function setUint32(view, offset, value) {
  5355. view.setUint32(offset, value, true);
  5356. }
  5357. function setBigUint64(view, offset, value) {
  5358. view.setBigUint64(offset, value, true);
  5359. }
  5360. function arraySet(array, typedArray, offset) {
  5361. array.set(typedArray, offset);
  5362. }
  5363. function getDataView(array) {
  5364. return new DataView(array.buffer);
  5365. }
  5366. function getLength(...arrayLikes) {
  5367. let result = 0;
  5368. arrayLikes.forEach(arrayLike => arrayLike && (result += arrayLike.length));
  5369. return result;
  5370. }
  5371. function getHeaderArrayData({
  5372. version,
  5373. bitFlag,
  5374. compressionMethod,
  5375. uncompressedSize,
  5376. compressedSize,
  5377. lastModDate,
  5378. rawFilename,
  5379. zip64CompressedSize,
  5380. zip64UncompressedSize,
  5381. extraFieldLength
  5382. }) {
  5383. const headerArray = new Uint8Array(HEADER_SIZE - 4);
  5384. const headerView = getDataView(headerArray);
  5385. setUint16(headerView, 0, version);
  5386. setUint16(headerView, 2, bitFlag);
  5387. setUint16(headerView, 4, compressionMethod);
  5388. const dateArray = new Uint32Array(1);
  5389. const dateView = getDataView(dateArray);
  5390. setUint16(dateView, 0, (((lastModDate.getHours() << 6) | lastModDate.getMinutes()) << 5) | lastModDate.getSeconds() / 2);
  5391. setUint16(dateView, 2, ((((lastModDate.getFullYear() - 1980) << 4) | (lastModDate.getMonth() + 1)) << 5) | lastModDate.getDate());
  5392. const rawLastModDate = dateArray[0];
  5393. setUint32(headerView, 6, rawLastModDate);
  5394. if (zip64CompressedSize || compressedSize !== UNDEFINED_VALUE) {
  5395. setUint32(headerView, HEADER_OFFSET_COMPRESSED_SIZE, zip64CompressedSize ? MAX_32_BITS : compressedSize);
  5396. }
  5397. if (zip64UncompressedSize || uncompressedSize !== UNDEFINED_VALUE) {
  5398. setUint32(headerView, HEADER_OFFSET_UNCOMPRESSED_SIZE, zip64UncompressedSize ? MAX_32_BITS : uncompressedSize);
  5399. }
  5400. setUint16(headerView, 22, getLength(rawFilename));
  5401. setUint16(headerView, 24, extraFieldLength);
  5402. return {
  5403. headerArray,
  5404. headerView,
  5405. rawLastModDate
  5406. };
  5407. }
  5408. function getBitFlag(level, useUnicodeFileNames, dataDescriptor, encrypted, compressionMethod) {
  5409. let bitFlag = 0;
  5410. if (useUnicodeFileNames) {
  5411. bitFlag = bitFlag | BITFLAG_LANG_ENCODING_FLAG;
  5412. }
  5413. if (dataDescriptor) {
  5414. bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
  5415. }
  5416. if (compressionMethod == COMPRESSION_METHOD_DEFLATE || compressionMethod == COMPRESSION_METHOD_DEFLATE_64) {
  5417. if (level >= 0 && level <= 3) {
  5418. bitFlag = bitFlag | BITFLAG_LEVEL_SUPER_FAST_MASK;
  5419. }
  5420. if (level > 3 && level <= 5) {
  5421. bitFlag = bitFlag | BITFLAG_LEVEL_FAST_MASK;
  5422. }
  5423. if (level == 9) {
  5424. bitFlag = bitFlag | BITFLAG_LEVEL_MAX_MASK;
  5425. }
  5426. }
  5427. if (encrypted) {
  5428. bitFlag = bitFlag | BITFLAG_ENCRYPTED;
  5429. }
  5430. return bitFlag;
  5431. }
  5432. /*
  5433. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  5434. Redistribution and use in source and binary forms, with or without
  5435. modification, are permitted provided that the following conditions are met:
  5436. 1. Redistributions of source code must retain the above copyright notice,
  5437. this list of conditions and the following disclaimer.
  5438. 2. Redistributions in binary form must reproduce the above copyright
  5439. notice, this list of conditions and the following disclaimer in
  5440. the documentation and/or other materials provided with the distribution.
  5441. 3. The names of the authors may not be used to endorse or promote products
  5442. derived from this software without specific prior written permission.
  5443. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  5444. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  5445. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  5446. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  5447. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  5448. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  5449. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  5450. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  5451. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  5452. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5453. */
  5454. function getMimeType$1() {
  5455. return "application/octet-stream";
  5456. }
  5457. /*
  5458. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  5459. Redistribution and use in source and binary forms, with or without
  5460. modification, are permitted provided that the following conditions are met:
  5461. 1. Redistributions of source code must retain the above copyright notice,
  5462. this list of conditions and the following disclaimer.
  5463. 2. Redistributions in binary form must reproduce the above copyright
  5464. notice, this list of conditions and the following disclaimer in
  5465. the documentation and/or other materials provided with the distribution.
  5466. 3. The names of the authors may not be used to endorse or promote products
  5467. derived from this software without specific prior written permission.
  5468. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  5469. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  5470. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  5471. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  5472. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  5473. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  5474. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  5475. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  5476. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  5477. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5478. */
  5479. try {
  5480. configure({ baseURI: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-native.cjs', document.baseURI).href)) });
  5481. } catch {
  5482. // ignored
  5483. }
  5484. var{Uint8Array:x,Uint16Array:E,Int32Array:H,TransformStream:U,Math:N,Error:z,Array:v}=globalThis,Se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=new x(0),qe=new E(0),de=[];for(let e=0;e<6;e++)de.push(e,0==e?8:4);de.push(0,1);var Ee=[];for(let e=0;e<14;e++)Ee.push(e,0==e?4:2);var ge=new E([0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576]),Te=new E([0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224,0]);function M(e,t,n,r,i){if(0==i)return;let f=e instanceof x?e:new x(e.buffer,e.byteOffset,e.byteLength),_=n instanceof x?n.subarray(r,r+i):new x(n.buffer,n.byteOffset+r,i);f.set(_,t);}function je(e,t,n){0!=n&&(e instanceof x?e:new x(e.buffer,e.byteOffset,e.byteLength)).fill(0,t,t+n);}function Ve(){return {next_in:F,next_in_index:0,avail_in:0,total_in:0,next_out:F,next_out_index:0,avail_out:0,total_out:0,msg:"",t:0,i:0,_:0,l:void 0}}function Je(e,t){let n=1<<t;return {o:e,u:new x(n),h:n,v:t,k:0,m:0,p:0,I:0}}function te(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];for(let e=0;e<i;e++)t.push(r);}return new E(t)}var ne=class{constructor(e,t){this.L=e,this.M=t,this.F=0;}},re=class{constructor(e,t,n,r,i){this.q=e,this.N=t,this.V=n,this.W=r,this.S=i;}};function g_(e){return V_[e<-6||e>2?9:2-e]||""}function Ae(e,t){try{e.msg=g_(t);}catch(n){e.msg="zlib error "+String(t)+" ("+n+")";}return t}function $e(e,t){let n=e>>>0,r=0;for(let e=0;e<t;e++)r=r<<1|1&n,n>>>=1;return r}function g(e,t){e.$[e.A++]=t;}function De(e,t){g(e,255&t),g(e,t>>>8&255);}function e_(e,t,n){let r=255&n,i=65535&t,f=e.U+e.D;return e.$[f]=255&i,e.$[f+1]=i>>>8&255,e.$[f+2]=r,e.D+=3,i=i-1&65535,e.C[__[r]+ie+1].Z++,e.T[T_(i)].Z++,e.D==e.B}function ye(e,t){let n=255&t,r=e.U+e.D;return e.$[r]=0,e.$[r+1]=0,e.$[r+2]=n,e.D+=3,e.C[n].Z++,e.D==e.B}function ve(e){return e.h-ae}function T_(e){return e<256?E_[e]:E_[256+(e>>7)]}function w_(e){let t=He+7,n=1<<t,r=(1<<t)-1,i=N.floor((t+I-1)/I),f=1<<8+He;return {...Je(e,15),o:e,R:42,G:0,O:void 0,P:32767,H:t,J:n,X:r,Y:i,j:new E(32768),K:new E(n),ee:f,$:new x(32768),te:0,ne:32768,A:0,re:0,ie:0,fe:0,_e:0,le:0,oe:-2,ue:0,ae:0,ce:0,se:0,he:0,de:0,we:0,be:0,ge:0,ve:0,ke:0,me:0,xe:0,ye:0,pe:new H(2*we+1),Ie:new x(2*we+1),ze:new E(be+1),D:0,B:0,Le:F,U:0,Ee:0,Me:0,Fe:8,qe:32768,Ne:0,Ve:0,We:0,C:new v(le).fill(0).map(()=>Q()),T:new v(2*me+1).fill(0).map(()=>Q()),Se:new v(2*oe+1).fill(0).map(()=>Q()),$e:S_(),Ae:S_(),Ue:S_()}}function A_(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1],f=Q();f.Qe=r,f.De=i,t.push(f);}return t}function Q(){return {Z:0,Qe:0,Ze:0,De:0}}function S_(){return new ne([],mn(null,F,0,0,0))}function mn(e,t,n,r,i){return new re(e,t,n,r,i)}function J_(){let e=new v(288).fill(0);for(let t=0;t<=143;t++)e[t]=8;for(let t=144;t<=255;t++)e[t]=9;for(let t=256;t<=279;t++)e[t]=7;for(let t=280;t<=287;t++)e[t]=8;return e}function D_(e){let{code:t,length:n}=bn(e),r=new E(2*e.length),i=0;for(let f=0;f<e.length;f++){let e=n[f]||0,_=t[f]||0;r[i++]=e?$e(_,e):0,r[i++]=e;}return new E(r)}function Q_(e,t,n){let r=0;for(let n=0;n<e.length;n++){let i=t[n]?1<<t[n]:1,f=e[n]+i-1;f>r&&(r=f);}r<n&&(r=n);let i=new x(r+1);for(let n=0;n<=r;n++)for(let r=0;r<e.length;r++){let f=t[r]?1<<t[r]:1,_=e[r];if(n>=_&&n<=_+f-1){i[n]=r;break}}return i}function $_(e,t){let n=0;for(let r=0;r<e.length;r++){let i=t[r]?1<<t[r]:1,f=e[r]+i-1;f>n&&(n=f);}let r=new x(n+1);for(let i=0;i<=n;i++)for(let n=0;n<e.length;n++){let f=t[n]?1<<t[n]:1,_=e[n];if(i>=_&&i<=_+f-1){r[i]=n;break}}return r}function et(e){let t=new x(512),n=e.length-1;for(let r=0;r<256;r++)t[r]=r<=n?e[r]:e[n];for(let r=256;r<=n;r++){let n=r>>7;t[256+(n>255?255:n)]=e[r];}for(let e=257;e<512;e++)0==t[e]&&(t[e]=t[e-1]);return t}function bn(e){let t=N.max(...e),n=new v(t+1).fill(0);for(let t of e)t>0&&n[t]++;let r=new v(e.length).fill(0),i=new v(t+1).fill(0),f=0;for(let e=1;e<=t;e++)f=f+n[e-1]<<1,i[e]=f;for(let t=0;t<e.length;t++){let n=e[t];0!=n&&(r[t]=i[n]++);}return {code:r,length:e}}var He=8,I=3,_e=258,ae=_e+I+1,Ue=16,Be=_e,hn=29,ie=256,we=ie+1+hn,me=30,oe=19,le=2*we+1,be=15,_t=9,tt=255,nt=32,rt=4,ke=256,t_=16,n_=17,r_=18,at=0,y_=1,it=2,$=-1,V_=["need dictionary","stream end","","file error","stream error","data error","insufficient memory","buffer error",""],a_=te(de),i_=te(Ee),Ze=new E(19);Ze[16]=2,Ze[17]=3,Ze[18]=7;var sn=D_(J_()),xn=D_(new v(30).fill(5)),Fe=A_(sn),v_=A_(xn),__=Q_(Te,a_,_e),E_=et($_(ge,i_));function Pe(e){return e%65521>>>0}function he(e,t,n){if(void 0===t||void 0===n)return 1;let r=e>>>16&65535;if(e&=65535,1==n)return (e+=t[0])>=65521&&(e-=65521),r+=e,r>=65521&&(r-=65521),(r<<16|e)>>>0;if(n<16){for(let i=0;i<n;i++)r+=e+=t[i];return e>=65521&&(e-=65521),r=Pe(r),(r<<16|e)>>>0}for(;n>=5552;){n-=5552;let i=N.floor(347);do{for(let n=0;n<16;n++)r+=e+=t[n];t=t.subarray(16);}while(--i);e=Pe(e),r=Pe(r);}if(n){for(;n>=16;){n-=16;for(let n=0;n<16;n++)r+=e+=t[n];t=t.subarray(16);}for(let i=0;i<n;i++)r+=e+=t[i];e=Pe(e),r=Pe(r);}return (r<<16|e)>>>0}var pn=(()=>{let e=new v(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=1&n?3988292384^n>>>1:n>>>1;e[t]=n>>>0;}return e})();function W(e=0,t,n){if(!t)return 0;void 0===n&&(n=t.length),n=N.min(n,t.length),e=~e>>>0;for(let r=0;r<n;r++)e=e>>>8^pn[255&(e^t[r])];return (4294967295^e)>>>0}function mt(e){16==e.I?(De(e,e.p),e.p=0,e.I=0):e.I>=8&&(g(e,e.p),e.p>>=8,e.I-=8);}function bt(e){e.I>8?De(e,e.p):e.I>0&&g(e,e.p),e.Ee=1+(e.I-1&7),e.p=0,e.I=0;}function Sn(e,t,n){let r,i,f=[],_=0;for(r=1;r<=be;r++)_=_+n[r-1]<<1,f[r]=_;for(i=0;i<=t;i++){let t=e[i].De;0!=t&&(e[i].Qe=$e(f[t]++,t));}}function L(e,t,n){e.I>Ue-n?(e.p=65535&(e.p|t<<e.I),De(e,e.p),e.p=t>>Ue-e.I&65535,e.I+=n-Ue):(e.p=65535&(e.p|t<<e.I),e.I+=n);}function ht(e){for(let t=0;t<e.C.length;t++)e.C[t].Z=0;for(let t=0;t<e.T.length;t++)e.T[t].Z=0;for(let t=0;t<e.Se.length;t++)e.Se[t].Z=0;e.C[ke].Z=1,e.ie=e.fe=0,e.D=e._e=0;}function st(e){if(e.C&&e.C.length>=le)for(let t=0;t<le;t++)e.C[t]=Q();else {e.C=[];for(let t=0;t<le;t++)e.C.push(Q());}if(e.T&&e.T.length>=2*me+1)for(let t=0;t<2*me+1;t++)e.T[t]=Q();else {e.T=[];for(let t=0;t<2*me+1;t++)e.T.push(Q());}if(e.Se&&e.Se.length>=2*oe+1)for(let t=0;t<2*oe+1;t++)e.Se[t]=Q();else {e.Se=[];for(let t=0;t<2*oe+1;t++)e.Se.push(Q());}e.$e=new ne(e.C,new re(Fe,a_,ie+1,we,be)),e.Ae=new ne(e.T,new re(v_,i_,0,me,be)),e.Ue=new ne(e.Se,new re(null,Ze,0,oe,7)),e.p=0,e.I=0,e.Ee=0,ht(e);}var se=1;function En(e,t,n){return n=e.pe[se],e.pe[se]=e.pe[e.Ve--],k_(e,t,se),n}function ft(e,t,n,r){return e[t].Z<e[n].Z||e[t].Z==e[n].Z&&r[t]<=r[n]}function k_(e,t,n){let r=e.pe[n],i=n<<1;for(;i<=e.Ve&&(i<e.Ve&&ft(t,e.pe[i+1],e.pe[i],e.Ie)&&i++,!ft(t,r,e.pe[i],e.Ie));)e.pe[n]=e.pe[i],n=i,i<<=1;e.pe[n]=r;}function gn(e,t){let n,r,i,f,_,l,o=t.L,u=t.F,a=t.M.q,c=t.M.N,s=t.M.V,h=t.M.S,d=0;for(f=0;f<=be;f++)e.ze[f]=0;for(o[e.pe[e.We]].De=0,n=e.We+1;n<le;n++)r=e.pe[n],f=o[o[r].Ze].De+1,f>h&&(f=h,d++),o[r].De=f,!(r>u)&&(e.ze[f]++,_=0,r>=s&&(_=c[r-s]),l=o[r].Z,e.ie+=l*(f+_),a&&(e.fe+=l*(a[r].De+_)));if(0!=d){do{for(f=h-1;0==e.ze[f];)f--;e.ze[f]--,e.ze[f+1]+=2,e.ze[h]--,d-=2;}while(d>0);for(f=h;0!=f;f--)for(r=e.ze[f];0!=r;)i=e.pe[--n],!(i>u)&&(o[i].De!=f&&(e.ie+=(f-o[i].De)*o[i].Z,o[i].De=f),r--);}}function I_(e,t){let n,r,i,f=t.L,_=t.M.q,l=t.M.W,o=-1;for(e.Ve=0,e.We=le,n=0;n<l;n++)0!=f[n].Z?(e.pe[++e.Ve]=o=n,e.Ie[n]=0):f[n].De=0;for(;e.Ve<2;)i=e.pe[++e.Ve]=o<2?++o:0,f[i].Z=1,e.Ie[i]=0,e.ie--,_&&(e.fe-=_[i].De);for(t.F=o,n=N.floor(e.Ve/2);n>=1;n--)k_(e,f,n);i=l;do{n=En(e,f,n),r=e.pe[se],e.pe[--e.We]=n,e.pe[--e.We]=r,f[i].Z=f[n].Z+f[r].Z,e.Ie[i]=(e.Ie[n]>=e.Ie[r]?e.Ie[n]:e.Ie[r])+1,f[n].Ze=f[r].Ze=i,e.pe[se]=i++,k_(e,f,se);}while(e.Ve>=2);e.pe[--e.We]=e.pe[se],gn(e,t),Sn(f,t.F,e.ze);}function ut(e,t,n){let r,i,f=-1,_=t[0].De,l=0,o=7,u=4;for(0==_&&(o=138,u=3),t[n+1].De=65535,r=0;r<=n;r++)i=_,_=t[r+1].De,!(++l<o&&i==_)&&(l<u?e.Se[i].Z+=l:0!=i?(i!=f&&e.Se[i].Z++,e.Se[t_].Z++):l<=10?e.Se[n_].Z++:e.Se[r_].Z++,l=0,f=i,0==_?(o=138,u=3):i==_?(o=6,u=3):(o=7,u=4));}function ct(e,t,n){let r,i=-1,f=t[0].De,_=0,l=7,o=4;0==f&&(l=138,o=3);for(let u=0;u<=n;u++)if(r=f,f=t[u+1].De,!(++_<l&&r==f)){if(_<o)do{L(e,e.Se[r].Qe,e.Se[r].De);}while(0!=--_);else 0!=r?(r!=i&&(L(e,e.Se[r].Qe,e.Se[r].De),_--),L(e,e.Se[t_].Qe,e.Se[t_].De),L(e,_-3,2)):_<=10?(L(e,e.Se[n_].Qe,e.Se[n_].De),L(e,_-3,3)):(L(e,e.Se[r_].Qe,e.Se[r_].De),L(e,_-11,7));_=0,i=r,0==f?(l=138,o=3):r==f?(l=6,o=3):(l=7,o=4);}}function Tn(e){let t;for(ut(e,e.C,e.$e.F),ut(e,e.T,e.Ae.F),I_(e,e.Ue),t=oe-1;t>=3&&0==e.Se[Se[t]].De;t--);return e.ie+=3*(t+1)+5+5+4,t}function wn(e,t,n,r){let i;for(L(e,t-257,5),L(e,n-1,5),L(e,r-4,4),i=0;i<r;i++)L(e,e.Se[Se[i]].De,3);ct(e,e.C,t-1),ct(e,e.T,n-1);}function Me(e,t,n,r,i=0){L(e,(at<<1)+r,3),bt(e),De(e,n),De(e,~n),n&&t&&M(e.$,e.A,t,i,n),e.A+=n;}function xt(e){mt(e);}function pt(e){L(e,y_<<1,3),L(e,Fe[ke].Qe,Fe[ke].De),mt(e);}function dt(e,t,n){let r,i,f,_,l=0;if(0!=e.D)do{r=255&e.Le[l],r+=(255&e.Le[l+1])<<8,i=e.Le[l+2],l+=3,0==r?L(e,t[i].Qe,t[i].De):(f=__[i],L(e,t[f+ie+1].Qe,t[f+ie+1].De),_=a_[f],0!=_&&(i-=Te[f],L(e,i,_)),r--,f=T_(r),L(e,n[f].Qe,n[f].De),_=i_[f],0!=_&&(r-=ge[f],L(e,r,_)));}while(l<e.D);L(e,t[ke].Qe,t[ke].De);}function An(e){let t,n=4093624447;for(t=0;t<=31;t++,n>>=1)if(1&n&&0!=e.C[t].Z)return 0;if(0!=e.C[9].Z||0!=e.C[10].Z||0!=e.C[13].Z)return 1;for(t=32;t<ie;t++)if(0!=e.C[t].Z)return 1;return 0}function St(e,t,n,r,i=0){let f,_,l=0;e.ge>0?(2==e.o.t&&(e.o.t=An(e)),I_(e,e.$e),I_(e,e.Ae),l=Tn(e),f=e.ie+3+7>>3,_=e.fe+3+7>>3,(_<=f||4==e.ve)&&(f=_)):f=_=n+5,n+4<=f&&t?Me(e,t,n,r,i):_==f?(L(e,(y_<<1)+r,3),dt(e,Fe,v_)):(L(e,(it<<1)+r,3),wn(e,e.$e.F+1,e.Ae.F+1,l+1),dt(e,e.C,e.T)),ht(e),r&&bt(e);}function wt(){let e=Ve();return e.l=w_(e),e}var Xe=[{Ce:It,Te:0,Be:0,Re:0,Ge:0},{Ce:z_,Te:4,Be:4,Re:8,Ge:4},{Ce:z_,Te:5,Be:5,Re:16,Ge:8},{Ce:z_,Te:6,Be:16,Re:32,Ge:32},{Ce:Re,Te:4,Be:4,Re:16,Ge:16},{Ce:Re,Te:16,Be:8,Re:16,Ge:32},{Ce:Re,Te:16,Be:16,Re:32,Ge:128},{Ce:Re,Te:32,Be:32,Re:128,Ge:256},{Ce:Re,Te:128,Be:128,Re:256,Ge:1024},{Ce:Re,Te:258,Be:258,Re:258,Ge:4096}];function Et(e){return 2*e-(e>4?9:0)}function f_(e,t,n){return ((t<<e.Y^n)&e.X)>>>0}function u_(e,t){e.be=f_(e,e.be,e.u[t+(I-1)]);let n=e.j[t&e.P]=e.K[e.be];return e.K[e.be]=t,n}function At(e){e.K[e.J-1]=0,je(e.K,0,(e.J-1)*e.K.BYTES_PER_ELEMENT);}function Nn(e){let t,n,r=e.h;for(t=e.J;t>0;)t--,n=e.K[t],e.K[t]=n>=r?n-r:0;for(t=r;t>0;)t--,n=e.j[t],e.j[t]=n>=r?n-r:0;}function C_(e,t,n,r){let i=e.avail_in;return i>r&&(i=r),0==i?0:(e.avail_in-=i,M(t,n,e.next_in,e.next_in_index,i),1==e.l.G?e.i=he(e.i,new x(t.buffer,t.byteOffset+n,i),i):2==e.l.G&&(e.i=W(e.i,new x(t.buffer,t.byteOffset+n,i),i)),e.next_in_index+=i,e.total_in+=i,i)}function c_(e){let t,n,r=e.h;do{if(n=e.qe-e.ce-e.ae,0==n&&0==e.ae&&0==e.ce?n=r:-1==n&&n--,e.ae>=r+ve(e)&&(M(e.u,0,e.u,r,r-n),e.Ne-=r,e.ae-=r,e.ue-=r,e.le>e.ae&&(e.le=e.ae),Nn(e),n+=r),0==e.o.avail_in)break;if(t=C_(e.o,e.u,e.ae+e.ce,n),e.ce+=t,e.ce+e.le>=I){let t=e.ae-e.le;for(e.be=e.u[t],e.be=f_(e,e.be,e.u[t+1]);e.le&&(e.be=f_(e,e.be,e.u[t+I-1]),e.j[t&e.P]=e.K[e.be],e.K[e.be]=t,t++,e.le--,!(e.ce+e.le<I)););}}while(e.ce<ae&&0!=e.o.avail_in);if(e.k<e.qe){let t,n=e.ae+e.ce;e.k<n?(t=e.qe-n,t>Be&&(t=Be),je(e.u,n,t),e.k=n+t):e.k<n+Be&&(t=n+Be-e.k,t>e.qe-e.k&&(t=e.qe-e.k),je(e.u,e.k,t),e.k+=t);}}function Dt(e,t,n=8,r=15,i=He,f=0){let _=1;if(!e)return -2;if(e.msg="",-1==t&&(t=6),r<0){if(_=0,r<-15)return -2;r=-r;}else r>15&&(_=2,r-=16);if(i<1||i>_t||8!=n||r<8||r>15||t<0||t>9||f<0||f>4||8==r&&1!=_)return -2;8==r&&(r=9);let l=w_(e);return l?(e.l=l,l.o=e,l.R=42,l.G=_,l.O=void 0,l.v=r,l.h=1<<l.v,l.P=l.h-1,l.H=i+7,l.J=1<<l.H,l.X=l.J-1,l.Y=(l.H+I-1)/I,l.u=new x(2*l.h),l.j=new E(l.h),l.K=new E(l.J),l.k=0,l.ee=1<<i+6,l.$=new x(l.ee*rt),l.ne=4*l.ee,l.u&&l.j&&l.K&&l.$?(l.Le=l.$.subarray(l.ee),l.U=l.te+l.ee,l.B=3*(l.ee-1),l.ge=t,l.ve=f,l.Fe=n,Cn(e)):(l.R=666,e.msg=g_(-4),B_(e),-4)):-4}function U_(e){if(null==e)return true;let t=e.l;return !t||t.o!=e||42!=t.R&&57!=t.R&&69!=t.R&&73!=t.R&&91!=t.R&&103!=t.R&&113!=t.R&&666!=t.R}function Rn(e){let t;return U_(e)?-2:(e.total_in=e.total_out=0,e.msg="",e.t=2,t=e.l,t.A=0,t.re=t.te,t.G<0&&(t.G=-t.G),t.R=2==t.G?57:42,e.i=2==t.G?W(0):he(0),t.oe=-2,st(t),0)}function zn(e){e.qe=2*e.h,At(e),e.ye=Xe[e.ge].Te,e.ke=Xe[e.ge].Be,e.me=Xe[e.ge].Re,e.xe=Xe[e.ge].Ge,e.ae=0,e.ue=0,e.ce=0,e.le=0,e.se=e.he=I-1,e.we=0,e.be=0;}function Cn(e){let t=Rn(e);return 0==t&&zn(e.l),t}function Ye(e,t){g(e,t>>8),g(e,255&t);}function q(e){let t,n=e.l;xt(n),t=n.A,t>e.avail_out&&(t=e.avail_out),0!=t&&(M(e.next_out,e.next_out_index,n.$,n.re,t),e.next_out_index+=t,n.re+=t,e.total_out+=t,e.avail_out-=t,n.A-=t,0==n.A&&(n.re=n.te));}function Ie(e,t){let n=e.l;n.O&&n.O.Oe&&(e.i=W(e.i,new x(n.$.buffer,n.te+t,n.A-t),n.A-t));}function yt(e,t){let n,r=e.l;if(U_(e)||t>5||t<0)return Ae(e,-2);if(!e.next_out||0!=e.avail_in&&!e.next_in||666==r.R&&4!=t)return Ae(e,-2);if(0==e.avail_out)return Ae(e,-5);if(n=r.oe,r.oe=t,0!=r.A){if(q(e),0==e.avail_out)return r.oe=$,0}else if(0==e.avail_in&&Et(t)<=Et(n)&&4!=t)return Ae(e,-5);if(666==r.R&&0!=e.avail_in)return Ae(e,-5);if(42==r.R&&0==r.G&&(r.R=113),42==r.R){let t,n=8+(r.v-8<<4)<<8;if(t=r.ve>=2||r.ge<2?0:r.ge<6?1:6==r.ge?2:3,n|=t<<6,0!=r.ae&&(n|=nt),n+=31-n%31,Ye(r,n),0!=r.ae&&(Ye(r,e.i>>16),Ye(r,65535&e.i)),e.i=1,r.R=113,q(e),0!=r.A)return r.oe=$,0}if(57==r.R)if(e.i=W(0),g(r,31),g(r,139),g(r,8),r.O)g(r,(r.O.Pe?1:0)+(r.O.Oe?2:0)+(null==r.O.He?0:4)+(null==r.O.Je?0:8)+(null==r.O.Xe?0:16)),g(r,255&r.O.Ye),g(r,r.O.Ye>>>8&255),g(r,r.O.Ye>>>16&255),g(r,r.O.Ye>>>24&255),g(r,9==r.ge?2:r.ve>=2||r.ge<2?4:0),g(r,255&r.O.je),null!=r.O.He&&(g(r,255&r.O.Ke),g(r,r.O.Ke>>>8&255)),r.O.Oe&&(e.i=W(e.i,r.$,r.A)),r.Me=0,r.R=69;else if(g(r,0),g(r,0),g(r,0),g(r,0),g(r,0),g(r,9==r.ge?2:r.ve>=2||r.ge<2?4:0),g(r,tt),r.R=113,q(e),0!=r.A)return r.oe=$,0;if(69==r.R){if(r.O&&null!=r.O.He){let t=r.A,n=(65535&r.O.Ke)-r.Me;for(;r.A+n>r.ne;){let i=r.ne-r.A;if(M(r.$,r.A,r.O.He,r.Me,i),r.A=r.ne,Ie(e,t),r.Me+=i,q(e),0!=r.A)return r.oe=$,0;t=0,n-=i;}M(r.$,r.A,r.O.He,r.Me,n),r.A+=n,Ie(e,t),r.Me=0;}r.R=73;}if(73==r.R){if(r.O&&r.O.Je&&r.O.Je.length){let t,n=r.A;do{if(r.A==r.ne){if(Ie(e,n),q(e),0!=r.A)return r.oe=$,0;n=0;}t=r.O.Je[r.Me++],g(r,t);}while(0!=t);Ie(e,n),r.Me=0;}r.R=91;}if(91==r.R){if(r.O&&r.O.Xe&&r.O.Xe.length){let t,n=r.A;do{if(r.A==r.ne){if(Ie(e,n),q(e),0!=r.A)return r.oe=$,0;n=0;}t=r.O.Xe[r.Me++],g(r,t);}while(0!=t);Ie(e,n);}r.R=103;}if(103==r.R){if(r.O&&r.O.Oe){if(r.A+2>r.ne&&(q(e),0!=r.A))return r.oe=$,0;g(r,255&e.i),g(r,e.i>>>8&255),e.i=W(0);}if(r.R=113,q(e),0!=r.A)return r.oe=$,0}if(0!=e.avail_in||0!=r.ce||0!=t&&666!=r.R){let n=0==r.ge?It(r,t):2==r.ve?On(r,t):3==r.ve?Ln(r,t):Xe[r.ge].Ce(r,t);if((2==n||3==n)&&(r.R=666),0==n||2==n)return 0==e.avail_out&&(r.oe=$),0;if(1==n&&(1==t?pt(r):5!=t&&(Me(r,null,0,0),3==t&&(At(r),0==r.ce&&(r.ae=0,r.ue=0,r.le=0))),q(e),0==e.avail_out))return r.oe=$,0}return 4!=t?0:r.G<=0?1:(2==r.G?(g(r,255&e.i),g(r,e.i>>>8&255),g(r,e.i>>>16&255),g(r,e.i>>>24&255),g(r,255&e.total_in),g(r,e.total_in>>>8&255),g(r,e.total_in>>>16&255),g(r,e.total_in>>>24&255)):(Ye(r,e.i>>>16&65535),Ye(r,65535&e.i)),q(e),r.G>0&&(r.G=-r.G),0!=r.A?0:1)}function B_(e){if(U_(e))return -2;let t=e.l,n=t.R;return t.u=F,t.j=qe,t.K=qe,t.$=F,t.Le=F,t.pe=new H(0),t.Ie=F,t.ze=qe,t.C.length=0,t.T.length=0,t.Se.length=0,t.O=void 0,t.te=0,t.re=0,t.U=0,113==n?-3:0}function vt(e,t){let n,r,i=e.xe,f=e.ae,_=e.he,l=e.me,o=e.ae>ve(e)?e.ae-ve(e):0,u=e.j,a=e.P,c=e.u[f],s=e.u[f+1],h=e.u[f+_-1],d=e.u[f+_];e.he>=e.ke&&(i>>=2),l>e.ce&&(l=e.ce);do{if(n=t,e.u[n+_]!=d||e.u[n+_-1]!=h||e.u[n]!=c||e.u[n+1]!=s)continue;let i=N.min(_e,e.ce),o=2;for(;o<i&&e.u[f+o]==e.u[n+o];)o++;if(r=o,r>_){if(e.Ne=t,_=r,r>=l)break;h=e.u[f+_-1],d=e.u[f+_];}}while((t=u[t&a])>o&&0!=--i);return _<=e.ce?_:e.ce}function kt(e,t){St(e,e.u,e.ae-e.ue,t,e.ue),e.ue=e.ae,q(e.o);}function V(e,t){return kt(e,t?1:0),0==e.o.avail_out?t?2:0:null}var gt=65535;function Ne(e,t){return e<t?e:t}function It(e,t){let n,r,i,f=Ne(e.ne-5,e.h),_=0,l=e.o.avail_in;do{if(n=gt,i=e.I+42>>3,e.o.avail_out<i||(i=e.o.avail_out-i,r=e.ae-e.ue,n>r+e.o.avail_in&&(n=r+e.o.avail_in),n>i&&(n=i),n<f&&(0==n&&4!=t||0==t||n!=r+e.o.avail_in)))break;_=4==t&&n==r+e.o.avail_in?1:0,Me(e,null,0,_),e.$[e.A-4]=n,e.$[e.A-3]=n>>8,e.$[e.A-2]=~n,e.$[e.A-1]=~n>>8,q(e.o),r&&(r>n&&(r=n),M(e.o.next_out,e.o.next_out_index,e.u,e.ue,r),e.o.next_out_index+=r,e.o.avail_out-=r,e.o.total_out+=r,e.ue+=r,n-=r),n&&(C_(e.o,e.o.next_out,e.o.next_out_index,n),e.o.next_out_index+=n,e.o.avail_out-=n,e.o.total_out+=n);}while(0==_);if(l-=e.o.avail_in,l){if(l>=e.h){e._e=2;let t=e.o.next_in_index-e.h;M(e.u,0,e.o.next_in,t,e.h),e.ae=e.h,e.le=e.ae;}else e.qe-e.ae<=l&&(e.ae-=e.h,M(e.u,0,e.u,e.h,e.ae),e._e<2&&e._e++,e.le>e.ae&&(e.le=e.ae)),M(e.u,e.ae,e.o.next_in,e.o.next_in_index-l,l),e.ae+=l,e.le+=Ne(l,e.h-e.le);e.ue=e.ae;}return e.k<e.ae&&(e.k=e.ae),_?(e.Ee=8,3):0!=t&&4!=t&&0==e.o.avail_in&&e.ae==e.ue?1:(i=e.qe-e.ae,e.o.avail_in>i&&e.ue>=e.h&&(e.ue-=e.h,e.ae-=e.h,M(e.u,0,e.u,e.h,e.ae),e._e<2&&e._e++,i+=e.h,e.le>e.ae&&(e.le=e.ae)),i>e.o.avail_in&&(i=e.o.avail_in),i&&(C_(e.o,e.u,e.ae,i),e.ae+=i,e.le+=Ne(i,e.h-e.le)),e.k<e.ae&&(e.k=e.ae),i=e.I+42>>3,i=Ne(e.ne-i,gt),f=Ne(i,e.h),r=e.ae-e.ue,(r>=f||(r||4==t)&&0!=t&&0==e.o.avail_in&&r<=i)&&(n=Ne(r,i),_=4==t&&0==e.o.avail_in&&n==r?1:0,Me(e,e.u,n,_,e.ue),e.ue+=n,q(e.o)),_&&(e.Ee=8),_?2:0)}function z_(e,t){let n,r=false;for(;;){if(e.ce<ae){if(c_(e),e.ce<ae&&0==t)return 0;if(0==e.ce)break}if(n=0,e.ce>=I&&(n=u_(e,e.ae)),0!=n&&e.ae-n<=ve(e)&&(e.se=vt(e,n)),e.se>=I)if(e.ae,e.Ne,e.se,r=e_(e,e.ae-e.Ne,e.se-I),e.ce-=e.se,e.se<=e.ye&&e.ce>=I){e.se--;do{e.ae++,n=u_(e,e.ae);}while(0!=--e.se);e.ae++;}else e.ae+=e.se,e.se=0,e.be=e.u[e.ae],e.be=f_(e,e.be,e.u[e.ae+1]);else r=ye(e,e.u[e.ae]),e.ce--,e.ae++;if(r){let t=V(e,false);if(null!=t)return t}}if(e.le=e.ae<I-1?e.ae:I-1,4==t){return V(e,true)??3}if(e.D){let t=V(e,false);if(null!=t)return t}return 1}function Re(e,t){let n,r=false;for(;;){if(e.ce<ae){if(c_(e),e.ce<ae&&0==t)return 0;if(0==e.ce)break}if(n=0,e.ce>=I&&(n=u_(e,e.ae)),e.he=e.se,e.de=e.Ne,e.se=I-1,0!=n&&e.he<e.ye&&e.ae-n<=ve(e)&&(e.se=vt(e,n),e.se<=5&&1==e.ve&&(e.se=I-1)),e.he>=I&&e.se<=e.he){let t=e.ae+e.ce-I;e.ae,e.de,e.he,r=e_(e,e.ae-1-e.de,e.he-I),e.ce-=e.he-1,e.he-=2;do{++e.ae<=t&&(n=u_(e,e.ae));}while(0!=--e.he);if(e.we=0,e.se=I-1,e.ae++,r){let t=V(e,false);if(null!=t)return t}}else if(e.we){if(r=ye(e,e.u[e.ae-1]),r&&kt(e,0),e.ae++,e.ce--,0==e.o.avail_out)return 0}else e.we=1,e.ae++,e.ce--;}if(e.we&&(r=ye(e,e.u[e.ae-1]),e.we=0),e.le=e.ae<I-1?e.ae:I-1,4==t){return V(e,true)??3}if(e.D){let t=V(e,false);if(null!=t)return t}return 1}function Ln(e,t){let n,r,i,f;for(;;){if(e.ce<=_e){if(c_(e),e.ce<=_e&&0==t)return 0;if(0==e.ce)break}if(e.se=0,e.ce>=I&&e.ae>0&&(i=e.ae-1,r=e.u[i],r==++i&&r==++i&&r==++i)){f=e.ae+_e;do{}while(r==++i&&r==++i&&r==++i&&r==++i&&r==++i&&r==++i&&r==++i&&r==++i&&i<f);e.se=_e-(f-i),e.se>e.ce&&(e.se=e.ce);}if(e.se>=I?(e.ae,e.ae,e.se,n=e_(e,1,e.se-I),e.ce-=e.se,e.ae+=e.se,e.se=0):(n=ye(e,e.u[e.ae]),e.ce--,e.ae++),n){let t=V(e,false);if(null!=t)return t}}if(e.le=0,4==t){return V(e,true)??3}if(e.D){let t=V(e,false);if(null!=t)return t}return 1}function On(e,t){let n=false;for(;;){if(0==e.ce&&(c_(e),0==e.ce)){if(0==t)return 0;break}if(e.se=0,n=ye(e,e.u[e.ae]),e.ce--,e.ae++,n){let t=V(e,false);if(null!=t)return t}}if(e.le=0,4==t){return V(e,true)??3}if(e.D){let t=V(e,false);if(null!=t)return t}return 1}var ue=852,d_=592,m_=594,Nt=ge.map(e=>e+1),Rt=Te.subarray(0,-1).map(e=>e+3),zt=[16,1,73,1,200,1],Ct=Ee.map(Wt),Lt=Ee.map(Gt);Ct.push(64,2),Lt.push(142,2);var Ot=de.map(Wt),Ht=de.map(Gt);Ot.push(...zt),Ht.push(...zt);var Ut=new E([...Rt,258,0,0]),Bt=new E([...Rt,3,0,0]),Zt=te(Ot),Ft=te(Ht),Pt=new E([...Nt,0,0]),Mt=new E([...Nt,32769,49153]),Yt=te(Ct),Xt=te(Lt);function Wt(e,t){return t%2?e:e+16}function Gt(e,t){return t%2?e:e+128}function qt(e,t){let n,r=e.l,i=e.next_in_index,f=e.next_out_index,_=e.next_in,l=e.next_out,o=r.u,u=r.p>>>0,a=r.I>>>0,c=r.et,s=r.tt,h=(1<<r.nt)-1,d=(1<<r.rt)-1,w=r.h>>>0,b=r.k>>>0,g=r.m>>>0,v=r.it,k=f-(t-e.avail_out),m=f+(e.avail_out-257),x=i+(e.avail_in-5),y=0,p=0,I=0,z=0;e:do{for(;a<15;){if(!(i<_.length))break e;u+=_[i++]<<a,a+=8;}n=c[u&h];t:for(;;){if(I=n.ft,u>>>=I,a-=I,I=n._t,0==I){l[f++]=n.lt;break}if(16&I){if(y=n.lt,I&=15,I){for(;a<I;){if(!(i<_.length)){r.ot=16200;break e}u+=_[i++]<<a,a+=8;}y+=u&(1<<I)-1,u>>>=I,a-=I;}for(;a<15;){if(!(i<_.length)){r.ot=16200;break e}u+=_[i++]<<a,a+=8;}n=s[u&d];n:for(;;){if(I=n.ft,u>>>=I,a-=I,I=n._t,16&I){if(p=n.lt,I&=15,I){for(;a<I;){if(!(i<_.length)){r.ot=16200;break e}u+=_[i++]<<a,a+=8;}p+=u&(1<<I)-1,u>>>=I,a-=I;}let t=y,c=f-k;if(p>c){let n=p-c;if(n>b&&v){e.msg="invalid distance too far back",r.ot=16209;break e}if(0==g){if(z=w-n,!(n<t)){for(let e=0;e<t;++e)l[f++]=o[z++];continue e}for(let e=0;e<n;++e)l[f++]=o[z++];t-=n,z=f-p;}else if(g<n){z=w+g-n;let e=n-g;if(!(e<t)){for(let e=0;e<t;++e)l[f++]=o[z++];continue e}for(let t=0;t<e;++t)l[f++]=o[z++];if(t-=e,z=0,g<t){for(let e=0;e<g;++e)l[f++]=o[z++];t-=g,z=f-p;}}else {if(z=g-n,!(n<t)){for(let e=0;e<t;++e)l[f++]=o[z++];continue e}for(let e=0;e<n;++e)l[f++]=o[z++];t-=n,z=f-p;}for(;t>2;)l[f++]=l[z++],l[f++]=l[z++],l[f++]=l[z++],t-=3;t&&(l[f++]=l[z++],t>1&&(l[f++]=l[z++]));}else {for(z=f-p;t>2;)l[f++]=l[z++],l[f++]=l[z++],l[f++]=l[z++],t-=3;t&&(l[f++]=l[z++],t>1&&(l[f++]=l[z++]));}break}if(64&I){e.msg="invalid distance code",r.ot=16209;break e}n=s[n.lt+(u&(1<<I)-1)];continue n}break}if(64&I){if(32&I){r.ot=16191;break e}e.msg="invalid literal/length code",r.ot=16209;break e}n=c[n.lt+(u&(1<<I)-1)];continue t}}while(i<x&&f<m);let L=a>>3;i-=L,a-=L<<3,u&=(1<<a)-1,e.next_in_index=i,e.next_out_index=f,e.avail_in=i<x?x-i+5:5-(i-x),e.avail_out=f<m?m-f+257:257-(f-m),r.p=u>>>0,r.I=a>>>0;}function Z_(e,t){let n=[],r=t?ue+m_:ue+d_;return {...Je(e,0),o:e,ot:16180,ut:false,G:0,ct:false,st:0,ht:0,dt:0,wt:0,u:F,bt:0,gt:0,He:0,et:n,tt:n,nt:0,rt:0,vt:0,kt:0,xt:0,yt:0,It:n,zt:new E(320),Lt:new E(288),Et:new v(r).fill(null).map(()=>pe()),Mt:0,it:true,Ft:0,qt:0,Nt:t}}function pe(e=0,t=0,n=0){return {_t:e,ft:t,lt:n}}function F_(e=1){return {_t:64,ft:e,lt:0}}function jt(e=0){return {_t:96,ft:e,lt:0}}function P_(e){return (255&e)<<24|(e>>8&255)<<16|(e>>16&255)<<8|e>>24&255}var Le=15,Un={Nt:false,Vt:Ut,Wt:Zt,St:Pt,$t:Yt,At:20,Ut:257,Qt:0,Dt:d_,Zt:false,Ct:true},Bn={Nt:true,Vt:Bt,Wt:Ft,St:Mt,$t:Xt,At:19,Ut:256,Qt:-1,Dt:m_,Zt:true,Ct:false};function Oe(e,t,n,r,i,f,_,l){let o,u,a,c,s,h,d,w,b,g,v,k,m,x,y,p,I,z,L,M=new E(Le+1),F=new E(Le+1),q=l?Bn:Un;for(o=0;o<=Le;o++)M[o]=0;for(u=0;u<n;u++)M[t[u]]++;for(s=i.Tt,c=Le;c>=1&&0==M[c];c--);if(s>c&&(s=c),0==c)return q.Ct?(y=F_(1),r.Tt[0]=y,r.Tt[1]=y,i.Tt=1,0):-1;for(a=1;a<c&&0==M[a];a++);for(s<a&&(s=a),w=1,o=1;o<=Le;o++)if(w<<=1,w-=M[o],w<0)return -1;if(w>0&&(0==e||1!=c))return -1;for(F[1]=0,o=1;o<Le;o++)F[o+1]=F[o]+M[o];for(u=0;u<n;u++)0!=t[u]&&(f[F[t[u]]++]=u);switch(e){case 0:I=z=f,L=q.At;break;case 1:I=q.Vt,z=q.Wt,L=q.Ut;break;default:I=q.St,z=q.$t,L=q.Qt;}if(g=0,u=0,o=a,p=_.Tt,h=s,d=0,m=-1,b=1<<s,x=b-1,1==e&&(q.Zt?b>=ue:b>ue)||2==e&&(q.Zt?b>=q.Dt:b>q.Dt))return 1;for(;;){y=Zn(f,u,o,d,e,I,z,L,q.Nt),v=1<<o-d,k=1<<h,a=k;do{k-=v;let e=(g>>d)+k;r.Tt[p+e]={...y};}while(0!=k);for(v=1<<o-1;g&v;)v>>=1;if(0!=v?(g&=v-1,g+=v):g=0,u++,0==--M[o]){if(o==c)break;o=t[f[u]];}if(o>s&&(g&x)!=m){for(0==d&&(d=s),p+=1<<h,h=o-d,w=1<<h;h+d<c&&(w-=M[h+d],!(w<=0));)h++,w<<=1;if(b+=1<<h,1==e&&(q.Zt?b>=ue:b>ue)||2==e&&(q.Zt?b>=q.Dt:b>q.Dt))return 1;m=g&x,r.Tt[_.Tt+m]={_t:h,ft:s,lt:p-_.Tt};}}if(0!=g)for(y=F_(o-d);0!=g;){for(0!=d&&(g&x)!=m&&(d=0,o=s,p=_.Tt,h=s,y.ft=o),r.Tt[p+(g>>d)]={...y},v=1<<o-1;g&v;)v>>=1;0!=v?(g&=v-1,g+=v):g=0;}return _.Tt+=b,i.Tt=s,0}function Zn(e,t,n,r,i,f,_,l,o){let u;if(o?e[t]<l:e[t]+1<l)u=pe(0,n-r,e[t]);else if(o?e[t]>l:e[t]>=l)if(o&&1==i){let i=e[t]-257;u=pe(_[i],n-r,f[i]);}else {let i=o?e[t]:e[t]-l;u=pe(_[i],n-r,f[i]);}else u=jt(n-r);return u}var Qt,$t,Vt=new v(544),Jt=true;function en(e){let t=Ve();return t.l=Z_(t,!!e),t}function Ge(e){let t;return !(e&&(t=e.l,!(!t||t.o!=e||t.Nt&&(t.ot<16191||t.ot>16209)||!t.Nt&&(t.ot<16180||t.ot>16211))))}function Xn(e){let t;return Ge(e)?-2:(t=e.l,e.total_in=e.total_out=t.wt=0,e.msg="",t.G&&(e.i=1&t.G),t.ot=t.Nt?16191:16180,t.ut=false,t.ct=false,t.st=-1,t.ht=t.Nt?65536:32768,delete t.O,t.p=0,t.I=0,t.et=t.Et,t.tt=t.Et,t.It=t.Et,t.it=true,t.Ft=-1,0)}function Wn(e){let t;return Ge(e)?-2:(t=e.l,t.h=0,t.k=0,t.m=0,Xn(e))}function Gn(e,t){let n,r,i;if(Ge(e))return -2;if(r=e.l,r.Nt?(t=-16,i=16):i=15,t<0){if(t<-i)return -2;n=0,t=-t;}else n=5+(t>>4),!r.Nt&&t<48&&(t&=15);return t&&(t<8||t>i)?-2:(r.u.length>0&&r.v!=t&&(r.u=F),r.G=n,r.v=t,Wn(e))}function _n(e,t){let n,r;if(!e)return -2;e.msg="";let i=!!e.l.Nt;return r=Z_(e,i),i&&(t=-16),e.l=r,r.o=e,r.ot=r.Nt?16191:16180,n=Gn(e,t),n}function Kn(e){let t={Tt:0};if(Jt){let n,r,i;for(n=0;n<144;)e.zt[n++]=8;for(;n<256;)e.zt[n++]=9;for(;n<280;)e.zt[n++]=7;for(;n<288;)e.zt[n++]=8;for(let e=0;e<544;e++)Vt[e]=pe();i=Vt,Qt=i,r=9;let f={Tt:i},_={Tt:r},l={Tt:0};for(Oe(1,e.zt,288,f,_,e.Lt,l,e.Nt),i=f.Tt,r=_.Tt,e.Mt=l.Tt,n=0;n<32;)e.zt[n++]=5;r=5;let o=l.Tt,u={Tt:i},a={Tt:r};t.Tt=o,Oe(2,e.zt,32,u,a,e.Lt,t,e.Nt),$t=i.slice(o),Jt=false;}e.et=Qt,e.nt=9,e.tt=$t,e.rt=5,e.Mt=t.Tt;}function qn(e,t,n){let r=e.l;if(!(r.u&&0!=r.u.length||(r.u=new x(1<<r.v),r.u)))return 1;if(0==r.h&&(r.h=1<<r.v,r.m=0,r.k=0),n>=r.h)M(r.u,0,t,t.length-r.h,r.h),r.m=0,r.k=r.h;else {let e=r.h-r.m;e>n&&(e=n),M(r.u,r.m,t,t.length-n,e),(n-=e)?(M(r.u,0,t,t.length-n,n),r.m=n,r.k=r.h):(r.m+=e,r.m==r.h&&(r.m=0),r.k<r.h&&(r.k+=e));}return 0}var h_=class extends z{constructor(){super("Need more input");}};function tn(e,t){let n,r,i,f,_,l,o,u,a,c,s,h,d,w,b,g,v,k=new x(4);if(Ge(e)||!e.next_out||!e.next_in&&0!=e.avail_in)return -2;l=0,u=0,o=0,a=0,r=F,i=0,f=F,_=0,n=e.l,16191==n.ot&&(n.ot=16192),z(),c=l,s=o,v=0;try{for(;;)switch(n.ot){case 16180:if(0==n.G){n.ot=16192;break}if(N(16),2&n.G&&35615==u){0==n.v&&(n.v=15),n.dt=W(0),n.dt=p(n.dt,u),E(),n.ot=16181;break}if(n.O&&(n.O.Bt=-1),!(1&n.G)||((V(8)<<8)+(u>>8))%31){e.msg="incorrect header check",n.ot=16209;break}if(8!=V(4)){e.msg="unknown compression method",n.ot=16209;break}if(S(4),g=V(4)+8,0==n.v&&(n.v=g),g>15||g>n.v){e.msg="invalid window size",n.ot=16209;break}n.ht=1<<g,n.st=0,e.i=n.dt=he(0),n.ot=512&u?16189:16191,E();break;case 16181:if(N(16),n.st=u,8!=(255&n.st)){e.msg="unknown compression method",n.ot=16209;break}if(57344&n.st){e.msg="unknown header flags set",n.ot=16209;break}n.O&&(n.O.Pe=u>>8&1),512&n.st&&4&n.G&&(n.dt=p(n.dt,u)),E(),n.ot=16182;case 16182:N(32),n.O&&(n.O.Ye=u),512&n.st&&4&n.G&&(n.dt=I(n.dt,u)),E(),n.ot=16183;case 16183:N(16),n.O&&(n.O.Rt=255&u,n.O.je=u>>8),512&n.st&&4&n.G&&(n.dt=p(n.dt,u)),E(),n.ot=16184;case 16184:1024&n.st?(N(16),n.bt=u,n.O&&(n.O.Ke=u),512&n.st&&4&n.G&&(n.dt=p(n.dt,u)),E()):n.O&&(n.O.He=F),n.ot=16185;case 16185:if(1024&n.st&&(h=n.bt,h>l&&(h=l),h&&(n.O&&n.O.He&&n.O.Gt&&(g=n.O.Ke-n.bt)<n.O.Gt&&M(n.O.He,g,r,i,h),512&n.st&&4&n.G&&(n.dt=W(n.dt,r.subarray(i,i+h),h)),l-=h,i+=h,n.bt-=h),n.bt))return m();n.bt=0,n.ot=16186;case 16186:if(2048&n.st){if(0==l)return m();h=0;do{g=r[i+h++],n.O&&n.O.Ot&&n.bt<n.O.Ot&&(n.O.Je[n.bt++]=g);}while(g&&h<l);if(512&n.st&&4&n.G&&(n.dt=W(n.dt,r.subarray(i,i+h),h)),l-=h,i+=h,g)return m()}else n.O&&(n.O.Je=F);n.bt=0,n.ot=16187;case 16187:if(4096&n.st){if(0==l)return m();h=0;do{g=r[i+h++],n.O&&n.O.Pt&&n.bt<n.O.Pt&&(n.O.Xe[n.bt++]=g);}while(g&&h<l);if(512&n.st&&4&n.G&&(n.dt=W(n.dt,r.subarray(i,i+h),h)),l-=h,i+=h,g)return m()}else n.O&&(n.O.Xe=F);n.ot=16188;case 16188:if(512&n.st){if(N(16),4&n.G&&u!=(65535&n.dt)){e.msg="header crc mismatch",n.ot=16209;break}E();}n.O&&(n.O.Oe=n.st>>9&1,n.O.Bt=1),e.i=n.dt=W(0),n.ot=16191;break;case 16189:N(32),e.i=n.dt=P_(u),E(),n.ot=16190;case 16190:if(!n.ct)return L(),2;e.i=n.dt=he(0),n.ot=16191;case 16191:if(5==t||6==t)return m();case 16192:if(n.ut){$(),n.ot=16206;break}switch(N(3),n.ut=!!V(1),S(1),V(2)){case 0:n.ot=16193;break;case 1:if(Kn(n),n.ot=16199,6==t)return S(2),m();break;case 2:n.ot=16196;break;case 3:e.msg="invalid block type",n.ot=16209;}S(2);break;case 16193:if($(),N(32),(65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",n.ot=16209;break}if(n.bt=65535&u,E(),n.ot=16194,6==t)return m();case 16194:n.ot=16195;case 16195:if(h=n.bt,h){if(h>l&&(h=l),h>o&&(h=o),0==h)return m();M(f,_,r,i,h),l-=h,i+=h,o-=h,_+=h,n.bt-=h;break}n.ot=16191;break;case 16196:if(N(14),n.kt=V(5)+257,S(5),n.xt=V(5)+1,S(5),n.vt=V(4)+4,S(4),n.kt>286||!n.Nt&&n.xt>30){e.msg=n.Nt?"too many length":"too many length or distance symbols",n.ot=16209;break}n.yt=0,n.ot=16197;case 16197:for(;n.yt<n.vt;)N(3),n.zt[Se[n.yt++]]=V(3),S(3);for(;n.yt<19;)n.zt[Se[n.yt++]]=0;n.It=n.Et,n.et=n.tt=n.It,n.nt=7;let c={Tt:n.It},k={Tt:n.nt},x={Tt:0};if(v=Oe(0,n.zt,19,c,k,n.Lt,x,n.Nt),n.It=c.Tt,n.nt=k.Tt,v){e.msg="invalid code lengths set",n.ot=16209;break}n.yt=0,n.ot=16198;case 16198:for(;n.yt<n.kt+n.xt;){for(;w=n.et[V(n.nt)],!(w.ft<=a);)q();if(w.lt<16)S(w.ft),n.zt[n.yt++]=w.lt;else {if(16==w.lt){if(N(w.ft+2),S(w.ft),0==n.yt){e.msg="invalid bit length repeat",n.ot=16209;break}g=n.zt[n.yt-1],h=3+V(2),S(2);}else 17==w.lt?(N(w.ft+3),S(w.ft),g=0,h=3+V(3),S(3)):(N(w.ft+7),S(w.ft),g=0,h=11+V(7),S(7));if(n.yt+h>n.kt+n.xt){e.msg="invalid bit length repeat",n.ot=16209;break}for(;h--;)n.zt[n.yt++]=g;}}if(16209==n.ot)break;if(0==n.zt[256]){e.msg="invalid code -- missing end-of-block",n.ot=16209;break}n.It=n.Et,n.nt=9;let A={Tt:n.It},U={Tt:n.nt},Q={Tt:0};v=Oe(1,n.zt,n.kt,A,U,n.Lt,Q,n.Nt),n.It=A.Tt,n.nt=U.Tt;let D=Q.Tt;if(n.et=n.It.slice(0,D),v){e.msg="invalid literal/lengths set",n.ot=16209;break}n.rt=6;let Z=n.zt.subarray(n.kt,n.kt+n.xt),C={Tt:n.It},T={Tt:n.rt},B={Tt:D};if(v=Oe(2,Z,n.xt,C,T,n.Lt,B,n.Nt),n.It=C.Tt,n.rt=T.Tt,n.tt=n.It.slice(D),v){e.msg="invalid distances set",n.ot=16209;break}if(n.ot=16199,6==t)return m();case 16199:n.ot=16200;case 16200:if(!n.Nt&&l>=6&&o>=258){L(),qt(e,s),z(),16191==n.ot&&(n.Ft=-1);break}for(n.Ft=0;w=n.et[V(n.nt)],!(w.ft<=a);)q();if(w._t&&!(240&w._t)){for(b=w;w=n.et[b.lt+(V(b.ft+b._t)>>b.ft)],!(b.ft+w.ft<=a);)q();S(b.ft),n.Ft+=b.ft;}if(S(w.ft),n.Ft+=w.ft,n.bt=w.lt,0==w._t){n.ot=16205;break}if(32&w._t){n.Ft=-1,n.ot=16191;break}if(64&w._t){e.msg="invalid literal/length code",n.ot=16209;break}n.He=15&w._t,n.ot=16201;case 16201:n.He&&(N(n.He),n.bt+=V(n.He),S(n.He),n.Ft+=n.He),n.qt=n.bt,n.ot=16202;case 16202:for(;w=n.tt[V(n.rt)],!(w.ft<=a);)q();if(!(240&w._t)){for(b=w;w=n.tt[b.lt+(V(b.ft+b._t)>>b.ft)],!(b.ft+w.ft<=a);)q();S(b.ft),n.Ft+=b.ft;}if(S(w.ft),n.Ft+=w.ft,64&w._t){e.msg="invalid distance code",n.ot=16209;break}n.gt=w.lt,n.He=15&w._t,n.ot=16203;case 16203:n.He&&(N(n.He),n.gt+=V(n.He),S(n.He),n.Ft+=n.He),n.ot=16204;case 16204:if(0==o)return m();if(h=s-o,n.gt>h){if(h=n.gt-h,h>n.k&&n.it){e.msg="invalid distance too far back",n.ot=16209;break}h>n.m?(h-=n.m,d=n.h-h):d=n.m-h,h>n.bt&&(h=n.bt),h>o&&(h=o);for(let e=0;e<h;++e)f[_]=255&n.u[d],++_,++d;}else {d=_-n.gt,h=n.bt,h>o&&(h=o);for(let e=0;e<h;++e)f[_]=f[d],++_,++d;}h>o&&(h=o),o-=h,n.bt-=h,0==n.bt&&(n.ot=16200);break;case 16205:if(0==o)return m();f[_++]=n.bt,o--,n.ot=16200;break;case 16206:if(n.G){if(N(32),s-=o,e.total_out+=s,n.wt+=s,4&n.G&&s){let t=f.subarray(_-s,_);e.i=n.dt=y(n.dt,t,s);}if(s=o,4&n.G&&(n.st?u:P_(u)>>>0)!=n.dt){e.msg="incorrect data check",n.ot=16209;break}E();}n.ot=16207;case 16207:if(n.G&&n.st){if(N(32),4&n.G&&u!=(4294967295&n.wt)){e.msg="incorrect length check",n.ot=16209;break}E();}n.ot=16208;case 16208:return v=1,m();case 16209:return v=-3,m();case 16210:return -4;default:return -2}}catch(e){if(e instanceof h_)return m();throw e}function m(){if(L(),n.h||s!=e.avail_out&&n.ot<16209&&(n.Nt?n.ot<16208:n.ot<16206)||4!=t){let t=s-e.avail_out;if(qn(e,e.next_out.subarray(e.next_out_index-t,e.next_out_index),t))return n.ot=16210,-4}return c-=e.avail_in,s-=e.avail_out,e.total_in+=c,e.total_out+=s,n.wt+=s,4&n.G&&s&&(e.i=n.dt=y(n.dt,e.next_out.subarray(e.next_out_index-s,e.next_out_index),s)),e.t=n.I+(n.ut?64:0)+(16191==n.ot?128:0)+(16199==n.ot||16194==n.ot?256:0),(0==c&&0==s&&0==v||4==t&&0==v)&&(v=-5),v}function y(e,t,r){return n.st?W(e,t,r):he(e,t,r)}function p(e,t){return k[0]=255&t,k[1]=t>>>8&255,W(e,k,2)>>>0}function I(e,t){return k[0]=255&t,k[1]=t>>>8&255,k[2]=t>>>16&255,k[3]=t>>>24&255,W(e,k,4)>>>0}function z(){f=e.next_out,_=e.next_out_index,o=e.avail_out,r=e.next_in,i=e.next_in_index,l=e.avail_in,u=n.p,a=n.I;}function L(){e.next_out=f,e.next_out_index=_,e.avail_out=o,e.next_in=r,e.next_in_index=i,e.avail_in=l,n.p=u,n.I=a;}function E(){u=0,a=0;}function q(){if(0==l)throw new h_;l--,u+=(255&r[i])<<a,i++,u>>>=0,a+=8;}function N(e){for(;a<e;)q();}function V(e){return u&(1<<e)-1}function S(e){u>>>=e,a-=e;}function $(){u>>>=7&a,a-=7&a;}}function nn(e){return Ge(e)?-2:0}var M_=65536,jn=32768,Y_=class{constructor(e=16,t=M_){this.Ht=[],this.Jt=e;for(let n=0;n<N.min(e,4);n++)this.Ht.push(new x(t));}acquire(e=M_){for(let t=this.Ht.length-1;t>=0;t--){let n=this.Ht[t];if(n.length>=e)return this.Ht.splice(t,1),n}return new x(e)}release(e){this.Ht.length<this.Jt&&this.Ht.push(e);}};function rn(e){let t=new Y_(32,M_),n=null;function r(e){try{t.release(e);}catch{}}return new U({start(){},transform(i,f){if(!n){let t=e.Xt(),r=e.Yt(t);if(0!=r&&0!=r)throw new z("init failed: "+r);n={o:t};}let _=n.o,l=0;for(;l<i.length;){let n=N.min(i.length-l,jn),o=i.subarray(l,l+n);for(_.next_in=o,_.next_in_index=0,_.avail_in=o.length;_.avail_in>0;){let n=t.acquire(),i=false;try{_.next_out=n,_.next_out_index=0,_.avail_out=n.length;let r=e.jt(_,0),l=n.length-_.avail_out;if(l>0){let e=!1,r={Kt:n.subarray(0,l),release:()=>{e||(e=!0,t.release(n));}};i=!0,f.enqueue(r);}if(0!=r&&1!=r)throw new z("process error: "+r)}finally{i||r(n);}}l+=n;}},flush(i){if(!n)return;let f=n.o;for(;;){let n=t.acquire(),_=false;try{f.next_out=n,f.next_out_index=0,f.avail_out=n.length;let r=e.jt(f,4),l=n.length-f.avail_out;if(l>0){let e=!1,r={Kt:n.subarray(0,l),release:()=>{e||(e=!0,t.release(n));}};_=!0,i.enqueue(r);}if(1==r)break;if(0!=r)throw new z("finalization error: "+r)}finally{_||r(n);}}let _=e.en(f);if(0!=_&&0!=_)throw new z("end failed: "+_)}})}function an(){return new U({start(){},transform(e,t){try{t.enqueue(e.Kt.slice(0));}finally{e.release();}},flush(){}})}function Vn(e="deflate",t){let n="gzip"==e?31:"deflate-raw"==e?-15:15,r=t&&"number"==typeof t.level?t.level:-1;return rn({Xt:()=>wt(),Yt:e=>Dt(e,r,8,n,8,0),jt:yt,en:B_})}function Jn(e="deflate"){let t="gzip"==e?31:"deflate-raw"==e?-15:15;return rn({Xt:()=>en("deflate64-raw"==e),Yt:e=>_n(e,t),jt:tn,en:nn})}var s_=class{constructor(e="deflate",t){let n=Vn(e,t);this.writable=n.writable,this.readable=n.readable.pipeThrough(an());}},x_=class{constructor(e="deflate"){let t=Jn(e);this.writable=t.writable,this.readable=t.readable.pipeThrough(an());}};
  5485. /*
  5486. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  5487. Redistribution and use in source and binary forms, with or without
  5488. modification, are permitted provided that the following conditions are met:
  5489. 1. Redistributions of source code must retain the above copyright notice,
  5490. this list of conditions and the following disclaimer.
  5491. 2. Redistributions in binary form must reproduce the above copyright
  5492. notice, this list of conditions and the following disclaimer in
  5493. the documentation and/or other materials provided with the distribution.
  5494. 3. The names of the authors may not be used to endorse or promote products
  5495. derived from this software without specific prior written permission.
  5496. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  5497. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  5498. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  5499. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  5500. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  5501. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  5502. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  5503. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  5504. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  5505. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5506. */
  5507. configure({
  5508. workerURI: "./core/web-worker-native.js",
  5509. wasmURI: null,
  5510. CompressionStreamZlib: s_,
  5511. DecompressionStreamZlib: x_
  5512. });
  5513. /*
  5514. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  5515. Redistribution and use in source and binary forms, with or without
  5516. modification, are permitted provided that the following conditions are met:
  5517. 1. Redistributions of source code must retain the above copyright notice,
  5518. this list of conditions and the following disclaimer.
  5519. 2. Redistributions in binary form must reproduce the above copyright
  5520. notice, this list of conditions and the following disclaimer in
  5521. the documentation and/or other materials provided with the distribution.
  5522. 3. The names of the authors may not be used to endorse or promote products
  5523. derived from this software without specific prior written permission.
  5524. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  5525. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  5526. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  5527. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  5528. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  5529. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  5530. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  5531. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  5532. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  5533. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  5534. */
  5535. class ZipEntry {
  5536. constructor(fs, name, params, parent) {
  5537. const zipEntry = this;
  5538. if (fs.root && parent && parent.getChildByName(name)) {
  5539. throw new Error("Entry filename already exists");
  5540. }
  5541. if (!params) {
  5542. params = {};
  5543. }
  5544. Object.assign(zipEntry, {
  5545. fs,
  5546. name,
  5547. data: params.data,
  5548. options: params.options,
  5549. id: fs.entries.length,
  5550. parent,
  5551. children: [],
  5552. uncompressedSize: params.uncompressedSize || 0,
  5553. passThrough: params.passThrough
  5554. });
  5555. fs.entries.push(zipEntry);
  5556. if (parent) {
  5557. zipEntry.parent.children.push(zipEntry);
  5558. }
  5559. }
  5560. moveTo(target) {
  5561. // deprecated
  5562. const zipEntry = this;
  5563. zipEntry.fs.move(zipEntry, target);
  5564. }
  5565. getFullname() {
  5566. return this.getRelativeName();
  5567. }
  5568. getRelativeName(ancestor = this.fs.root) {
  5569. const zipEntry = this;
  5570. let relativeName = zipEntry.name;
  5571. let entry = zipEntry.parent;
  5572. while (entry && entry != ancestor) {
  5573. relativeName = (entry.name ? entry.name + "/" : "") + relativeName;
  5574. entry = entry.parent;
  5575. }
  5576. return relativeName;
  5577. }
  5578. isDescendantOf(ancestor) {
  5579. let entry = this.parent;
  5580. while (entry && entry.id != ancestor.id) {
  5581. entry = entry.parent;
  5582. }
  5583. return Boolean(entry);
  5584. }
  5585. rename(name) {
  5586. const parent = this.parent;
  5587. if (parent && parent.getChildByName(name)) {
  5588. throw new Error("Entry filename already exists");
  5589. } else {
  5590. this.name = name;
  5591. }
  5592. }
  5593. }
  5594. class ZipFileEntry extends ZipEntry {
  5595. constructor(fs, name, params, parent) {
  5596. super(fs, name, params, parent);
  5597. const zipEntry = this;
  5598. zipEntry.Reader = params.Reader;
  5599. zipEntry.Writer = params.Writer;
  5600. if (params.getData) {
  5601. zipEntry.getData = params.getData;
  5602. }
  5603. }
  5604. clone() {
  5605. return new ZipFileEntry(this.fs, this.name, this);
  5606. }
  5607. async getData(writer, options = {}) {
  5608. const zipEntry = this;
  5609. if (!writer || (writer.constructor == zipEntry.Writer && zipEntry.data)) {
  5610. return zipEntry.data;
  5611. } else {
  5612. const reader = zipEntry.reader = new zipEntry.Reader(zipEntry.data, options);
  5613. const uncompressedSize = zipEntry.data ? zipEntry.data.uncompressedSize : reader.size;
  5614. await Promise.all([initStream(reader), initStream(writer, uncompressedSize)]);
  5615. const { readable } = reader;
  5616. zipEntry.uncompressedSize = reader.size;
  5617. await readable.pipeTo(writer.writable);
  5618. return writer.getData ? writer.getData() : writer.writable;
  5619. }
  5620. }
  5621. isPasswordProtected() {
  5622. return this.data.encrypted;
  5623. }
  5624. async checkPassword(password, options = {}) {
  5625. const zipEntry = this;
  5626. if (zipEntry.isPasswordProtected()) {
  5627. options.password = password;
  5628. options.checkPasswordOnly = true;
  5629. try {
  5630. await zipEntry.data.getData(null, options);
  5631. return true;
  5632. } catch (error) {
  5633. if (error.message == ERR_INVALID_PASSWORD) {
  5634. return false;
  5635. } else {
  5636. throw error;
  5637. }
  5638. }
  5639. } else {
  5640. return true;
  5641. }
  5642. }
  5643. getText(encoding, options) {
  5644. return this.getData(new TextWriter(encoding), options);
  5645. }
  5646. getBlob(mimeType, options) {
  5647. return this.getData(new BlobWriter(mimeType), options);
  5648. }
  5649. getData64URI(mimeType, options) {
  5650. return this.getData(new Data64URIWriter(mimeType), options);
  5651. }
  5652. getUint8Array(options) {
  5653. return this.getData(new Uint8ArrayWriter(), options);
  5654. }
  5655. getWritable(writable = new WritableStream(), options) {
  5656. return this.getData({ writable }, options);
  5657. }
  5658. getArrayBuffer(options) {
  5659. return this.data.arrayBuffer(options);
  5660. }
  5661. replaceBlob(blob) {
  5662. Object.assign(this, {
  5663. data: blob,
  5664. Reader: BlobReader,
  5665. Writer: BlobWriter,
  5666. reader: null
  5667. });
  5668. }
  5669. replaceText(text) {
  5670. Object.assign(this, {
  5671. data: text,
  5672. Reader: TextReader,
  5673. Writer: TextWriter,
  5674. reader: null
  5675. });
  5676. }
  5677. replaceData64URI(dataURI) {
  5678. Object.assign(this, {
  5679. data: dataURI,
  5680. Reader: Data64URIReader,
  5681. Writer: Data64URIWriter,
  5682. reader: null
  5683. });
  5684. }
  5685. replaceUint8Array(array) {
  5686. Object.assign(this, {
  5687. data: array,
  5688. Reader: Uint8ArrayReader,
  5689. Writer: Uint8ArrayWriter,
  5690. reader: null
  5691. });
  5692. }
  5693. replaceReadable(readable) {
  5694. Object.assign(this, {
  5695. data: null,
  5696. Reader: function () { return { readable }; },
  5697. Writer: null,
  5698. reader: null
  5699. });
  5700. }
  5701. }
  5702. class ZipDirectoryEntry extends ZipEntry {
  5703. constructor(fs, name, params, parent) {
  5704. super(fs, name, params, parent);
  5705. this.directory = true;
  5706. }
  5707. clone(deepClone) {
  5708. const zipEntry = this;
  5709. const clonedEntry = new ZipDirectoryEntry(zipEntry.fs, zipEntry.name);
  5710. if (deepClone) {
  5711. clonedEntry.children = zipEntry.children.map(child => {
  5712. const childClone = child.clone(deepClone);
  5713. childClone.parent = clonedEntry;
  5714. return childClone;
  5715. });
  5716. }
  5717. return clonedEntry;
  5718. }
  5719. addDirectory(name, options) {
  5720. return addChild(this, name, { options }, true);
  5721. }
  5722. addText(name, text, options = {}) {
  5723. return addChild(this, name, {
  5724. data: text,
  5725. Reader: TextReader,
  5726. Writer: TextWriter,
  5727. options,
  5728. uncompressedSize: text.length
  5729. });
  5730. }
  5731. addBlob(name, blob, options = {}) {
  5732. return addChild(this, name, {
  5733. data: blob,
  5734. Reader: BlobReader,
  5735. Writer: BlobWriter,
  5736. options,
  5737. uncompressedSize: blob.size
  5738. });
  5739. }
  5740. addData64URI(name, dataURI, options = {}) {
  5741. let dataEnd = dataURI.length;
  5742. while (dataURI.charAt(dataEnd - 1) == "=") {
  5743. dataEnd--;
  5744. }
  5745. const dataStart = dataURI.indexOf(",") + 1;
  5746. return addChild(this, name, {
  5747. data: dataURI,
  5748. Reader: Data64URIReader,
  5749. Writer: Data64URIWriter,
  5750. options,
  5751. uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
  5752. });
  5753. }
  5754. addUint8Array(name, array, options = {}) {
  5755. return addChild(this, name, {
  5756. data: array,
  5757. Reader: Uint8ArrayReader,
  5758. Writer: Uint8ArrayWriter,
  5759. options,
  5760. uncompressedSize: array.length
  5761. });
  5762. }
  5763. addHttpContent(name, url, options = {}) {
  5764. return addChild(this, name, {
  5765. data: url,
  5766. Reader: class extends HttpReader {
  5767. constructor(url) {
  5768. super(url, options);
  5769. }
  5770. },
  5771. options
  5772. });
  5773. }
  5774. addReadable(name, readable, options = {}) {
  5775. return addChild(this, name, {
  5776. Reader: function () { return { readable }; },
  5777. options
  5778. });
  5779. }
  5780. addFileSystemEntry(fileSystemEntry, options = {}) {
  5781. return addFileSystemHandle(this, fileSystemEntry, options);
  5782. }
  5783. addFileSystemHandle(handle, options = {}) {
  5784. return addFileSystemHandle(this, handle, options);
  5785. }
  5786. addFile(file, options = {}) {
  5787. if (!options.lastModDate) {
  5788. options.lastModDate = new Date(file.lastModified);
  5789. }
  5790. return addChild(this, file.name, {
  5791. data: file,
  5792. Reader: function () {
  5793. const readable = file.stream();
  5794. const size = file.size;
  5795. return { readable, size };
  5796. },
  5797. options,
  5798. uncompressedSize: file.size
  5799. });
  5800. }
  5801. addData(name, params) {
  5802. return addChild(this, name, params);
  5803. }
  5804. importBlob(blob, options) {
  5805. return this.importZip(new BlobReader(blob), options);
  5806. }
  5807. importData64URI(dataURI, options) {
  5808. return this.importZip(new Data64URIReader(dataURI), options);
  5809. }
  5810. importUint8Array(array, options) {
  5811. return this.importZip(new Uint8ArrayReader(array), options);
  5812. }
  5813. importHttpContent(url, options) {
  5814. return this.importZip(new HttpReader(url, options), options);
  5815. }
  5816. importReadable(readable, options) {
  5817. return this.importZip({ readable }, options);
  5818. }
  5819. exportBlob(options = {}) {
  5820. return this.exportZip(new BlobWriter(options.mimeType || "application/zip"), options);
  5821. }
  5822. exportData64URI(options = {}) {
  5823. return this.exportZip(new Data64URIWriter(options.mimeType || "application/zip"), options);
  5824. }
  5825. exportUint8Array(options = {}) {
  5826. return this.exportZip(new Uint8ArrayWriter(), options);
  5827. }
  5828. async exportWritable(writable = new WritableStream(), options = {}) {
  5829. await this.exportZip({ writable }, options);
  5830. return writable;
  5831. }
  5832. async importZip(reader, options = {}) {
  5833. await initStream(reader);
  5834. const zipReader = new ZipReader(reader, options);
  5835. const importedEntries = [];
  5836. const entries = await zipReader.getEntries();
  5837. for (const entry of entries) {
  5838. let parent = this;
  5839. try {
  5840. const path = entry.filename.split("/");
  5841. const name = path.pop();
  5842. path.forEach((pathPart, pathIndex) => {
  5843. const previousParent = parent;
  5844. parent = parent.getChildByName(pathPart);
  5845. if (!parent) {
  5846. parent = new ZipDirectoryEntry(this.fs, pathPart, { data: pathIndex == path.length - 1 ? entry : null }, previousParent);
  5847. importedEntries.push(parent);
  5848. }
  5849. });
  5850. if (!entry.directory) {
  5851. importedEntries.push(addChild(parent, name, {
  5852. data: entry,
  5853. Reader: getZipBlobReader(Object.assign({}, options)),
  5854. uncompressedSize: entry.uncompressedSize,
  5855. passThrough: options.passThrough
  5856. }));
  5857. }
  5858. } catch (error) {
  5859. try {
  5860. error.cause = {
  5861. entry
  5862. };
  5863. } catch {
  5864. // ignored
  5865. }
  5866. throw error;
  5867. }
  5868. }
  5869. return importedEntries;
  5870. }
  5871. async exportZip(writer, options) {
  5872. const zipEntry = this;
  5873. if (options.bufferedWrite === UNDEFINED_VALUE) {
  5874. options.bufferedWrite = true;
  5875. }
  5876. await Promise.all([initReaders(zipEntry, options.readerOptions), initStream(writer)]);
  5877. const zipWriter = new ZipWriter(writer, options);
  5878. await exportZip(zipWriter, zipEntry, getTotalSize([zipEntry], "uncompressedSize"), options);
  5879. await zipWriter.close();
  5880. return writer.getData ? writer.getData() : writer.writable;
  5881. }
  5882. getChildByName(name) {
  5883. const children = this.children;
  5884. for (let childIndex = 0; childIndex < children.length; childIndex++) {
  5885. const child = children[childIndex];
  5886. if (child.name == name) {
  5887. return child;
  5888. }
  5889. }
  5890. }
  5891. isPasswordProtected() {
  5892. const children = this.children;
  5893. for (let childIndex = 0; childIndex < children.length; childIndex++) {
  5894. const child = children[childIndex];
  5895. if (child.isPasswordProtected()) {
  5896. return true;
  5897. }
  5898. }
  5899. return false;
  5900. }
  5901. async checkPassword(password, options = {}) {
  5902. const children = this.children;
  5903. const result = await Promise.all(children.map(child => child.checkPassword(password, options)));
  5904. return !result.includes(false);
  5905. }
  5906. }
  5907. class FS {
  5908. constructor() {
  5909. resetFS(this);
  5910. }
  5911. get children() {
  5912. return this.root.children;
  5913. }
  5914. remove(entry) {
  5915. detach(entry);
  5916. this.entries[entry.id] = null;
  5917. }
  5918. move(entry, destination) {
  5919. if (entry == this.root) {
  5920. throw new Error("Root directory cannot be moved");
  5921. } else {
  5922. if (destination.directory) {
  5923. if (!destination.isDescendantOf(entry)) {
  5924. if (entry != destination) {
  5925. if (destination.getChildByName(entry.name)) {
  5926. throw new Error("Entry filename already exists");
  5927. }
  5928. detach(entry);
  5929. entry.parent = destination;
  5930. destination.children.push(entry);
  5931. }
  5932. } else {
  5933. throw new Error("Entry is a ancestor of target entry");
  5934. }
  5935. } else {
  5936. throw new Error("Target entry is not a directory");
  5937. }
  5938. }
  5939. }
  5940. find(fullname) {
  5941. const path = fullname.split("/");
  5942. let node = this.root;
  5943. for (let index = 0; node && index < path.length; index++) {
  5944. node = node.getChildByName(path[index]);
  5945. }
  5946. return node;
  5947. }
  5948. getById(id) {
  5949. return this.entries[id];
  5950. }
  5951. getChildByName(name) {
  5952. return this.root.getChildByName(name);
  5953. }
  5954. addDirectory(name, options) {
  5955. return this.root.addDirectory(name, options);
  5956. }
  5957. addText(name, text, options) {
  5958. return this.root.addText(name, text, options);
  5959. }
  5960. addBlob(name, blob, options) {
  5961. return this.root.addBlob(name, blob, options);
  5962. }
  5963. addData64URI(name, dataURI, options) {
  5964. return this.root.addData64URI(name, dataURI, options);
  5965. }
  5966. addUint8Array(name, array, options) {
  5967. return this.root.addUint8Array(name, array, options);
  5968. }
  5969. addHttpContent(name, url, options) {
  5970. return this.root.addHttpContent(name, url, options);
  5971. }
  5972. addReadable(name, readable, options) {
  5973. return this.root.addReadable(name, readable, options);
  5974. }
  5975. addFileSystemEntry(fileSystemEntry, options) {
  5976. return this.root.addFileSystemEntry(fileSystemEntry, options);
  5977. }
  5978. addFileSystemHandle(handle, options) {
  5979. return this.root.addFileSystemHandle(handle, options);
  5980. }
  5981. addFile(file, options) {
  5982. return this.root.addFile(file, options);
  5983. }
  5984. addData(name, params) {
  5985. return this.root.addData(name, params);
  5986. }
  5987. importBlob(blob, options) {
  5988. resetFS(this);
  5989. return this.root.importBlob(blob, options);
  5990. }
  5991. importData64URI(dataURI, options) {
  5992. resetFS(this);
  5993. return this.root.importData64URI(dataURI, options);
  5994. }
  5995. importUint8Array(array, options) {
  5996. resetFS(this);
  5997. return this.root.importUint8Array(array, options);
  5998. }
  5999. importHttpContent(url, options) {
  6000. resetFS(this);
  6001. return this.root.importHttpContent(url, options);
  6002. }
  6003. importReadable(readable, options) {
  6004. resetFS(this);
  6005. return this.root.importReadable(readable, options);
  6006. }
  6007. importZip(reader, options) {
  6008. return this.root.importZip(reader, options);
  6009. }
  6010. exportBlob(options) {
  6011. return this.root.exportBlob(options);
  6012. }
  6013. exportData64URI(options) {
  6014. return this.root.exportData64URI(options);
  6015. }
  6016. exportUint8Array(options) {
  6017. return this.root.exportUint8Array(options);
  6018. }
  6019. exportWritable(writable, options) {
  6020. return this.root.exportWritable(writable, options);
  6021. }
  6022. isPasswordProtected() {
  6023. return this.root.isPasswordProtected();
  6024. }
  6025. checkPassword(password, options) {
  6026. return this.root.checkPassword(password, options);
  6027. }
  6028. }
  6029. const fs = { FS, ZipDirectoryEntry, ZipFileEntry };
  6030. function getTotalSize(entries, propertyName) {
  6031. let size = 0;
  6032. entries.forEach(process);
  6033. return size;
  6034. function process(entry) {
  6035. size += entry[propertyName];
  6036. if (entry.children) {
  6037. entry.children.forEach(process);
  6038. }
  6039. }
  6040. }
  6041. function getZipBlobReader(options) {
  6042. return class extends Reader {
  6043. constructor(entry, options = {}) {
  6044. super();
  6045. this.entry = entry;
  6046. this.options = options;
  6047. }
  6048. async init() {
  6049. const zipBlobReader = this;
  6050. zipBlobReader.size = zipBlobReader.entry.uncompressedSize;
  6051. const data = await zipBlobReader.entry.getData(new BlobWriter(), Object.assign({}, zipBlobReader.options, options));
  6052. zipBlobReader.data = data;
  6053. zipBlobReader.blobReader = new BlobReader(data);
  6054. super.init();
  6055. }
  6056. readUint8Array(index, length) {
  6057. return this.blobReader.readUint8Array(index, length);
  6058. }
  6059. };
  6060. }
  6061. async function initReaders(entry, options) {
  6062. if (entry.children.length) {
  6063. await Promise.all(entry.children.map(async child => {
  6064. if (child.directory) {
  6065. await initReaders(child, options);
  6066. } else {
  6067. const reader = child.reader = new child.Reader(child.data, options);
  6068. try {
  6069. await initStream(reader);
  6070. } catch (error) {
  6071. try {
  6072. error.entryId = child.id;
  6073. error.cause = {
  6074. entry: child
  6075. };
  6076. } catch {
  6077. // ignored
  6078. }
  6079. throw error;
  6080. }
  6081. child.uncompressedSize = reader.size;
  6082. }
  6083. }));
  6084. }
  6085. }
  6086. function detach(entry) {
  6087. if (entry.parent) {
  6088. const children = entry.parent.children;
  6089. children.forEach((child, index) => {
  6090. if (child.id == entry.id) {
  6091. children.splice(index, 1);
  6092. }
  6093. });
  6094. }
  6095. }
  6096. async function exportZip(zipWriter, entry, totalSize, options) {
  6097. const selectedEntry = entry;
  6098. const entryOffsets = new Map();
  6099. await process(zipWriter, entry);
  6100. async function process(zipWriter, entry) {
  6101. await exportChild();
  6102. async function exportChild() {
  6103. if (options.bufferedWrite) {
  6104. await Promise.allSettled(entry.children.map(processChild));
  6105. } else {
  6106. for (const child of entry.children) {
  6107. await processChild(child);
  6108. }
  6109. }
  6110. }
  6111. async function processChild(child) {
  6112. const name = options.relativePath ? child.getRelativeName(selectedEntry) : child.getFullname();
  6113. const childOptions = child.options || {};
  6114. let zipEntryOptions = {};
  6115. if (child.data instanceof Entry) {
  6116. const {
  6117. externalFileAttributes,
  6118. versionMadeBy,
  6119. comment,
  6120. lastModDate,
  6121. creationDate,
  6122. lastAccessDate,
  6123. uncompressedSize,
  6124. encrypted,
  6125. zipCrypto,
  6126. signature,
  6127. compressionMethod,
  6128. extraFieldAES
  6129. } = child.data;
  6130. zipEntryOptions = {
  6131. externalFileAttributes,
  6132. versionMadeBy,
  6133. comment,
  6134. lastModDate,
  6135. creationDate,
  6136. lastAccessDate
  6137. };
  6138. if (child.passThrough) {
  6139. let level, encryptionStrength;
  6140. if (compressionMethod === 0) {
  6141. level = 0;
  6142. }
  6143. if (extraFieldAES) {
  6144. encryptionStrength = extraFieldAES.strength;
  6145. }
  6146. zipEntryOptions = Object.assign(zipEntryOptions, {
  6147. passThrough: true,
  6148. encrypted,
  6149. zipCrypto,
  6150. signature,
  6151. uncompressedSize,
  6152. level,
  6153. encryptionStrength,
  6154. compressionMethod
  6155. });
  6156. }
  6157. }
  6158. await zipWriter.add(name, child.reader, Object.assign({}, options, zipEntryOptions, childOptions, {
  6159. directory: child.directory,
  6160. onprogress: async indexProgress => {
  6161. if (options.onprogress) {
  6162. entryOffsets.set(name, indexProgress);
  6163. try {
  6164. await options.onprogress(Array.from(entryOffsets.values()).reduce((previousValue, currentValue) => previousValue + currentValue), totalSize);
  6165. } catch {
  6166. // ignored
  6167. }
  6168. }
  6169. }
  6170. }));
  6171. await process(zipWriter, child);
  6172. }
  6173. }
  6174. }
  6175. function addFileSystemHandle(zipEntry, handle, options) {
  6176. return addFile(zipEntry, handle, []);
  6177. async function addFile(parentEntry, handle, addedEntries) {
  6178. if (handle) {
  6179. try {
  6180. if (handle.isFile || handle.isDirectory) {
  6181. handle = await transformToFileSystemhandle(handle);
  6182. }
  6183. if (handle.kind == "file") {
  6184. const file = await handle.getFile();
  6185. addedEntries.push(
  6186. parentEntry.addData(file.name, {
  6187. Reader: function () {
  6188. const readable = file.stream();
  6189. const size = file.size;
  6190. return { readable, size };
  6191. },
  6192. options: Object.assign({}, { lastModDate: new Date(file.lastModified) }, options),
  6193. uncompressedSize: file.size
  6194. })
  6195. );
  6196. } else if (handle.kind == "directory") {
  6197. const directoryEntry = parentEntry.addDirectory(handle.name);
  6198. addedEntries.push(directoryEntry);
  6199. for await (const childHandle of handle.values()) {
  6200. await addFile(directoryEntry, childHandle, addedEntries);
  6201. }
  6202. }
  6203. } catch (error) {
  6204. const message = error.message + (handle ? " (" + handle.name + ")" : "");
  6205. throw new Error(message);
  6206. }
  6207. }
  6208. return addedEntries;
  6209. }
  6210. }
  6211. async function transformToFileSystemhandle(entry) {
  6212. const handle = {
  6213. name: entry.name
  6214. };
  6215. if (entry.isFile) {
  6216. handle.kind = "file";
  6217. handle.getFile = () =>
  6218. new Promise((resolve, reject) => entry.file(resolve, reject));
  6219. }
  6220. if (entry.isDirectory) {
  6221. handle.kind = "directory";
  6222. const handles = await transformToFileSystemhandles(entry);
  6223. handle.values = () => handles;
  6224. }
  6225. return handle;
  6226. }
  6227. async function transformToFileSystemhandles(entry) {
  6228. const entries = [];
  6229. function readEntries(directoryReader, resolve, reject) {
  6230. directoryReader.readEntries(async (entriesPart) => {
  6231. if (!entriesPart.length) {
  6232. resolve(entries);
  6233. } else {
  6234. for (const entry of entriesPart) {
  6235. entries.push(await transformToFileSystemhandle(entry));
  6236. }
  6237. readEntries(directoryReader, resolve, reject);
  6238. }
  6239. }, reject);
  6240. }
  6241. await new Promise((resolve, reject) =>
  6242. readEntries(entry.createReader(), resolve, reject)
  6243. );
  6244. return {
  6245. [Symbol.iterator]() {
  6246. let entryIndex = 0;
  6247. return {
  6248. next() {
  6249. const result = {
  6250. value: entries[entryIndex],
  6251. done: entryIndex == entries.length
  6252. };
  6253. entryIndex++;
  6254. return result;
  6255. }
  6256. };
  6257. }
  6258. };
  6259. }
  6260. function resetFS(fs) {
  6261. fs.entries = [];
  6262. fs.root = new ZipDirectoryEntry(fs);
  6263. }
  6264. function addChild(parent, name, params, directory) {
  6265. if (parent.directory) {
  6266. return directory ? new ZipDirectoryEntry(parent.fs, name, params, parent) : new ZipFileEntry(parent.fs, name, params, parent);
  6267. } else {
  6268. throw new Error("Parent entry is not a directory");
  6269. }
  6270. }
  6271. /*
  6272. Copyright (c) 2022 Gildas Lormeau. All rights reserved.
  6273. Redistribution and use in source and binary forms, with or without
  6274. modification, are permitted provided that the following conditions are met:
  6275. 1. Redistributions of source code must retain the above copyright notice,
  6276. this list of conditions and the following disclaimer.
  6277. 2. Redistributions in binary form must reproduce the above copyright
  6278. notice, this list of conditions and the following disclaimer in
  6279. the documentation and/or other materials provided with the distribution.
  6280. 3. The names of the authors may not be used to endorse or promote products
  6281. derived from this software without specific prior written permission.
  6282. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  6283. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  6284. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  6285. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  6286. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  6287. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  6288. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  6289. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  6290. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  6291. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6292. */
  6293. const table = {
  6294. "application": {
  6295. "andrew-inset": "ez",
  6296. "annodex": "anx",
  6297. "atom+xml": "atom",
  6298. "atomcat+xml": "atomcat",
  6299. "atomserv+xml": "atomsrv",
  6300. "bbolin": "lin",
  6301. "cu-seeme": "cu",
  6302. "davmount+xml": "davmount",
  6303. "dsptype": "tsp",
  6304. "ecmascript": [
  6305. "es",
  6306. "ecma"
  6307. ],
  6308. "futuresplash": "spl",
  6309. "hta": "hta",
  6310. "java-archive": "jar",
  6311. "java-serialized-object": "ser",
  6312. "java-vm": "class",
  6313. "m3g": "m3g",
  6314. "mac-binhex40": "hqx",
  6315. "mathematica": [
  6316. "nb",
  6317. "ma",
  6318. "mb"
  6319. ],
  6320. "msaccess": "mdb",
  6321. "msword": [
  6322. "doc",
  6323. "dot",
  6324. "wiz"
  6325. ],
  6326. "mxf": "mxf",
  6327. "oda": "oda",
  6328. "ogg": "ogx",
  6329. "pdf": "pdf",
  6330. "pgp-keys": "key",
  6331. "pgp-signature": [
  6332. "asc",
  6333. "sig"
  6334. ],
  6335. "pics-rules": "prf",
  6336. "postscript": [
  6337. "ps",
  6338. "ai",
  6339. "eps",
  6340. "epsi",
  6341. "epsf",
  6342. "eps2",
  6343. "eps3"
  6344. ],
  6345. "rar": "rar",
  6346. "rdf+xml": "rdf",
  6347. "rss+xml": "rss",
  6348. "rtf": "rtf",
  6349. "xhtml+xml": [
  6350. "xhtml",
  6351. "xht"
  6352. ],
  6353. "xml": [
  6354. "xml",
  6355. "xsl",
  6356. "xsd",
  6357. "xpdl"
  6358. ],
  6359. "xspf+xml": "xspf",
  6360. "zip": "zip",
  6361. "vnd.android.package-archive": "apk",
  6362. "vnd.cinderella": "cdy",
  6363. "vnd.google-earth.kml+xml": "kml",
  6364. "vnd.google-earth.kmz": "kmz",
  6365. "vnd.mozilla.xul+xml": "xul",
  6366. "vnd.ms-excel": [
  6367. "xls",
  6368. "xlb",
  6369. "xlt",
  6370. "xlm",
  6371. "xla",
  6372. "xlc",
  6373. "xlw"
  6374. ],
  6375. "vnd.ms-pki.seccat": "cat",
  6376. "vnd.ms-pki.stl": "stl",
  6377. "vnd.ms-powerpoint": [
  6378. "ppt",
  6379. "pps",
  6380. "pot",
  6381. "ppa",
  6382. "pwz"
  6383. ],
  6384. "vnd.oasis.opendocument.chart": "odc",
  6385. "vnd.oasis.opendocument.database": "odb",
  6386. "vnd.oasis.opendocument.formula": "odf",
  6387. "vnd.oasis.opendocument.graphics": "odg",
  6388. "vnd.oasis.opendocument.graphics-template": "otg",
  6389. "vnd.oasis.opendocument.image": "odi",
  6390. "vnd.oasis.opendocument.presentation": "odp",
  6391. "vnd.oasis.opendocument.presentation-template": "otp",
  6392. "vnd.oasis.opendocument.spreadsheet": "ods",
  6393. "vnd.oasis.opendocument.spreadsheet-template": "ots",
  6394. "vnd.oasis.opendocument.text": "odt",
  6395. "vnd.oasis.opendocument.text-master": [
  6396. "odm",
  6397. "otm"
  6398. ],
  6399. "vnd.oasis.opendocument.text-template": "ott",
  6400. "vnd.oasis.opendocument.text-web": "oth",
  6401. "vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
  6402. "vnd.openxmlformats-officedocument.spreadsheetml.template": "xltx",
  6403. "vnd.openxmlformats-officedocument.presentationml.presentation": "pptx",
  6404. "vnd.openxmlformats-officedocument.presentationml.slideshow": "ppsx",
  6405. "vnd.openxmlformats-officedocument.presentationml.template": "potx",
  6406. "vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
  6407. "vnd.openxmlformats-officedocument.wordprocessingml.template": "dotx",
  6408. "vnd.smaf": "mmf",
  6409. "vnd.stardivision.calc": "sdc",
  6410. "vnd.stardivision.chart": "sds",
  6411. "vnd.stardivision.draw": "sda",
  6412. "vnd.stardivision.impress": "sdd",
  6413. "vnd.stardivision.math": [
  6414. "sdf",
  6415. "smf"
  6416. ],
  6417. "vnd.stardivision.writer": [
  6418. "sdw",
  6419. "vor"
  6420. ],
  6421. "vnd.stardivision.writer-global": "sgl",
  6422. "vnd.sun.xml.calc": "sxc",
  6423. "vnd.sun.xml.calc.template": "stc",
  6424. "vnd.sun.xml.draw": "sxd",
  6425. "vnd.sun.xml.draw.template": "std",
  6426. "vnd.sun.xml.impress": "sxi",
  6427. "vnd.sun.xml.impress.template": "sti",
  6428. "vnd.sun.xml.math": "sxm",
  6429. "vnd.sun.xml.writer": "sxw",
  6430. "vnd.sun.xml.writer.global": "sxg",
  6431. "vnd.sun.xml.writer.template": "stw",
  6432. "vnd.symbian.install": [
  6433. "sis",
  6434. "sisx"
  6435. ],
  6436. "vnd.visio": [
  6437. "vsd",
  6438. "vst",
  6439. "vss",
  6440. "vsw",
  6441. "vsdx",
  6442. "vssx",
  6443. "vstx",
  6444. "vssm",
  6445. "vstm"
  6446. ],
  6447. "vnd.wap.wbxml": "wbxml",
  6448. "vnd.wap.wmlc": "wmlc",
  6449. "vnd.wap.wmlscriptc": "wmlsc",
  6450. "vnd.wordperfect": "wpd",
  6451. "vnd.wordperfect5.1": "wp5",
  6452. "x-123": "wk",
  6453. "x-7z-compressed": "7z",
  6454. "x-abiword": "abw",
  6455. "x-apple-diskimage": "dmg",
  6456. "x-bcpio": "bcpio",
  6457. "x-bittorrent": "torrent",
  6458. "x-cbr": [
  6459. "cbr",
  6460. "cba",
  6461. "cbt",
  6462. "cb7"
  6463. ],
  6464. "x-cbz": "cbz",
  6465. "x-cdf": [
  6466. "cdf",
  6467. "cda"
  6468. ],
  6469. "x-cdlink": "vcd",
  6470. "x-chess-pgn": "pgn",
  6471. "x-cpio": "cpio",
  6472. "x-csh": "csh",
  6473. "x-director": [
  6474. "dir",
  6475. "dxr",
  6476. "cst",
  6477. "cct",
  6478. "cxt",
  6479. "w3d",
  6480. "fgd",
  6481. "swa"
  6482. ],
  6483. "x-dms": "dms",
  6484. "x-doom": "wad",
  6485. "x-dvi": "dvi",
  6486. "x-httpd-eruby": "rhtml",
  6487. "x-font": "pcf.Z",
  6488. "x-freemind": "mm",
  6489. "x-gnumeric": "gnumeric",
  6490. "x-go-sgf": "sgf",
  6491. "x-graphing-calculator": "gcf",
  6492. "x-gtar": [
  6493. "gtar",
  6494. "taz"
  6495. ],
  6496. "x-hdf": "hdf",
  6497. "x-httpd-php": [
  6498. "phtml",
  6499. "pht",
  6500. "php"
  6501. ],
  6502. "x-httpd-php-source": "phps",
  6503. "x-httpd-php3": "php3",
  6504. "x-httpd-php3-preprocessed": "php3p",
  6505. "x-httpd-php4": "php4",
  6506. "x-httpd-php5": "php5",
  6507. "x-ica": "ica",
  6508. "x-info": "info",
  6509. "x-internet-signup": [
  6510. "ins",
  6511. "isp"
  6512. ],
  6513. "x-iphone": "iii",
  6514. "x-iso9660-image": "iso",
  6515. "x-java-jnlp-file": "jnlp",
  6516. "x-jmol": "jmz",
  6517. "x-killustrator": "kil",
  6518. "x-latex": "latex",
  6519. "x-lyx": "lyx",
  6520. "x-lzx": "lzx",
  6521. "x-maker": [
  6522. "frm",
  6523. "fb",
  6524. "fbdoc"
  6525. ],
  6526. "x-ms-wmd": "wmd",
  6527. "x-msdos-program": [
  6528. "com",
  6529. "exe",
  6530. "bat",
  6531. "dll"
  6532. ],
  6533. "x-netcdf": [
  6534. "nc"
  6535. ],
  6536. "x-ns-proxy-autoconfig": [
  6537. "pac",
  6538. "dat"
  6539. ],
  6540. "x-nwc": "nwc",
  6541. "x-object": "o",
  6542. "x-oz-application": "oza",
  6543. "x-pkcs7-certreqresp": "p7r",
  6544. "x-python-code": [
  6545. "pyc",
  6546. "pyo"
  6547. ],
  6548. "x-qgis": [
  6549. "qgs",
  6550. "shp",
  6551. "shx"
  6552. ],
  6553. "x-quicktimeplayer": "qtl",
  6554. "x-redhat-package-manager": [
  6555. "rpm",
  6556. "rpa"
  6557. ],
  6558. "x-ruby": "rb",
  6559. "x-sh": "sh",
  6560. "x-shar": "shar",
  6561. "x-shockwave-flash": [
  6562. "swf",
  6563. "swfl"
  6564. ],
  6565. "x-silverlight": "scr",
  6566. "x-stuffit": "sit",
  6567. "x-sv4cpio": "sv4cpio",
  6568. "x-sv4crc": "sv4crc",
  6569. "x-tar": "tar",
  6570. "x-tex-gf": "gf",
  6571. "x-tex-pk": "pk",
  6572. "x-texinfo": [
  6573. "texinfo",
  6574. "texi"
  6575. ],
  6576. "x-trash": [
  6577. "~",
  6578. "%",
  6579. "bak",
  6580. "old",
  6581. "sik"
  6582. ],
  6583. "x-ustar": "ustar",
  6584. "x-wais-source": "src",
  6585. "x-wingz": "wz",
  6586. "x-x509-ca-cert": [
  6587. "crt",
  6588. "der",
  6589. "cer"
  6590. ],
  6591. "x-xcf": "xcf",
  6592. "x-xfig": "fig",
  6593. "x-xpinstall": "xpi",
  6594. "applixware": "aw",
  6595. "atomsvc+xml": "atomsvc",
  6596. "ccxml+xml": "ccxml",
  6597. "cdmi-capability": "cdmia",
  6598. "cdmi-container": "cdmic",
  6599. "cdmi-domain": "cdmid",
  6600. "cdmi-object": "cdmio",
  6601. "cdmi-queue": "cdmiq",
  6602. "docbook+xml": "dbk",
  6603. "dssc+der": "dssc",
  6604. "dssc+xml": "xdssc",
  6605. "emma+xml": "emma",
  6606. "epub+zip": "epub",
  6607. "exi": "exi",
  6608. "font-tdpfr": "pfr",
  6609. "gml+xml": "gml",
  6610. "gpx+xml": "gpx",
  6611. "gxf": "gxf",
  6612. "hyperstudio": "stk",
  6613. "inkml+xml": [
  6614. "ink",
  6615. "inkml"
  6616. ],
  6617. "ipfix": "ipfix",
  6618. "jsonml+json": "jsonml",
  6619. "lost+xml": "lostxml",
  6620. "mads+xml": "mads",
  6621. "marc": "mrc",
  6622. "marcxml+xml": "mrcx",
  6623. "mathml+xml": [
  6624. "mathml",
  6625. "mml"
  6626. ],
  6627. "mbox": "mbox",
  6628. "mediaservercontrol+xml": "mscml",
  6629. "metalink+xml": "metalink",
  6630. "metalink4+xml": "meta4",
  6631. "mets+xml": "mets",
  6632. "mods+xml": "mods",
  6633. "mp21": [
  6634. "m21",
  6635. "mp21"
  6636. ],
  6637. "mp4": "mp4s",
  6638. "oebps-package+xml": "opf",
  6639. "omdoc+xml": "omdoc",
  6640. "onenote": [
  6641. "onetoc",
  6642. "onetoc2",
  6643. "onetmp",
  6644. "onepkg"
  6645. ],
  6646. "oxps": "oxps",
  6647. "patch-ops-error+xml": "xer",
  6648. "pgp-encrypted": "pgp",
  6649. "pkcs10": "p10",
  6650. "pkcs7-mime": [
  6651. "p7m",
  6652. "p7c"
  6653. ],
  6654. "pkcs7-signature": "p7s",
  6655. "pkcs8": "p8",
  6656. "pkix-attr-cert": "ac",
  6657. "pkix-crl": "crl",
  6658. "pkix-pkipath": "pkipath",
  6659. "pkixcmp": "pki",
  6660. "pls+xml": "pls",
  6661. "prs.cww": "cww",
  6662. "pskc+xml": "pskcxml",
  6663. "reginfo+xml": "rif",
  6664. "relax-ng-compact-syntax": "rnc",
  6665. "resource-lists+xml": "rl",
  6666. "resource-lists-diff+xml": "rld",
  6667. "rls-services+xml": "rs",
  6668. "rpki-ghostbusters": "gbr",
  6669. "rpki-manifest": "mft",
  6670. "rpki-roa": "roa",
  6671. "rsd+xml": "rsd",
  6672. "sbml+xml": "sbml",
  6673. "scvp-cv-request": "scq",
  6674. "scvp-cv-response": "scs",
  6675. "scvp-vp-request": "spq",
  6676. "scvp-vp-response": "spp",
  6677. "sdp": "sdp",
  6678. "set-payment-initiation": "setpay",
  6679. "set-registration-initiation": "setreg",
  6680. "shf+xml": "shf",
  6681. "sparql-query": "rq",
  6682. "sparql-results+xml": "srx",
  6683. "srgs": "gram",
  6684. "srgs+xml": "grxml",
  6685. "sru+xml": "sru",
  6686. "ssdl+xml": "ssdl",
  6687. "ssml+xml": "ssml",
  6688. "tei+xml": [
  6689. "tei",
  6690. "teicorpus"
  6691. ],
  6692. "thraud+xml": "tfi",
  6693. "timestamped-data": "tsd",
  6694. "vnd.3gpp.pic-bw-large": "plb",
  6695. "vnd.3gpp.pic-bw-small": "psb",
  6696. "vnd.3gpp.pic-bw-var": "pvb",
  6697. "vnd.3gpp2.tcap": "tcap",
  6698. "vnd.3m.post-it-notes": "pwn",
  6699. "vnd.accpac.simply.aso": "aso",
  6700. "vnd.accpac.simply.imp": "imp",
  6701. "vnd.acucobol": "acu",
  6702. "vnd.acucorp": [
  6703. "atc",
  6704. "acutc"
  6705. ],
  6706. "vnd.adobe.air-application-installer-package+zip": "air",
  6707. "vnd.adobe.formscentral.fcdt": "fcdt",
  6708. "vnd.adobe.fxp": [
  6709. "fxp",
  6710. "fxpl"
  6711. ],
  6712. "vnd.adobe.xdp+xml": "xdp",
  6713. "vnd.adobe.xfdf": "xfdf",
  6714. "vnd.ahead.space": "ahead",
  6715. "vnd.airzip.filesecure.azf": "azf",
  6716. "vnd.airzip.filesecure.azs": "azs",
  6717. "vnd.amazon.ebook": "azw",
  6718. "vnd.americandynamics.acc": "acc",
  6719. "vnd.amiga.ami": "ami",
  6720. "vnd.anser-web-certificate-issue-initiation": "cii",
  6721. "vnd.anser-web-funds-transfer-initiation": "fti",
  6722. "vnd.antix.game-component": "atx",
  6723. "vnd.apple.installer+xml": "mpkg",
  6724. "vnd.apple.mpegurl": "m3u8",
  6725. "vnd.aristanetworks.swi": "swi",
  6726. "vnd.astraea-software.iota": "iota",
  6727. "vnd.audiograph": "aep",
  6728. "vnd.blueice.multipass": "mpm",
  6729. "vnd.bmi": "bmi",
  6730. "vnd.businessobjects": "rep",
  6731. "vnd.chemdraw+xml": "cdxml",
  6732. "vnd.chipnuts.karaoke-mmd": "mmd",
  6733. "vnd.claymore": "cla",
  6734. "vnd.cloanto.rp9": "rp9",
  6735. "vnd.clonk.c4group": [
  6736. "c4g",
  6737. "c4d",
  6738. "c4f",
  6739. "c4p",
  6740. "c4u"
  6741. ],
  6742. "vnd.cluetrust.cartomobile-config": "c11amc",
  6743. "vnd.cluetrust.cartomobile-config-pkg": "c11amz",
  6744. "vnd.commonspace": "csp",
  6745. "vnd.contact.cmsg": "cdbcmsg",
  6746. "vnd.cosmocaller": "cmc",
  6747. "vnd.crick.clicker": "clkx",
  6748. "vnd.crick.clicker.keyboard": "clkk",
  6749. "vnd.crick.clicker.palette": "clkp",
  6750. "vnd.crick.clicker.template": "clkt",
  6751. "vnd.crick.clicker.wordbank": "clkw",
  6752. "vnd.criticaltools.wbs+xml": "wbs",
  6753. "vnd.ctc-posml": "pml",
  6754. "vnd.cups-ppd": "ppd",
  6755. "vnd.curl.car": "car",
  6756. "vnd.curl.pcurl": "pcurl",
  6757. "vnd.dart": "dart",
  6758. "vnd.data-vision.rdz": "rdz",
  6759. "vnd.dece.data": [
  6760. "uvf",
  6761. "uvvf",
  6762. "uvd",
  6763. "uvvd"
  6764. ],
  6765. "vnd.dece.ttml+xml": [
  6766. "uvt",
  6767. "uvvt"
  6768. ],
  6769. "vnd.dece.unspecified": [
  6770. "uvx",
  6771. "uvvx"
  6772. ],
  6773. "vnd.dece.zip": [
  6774. "uvz",
  6775. "uvvz"
  6776. ],
  6777. "vnd.denovo.fcselayout-link": "fe_launch",
  6778. "vnd.dna": "dna",
  6779. "vnd.dolby.mlp": "mlp",
  6780. "vnd.dpgraph": "dpg",
  6781. "vnd.dreamfactory": "dfac",
  6782. "vnd.ds-keypoint": "kpxx",
  6783. "vnd.dvb.ait": "ait",
  6784. "vnd.dvb.service": "svc",
  6785. "vnd.dynageo": "geo",
  6786. "vnd.ecowin.chart": "mag",
  6787. "vnd.enliven": "nml",
  6788. "vnd.epson.esf": "esf",
  6789. "vnd.epson.msf": "msf",
  6790. "vnd.epson.quickanime": "qam",
  6791. "vnd.epson.salt": "slt",
  6792. "vnd.epson.ssf": "ssf",
  6793. "vnd.eszigno3+xml": [
  6794. "es3",
  6795. "et3"
  6796. ],
  6797. "vnd.ezpix-album": "ez2",
  6798. "vnd.ezpix-package": "ez3",
  6799. "vnd.fdf": "fdf",
  6800. "vnd.fdsn.mseed": "mseed",
  6801. "vnd.fdsn.seed": [
  6802. "seed",
  6803. "dataless"
  6804. ],
  6805. "vnd.flographit": "gph",
  6806. "vnd.fluxtime.clip": "ftc",
  6807. "vnd.framemaker": [
  6808. "fm",
  6809. "frame",
  6810. "maker",
  6811. "book"
  6812. ],
  6813. "vnd.frogans.fnc": "fnc",
  6814. "vnd.frogans.ltf": "ltf",
  6815. "vnd.fsc.weblaunch": "fsc",
  6816. "vnd.fujitsu.oasys": "oas",
  6817. "vnd.fujitsu.oasys2": "oa2",
  6818. "vnd.fujitsu.oasys3": "oa3",
  6819. "vnd.fujitsu.oasysgp": "fg5",
  6820. "vnd.fujitsu.oasysprs": "bh2",
  6821. "vnd.fujixerox.ddd": "ddd",
  6822. "vnd.fujixerox.docuworks": "xdw",
  6823. "vnd.fujixerox.docuworks.binder": "xbd",
  6824. "vnd.fuzzysheet": "fzs",
  6825. "vnd.genomatix.tuxedo": "txd",
  6826. "vnd.geogebra.file": "ggb",
  6827. "vnd.geogebra.tool": "ggt",
  6828. "vnd.geometry-explorer": [
  6829. "gex",
  6830. "gre"
  6831. ],
  6832. "vnd.geonext": "gxt",
  6833. "vnd.geoplan": "g2w",
  6834. "vnd.geospace": "g3w",
  6835. "vnd.gmx": "gmx",
  6836. "vnd.grafeq": [
  6837. "gqf",
  6838. "gqs"
  6839. ],
  6840. "vnd.groove-account": "gac",
  6841. "vnd.groove-help": "ghf",
  6842. "vnd.groove-identity-message": "gim",
  6843. "vnd.groove-injector": "grv",
  6844. "vnd.groove-tool-message": "gtm",
  6845. "vnd.groove-tool-template": "tpl",
  6846. "vnd.groove-vcard": "vcg",
  6847. "vnd.hal+xml": "hal",
  6848. "vnd.handheld-entertainment+xml": "zmm",
  6849. "vnd.hbci": "hbci",
  6850. "vnd.hhe.lesson-player": "les",
  6851. "vnd.hp-hpgl": "hpgl",
  6852. "vnd.hp-hpid": "hpid",
  6853. "vnd.hp-hps": "hps",
  6854. "vnd.hp-jlyt": "jlt",
  6855. "vnd.hp-pcl": "pcl",
  6856. "vnd.hp-pclxl": "pclxl",
  6857. "vnd.hydrostatix.sof-data": "sfd-hdstx",
  6858. "vnd.ibm.minipay": "mpy",
  6859. "vnd.ibm.modcap": [
  6860. "afp",
  6861. "listafp",
  6862. "list3820"
  6863. ],
  6864. "vnd.ibm.rights-management": "irm",
  6865. "vnd.ibm.secure-container": "sc",
  6866. "vnd.iccprofile": [
  6867. "icc",
  6868. "icm"
  6869. ],
  6870. "vnd.igloader": "igl",
  6871. "vnd.immervision-ivp": "ivp",
  6872. "vnd.immervision-ivu": "ivu",
  6873. "vnd.insors.igm": "igm",
  6874. "vnd.intercon.formnet": [
  6875. "xpw",
  6876. "xpx"
  6877. ],
  6878. "vnd.intergeo": "i2g",
  6879. "vnd.intu.qbo": "qbo",
  6880. "vnd.intu.qfx": "qfx",
  6881. "vnd.ipunplugged.rcprofile": "rcprofile",
  6882. "vnd.irepository.package+xml": "irp",
  6883. "vnd.is-xpr": "xpr",
  6884. "vnd.isac.fcs": "fcs",
  6885. "vnd.jam": "jam",
  6886. "vnd.jcp.javame.midlet-rms": "rms",
  6887. "vnd.jisp": "jisp",
  6888. "vnd.joost.joda-archive": "joda",
  6889. "vnd.kahootz": [
  6890. "ktz",
  6891. "ktr"
  6892. ],
  6893. "vnd.kde.karbon": "karbon",
  6894. "vnd.kde.kchart": "chrt",
  6895. "vnd.kde.kformula": "kfo",
  6896. "vnd.kde.kivio": "flw",
  6897. "vnd.kde.kontour": "kon",
  6898. "vnd.kde.kpresenter": [
  6899. "kpr",
  6900. "kpt"
  6901. ],
  6902. "vnd.kde.kspread": "ksp",
  6903. "vnd.kde.kword": [
  6904. "kwd",
  6905. "kwt"
  6906. ],
  6907. "vnd.kenameaapp": "htke",
  6908. "vnd.kidspiration": "kia",
  6909. "vnd.kinar": [
  6910. "kne",
  6911. "knp"
  6912. ],
  6913. "vnd.koan": [
  6914. "skp",
  6915. "skd",
  6916. "skt",
  6917. "skm"
  6918. ],
  6919. "vnd.kodak-descriptor": "sse",
  6920. "vnd.las.las+xml": "lasxml",
  6921. "vnd.llamagraphics.life-balance.desktop": "lbd",
  6922. "vnd.llamagraphics.life-balance.exchange+xml": "lbe",
  6923. "vnd.lotus-1-2-3": "123",
  6924. "vnd.lotus-approach": "apr",
  6925. "vnd.lotus-freelance": "pre",
  6926. "vnd.lotus-notes": "nsf",
  6927. "vnd.lotus-organizer": "org",
  6928. "vnd.lotus-screencam": "scm",
  6929. "vnd.lotus-wordpro": "lwp",
  6930. "vnd.macports.portpkg": "portpkg",
  6931. "vnd.mcd": "mcd",
  6932. "vnd.medcalcdata": "mc1",
  6933. "vnd.mediastation.cdkey": "cdkey",
  6934. "vnd.mfer": "mwf",
  6935. "vnd.mfmp": "mfm",
  6936. "vnd.micrografx.flo": "flo",
  6937. "vnd.micrografx.igx": "igx",
  6938. "vnd.mif": "mif",
  6939. "vnd.mobius.daf": "daf",
  6940. "vnd.mobius.dis": "dis",
  6941. "vnd.mobius.mbk": "mbk",
  6942. "vnd.mobius.mqy": "mqy",
  6943. "vnd.mobius.msl": "msl",
  6944. "vnd.mobius.plc": "plc",
  6945. "vnd.mobius.txf": "txf",
  6946. "vnd.mophun.application": "mpn",
  6947. "vnd.mophun.certificate": "mpc",
  6948. "vnd.ms-artgalry": "cil",
  6949. "vnd.ms-cab-compressed": "cab",
  6950. "vnd.ms-excel.addin.macroenabled.12": "xlam",
  6951. "vnd.ms-excel.sheet.binary.macroenabled.12": "xlsb",
  6952. "vnd.ms-excel.sheet.macroenabled.12": "xlsm",
  6953. "vnd.ms-excel.template.macroenabled.12": "xltm",
  6954. "vnd.ms-fontobject": "eot",
  6955. "vnd.ms-htmlhelp": "chm",
  6956. "vnd.ms-ims": "ims",
  6957. "vnd.ms-lrm": "lrm",
  6958. "vnd.ms-officetheme": "thmx",
  6959. "vnd.ms-powerpoint.addin.macroenabled.12": "ppam",
  6960. "vnd.ms-powerpoint.presentation.macroenabled.12": "pptm",
  6961. "vnd.ms-powerpoint.slide.macroenabled.12": "sldm",
  6962. "vnd.ms-powerpoint.slideshow.macroenabled.12": "ppsm",
  6963. "vnd.ms-powerpoint.template.macroenabled.12": "potm",
  6964. "vnd.ms-project": [
  6965. "mpp",
  6966. "mpt"
  6967. ],
  6968. "vnd.ms-word.document.macroenabled.12": "docm",
  6969. "vnd.ms-word.template.macroenabled.12": "dotm",
  6970. "vnd.ms-works": [
  6971. "wps",
  6972. "wks",
  6973. "wcm",
  6974. "wdb"
  6975. ],
  6976. "vnd.ms-wpl": "wpl",
  6977. "vnd.ms-xpsdocument": "xps",
  6978. "vnd.mseq": "mseq",
  6979. "vnd.musician": "mus",
  6980. "vnd.muvee.style": "msty",
  6981. "vnd.mynfc": "taglet",
  6982. "vnd.neurolanguage.nlu": "nlu",
  6983. "vnd.nitf": [
  6984. "ntf",
  6985. "nitf"
  6986. ],
  6987. "vnd.noblenet-directory": "nnd",
  6988. "vnd.noblenet-sealer": "nns",
  6989. "vnd.noblenet-web": "nnw",
  6990. "vnd.nokia.n-gage.data": "ngdat",
  6991. "vnd.nokia.n-gage.symbian.install": "n-gage",
  6992. "vnd.nokia.radio-preset": "rpst",
  6993. "vnd.nokia.radio-presets": "rpss",
  6994. "vnd.novadigm.edm": "edm",
  6995. "vnd.novadigm.edx": "edx",
  6996. "vnd.novadigm.ext": "ext",
  6997. "vnd.oasis.opendocument.chart-template": "otc",
  6998. "vnd.oasis.opendocument.formula-template": "odft",
  6999. "vnd.oasis.opendocument.image-template": "oti",
  7000. "vnd.olpc-sugar": "xo",
  7001. "vnd.oma.dd2+xml": "dd2",
  7002. "vnd.openofficeorg.extension": "oxt",
  7003. "vnd.openxmlformats-officedocument.presentationml.slide": "sldx",
  7004. "vnd.osgeo.mapguide.package": "mgp",
  7005. "vnd.osgi.dp": "dp",
  7006. "vnd.osgi.subsystem": "esa",
  7007. "vnd.palm": [
  7008. "pdb",
  7009. "pqa",
  7010. "oprc"
  7011. ],
  7012. "vnd.pawaafile": "paw",
  7013. "vnd.pg.format": "str",
  7014. "vnd.pg.osasli": "ei6",
  7015. "vnd.picsel": "efif",
  7016. "vnd.pmi.widget": "wg",
  7017. "vnd.pocketlearn": "plf",
  7018. "vnd.powerbuilder6": "pbd",
  7019. "vnd.previewsystems.box": "box",
  7020. "vnd.proteus.magazine": "mgz",
  7021. "vnd.publishare-delta-tree": "qps",
  7022. "vnd.pvi.ptid1": "ptid",
  7023. "vnd.quark.quarkxpress": [
  7024. "qxd",
  7025. "qxt",
  7026. "qwd",
  7027. "qwt",
  7028. "qxl",
  7029. "qxb"
  7030. ],
  7031. "vnd.realvnc.bed": "bed",
  7032. "vnd.recordare.musicxml": "mxl",
  7033. "vnd.recordare.musicxml+xml": "musicxml",
  7034. "vnd.rig.cryptonote": "cryptonote",
  7035. "vnd.rn-realmedia": "rm",
  7036. "vnd.rn-realmedia-vbr": "rmvb",
  7037. "vnd.route66.link66+xml": "link66",
  7038. "vnd.sailingtracker.track": "st",
  7039. "vnd.seemail": "see",
  7040. "vnd.sema": "sema",
  7041. "vnd.semd": "semd",
  7042. "vnd.semf": "semf",
  7043. "vnd.shana.informed.formdata": "ifm",
  7044. "vnd.shana.informed.formtemplate": "itp",
  7045. "vnd.shana.informed.interchange": "iif",
  7046. "vnd.shana.informed.package": "ipk",
  7047. "vnd.simtech-mindmapper": [
  7048. "twd",
  7049. "twds"
  7050. ],
  7051. "vnd.smart.teacher": "teacher",
  7052. "vnd.solent.sdkm+xml": [
  7053. "sdkm",
  7054. "sdkd"
  7055. ],
  7056. "vnd.spotfire.dxp": "dxp",
  7057. "vnd.spotfire.sfs": "sfs",
  7058. "vnd.stepmania.package": "smzip",
  7059. "vnd.stepmania.stepchart": "sm",
  7060. "vnd.sus-calendar": [
  7061. "sus",
  7062. "susp"
  7063. ],
  7064. "vnd.svd": "svd",
  7065. "vnd.syncml+xml": "xsm",
  7066. "vnd.syncml.dm+wbxml": "bdm",
  7067. "vnd.syncml.dm+xml": "xdm",
  7068. "vnd.tao.intent-module-archive": "tao",
  7069. "vnd.tcpdump.pcap": [
  7070. "pcap",
  7071. "cap",
  7072. "dmp"
  7073. ],
  7074. "vnd.tmobile-livetv": "tmo",
  7075. "vnd.trid.tpt": "tpt",
  7076. "vnd.triscape.mxs": "mxs",
  7077. "vnd.trueapp": "tra",
  7078. "vnd.ufdl": [
  7079. "ufd",
  7080. "ufdl"
  7081. ],
  7082. "vnd.uiq.theme": "utz",
  7083. "vnd.umajin": "umj",
  7084. "vnd.unity": "unityweb",
  7085. "vnd.uoml+xml": "uoml",
  7086. "vnd.vcx": "vcx",
  7087. "vnd.visionary": "vis",
  7088. "vnd.vsf": "vsf",
  7089. "vnd.webturbo": "wtb",
  7090. "vnd.wolfram.player": "nbp",
  7091. "vnd.wqd": "wqd",
  7092. "vnd.wt.stf": "stf",
  7093. "vnd.xara": "xar",
  7094. "vnd.xfdl": "xfdl",
  7095. "vnd.yamaha.hv-dic": "hvd",
  7096. "vnd.yamaha.hv-script": "hvs",
  7097. "vnd.yamaha.hv-voice": "hvp",
  7098. "vnd.yamaha.openscoreformat": "osf",
  7099. "vnd.yamaha.openscoreformat.osfpvg+xml": "osfpvg",
  7100. "vnd.yamaha.smaf-audio": "saf",
  7101. "vnd.yamaha.smaf-phrase": "spf",
  7102. "vnd.yellowriver-custom-menu": "cmp",
  7103. "vnd.zul": [
  7104. "zir",
  7105. "zirz"
  7106. ],
  7107. "vnd.zzazz.deck+xml": "zaz",
  7108. "voicexml+xml": "vxml",
  7109. "widget": "wgt",
  7110. "winhlp": "hlp",
  7111. "wsdl+xml": "wsdl",
  7112. "wspolicy+xml": "wspolicy",
  7113. "x-ace-compressed": "ace",
  7114. "x-authorware-bin": [
  7115. "aab",
  7116. "x32",
  7117. "u32",
  7118. "vox"
  7119. ],
  7120. "x-authorware-map": "aam",
  7121. "x-authorware-seg": "aas",
  7122. "x-blorb": [
  7123. "blb",
  7124. "blorb"
  7125. ],
  7126. "x-bzip": "bz",
  7127. "x-bzip2": [
  7128. "bz2",
  7129. "boz"
  7130. ],
  7131. "x-cfs-compressed": "cfs",
  7132. "x-chat": "chat",
  7133. "x-conference": "nsc",
  7134. "x-dgc-compressed": "dgc",
  7135. "x-dtbncx+xml": "ncx",
  7136. "x-dtbook+xml": "dtb",
  7137. "x-dtbresource+xml": "res",
  7138. "x-eva": "eva",
  7139. "x-font-bdf": "bdf",
  7140. "x-font-ghostscript": "gsf",
  7141. "x-font-linux-psf": "psf",
  7142. "x-font-pcf": "pcf",
  7143. "x-font-snf": "snf",
  7144. "x-font-ttf": [
  7145. "ttf",
  7146. "ttc"
  7147. ],
  7148. "x-font-type1": [
  7149. "pfa",
  7150. "pfb",
  7151. "pfm",
  7152. "afm"
  7153. ],
  7154. "x-freearc": "arc",
  7155. "x-gca-compressed": "gca",
  7156. "x-glulx": "ulx",
  7157. "x-gramps-xml": "gramps",
  7158. "x-install-instructions": "install",
  7159. "x-lzh-compressed": [
  7160. "lzh",
  7161. "lha"
  7162. ],
  7163. "x-mie": "mie",
  7164. "x-mobipocket-ebook": [
  7165. "prc",
  7166. "mobi"
  7167. ],
  7168. "x-ms-application": "application",
  7169. "x-ms-shortcut": "lnk",
  7170. "x-ms-xbap": "xbap",
  7171. "x-msbinder": "obd",
  7172. "x-mscardfile": "crd",
  7173. "x-msclip": "clp",
  7174. "application/x-ms-installer": "msi",
  7175. "x-msmediaview": [
  7176. "mvb",
  7177. "m13",
  7178. "m14"
  7179. ],
  7180. "x-msmetafile": [
  7181. "wmf",
  7182. "wmz",
  7183. "emf",
  7184. "emz"
  7185. ],
  7186. "x-msmoney": "mny",
  7187. "x-mspublisher": "pub",
  7188. "x-msschedule": "scd",
  7189. "x-msterminal": "trm",
  7190. "x-mswrite": "wri",
  7191. "x-nzb": "nzb",
  7192. "x-pkcs12": [
  7193. "p12",
  7194. "pfx"
  7195. ],
  7196. "x-pkcs7-certificates": [
  7197. "p7b",
  7198. "spc"
  7199. ],
  7200. "x-research-info-systems": "ris",
  7201. "x-silverlight-app": "xap",
  7202. "x-sql": "sql",
  7203. "x-stuffitx": "sitx",
  7204. "x-subrip": "srt",
  7205. "x-t3vm-image": "t3",
  7206. "x-tex-tfm": "tfm",
  7207. "x-tgif": "obj",
  7208. "x-xliff+xml": "xlf",
  7209. "x-xz": "xz",
  7210. "x-zmachine": [
  7211. "z1",
  7212. "z2",
  7213. "z3",
  7214. "z4",
  7215. "z5",
  7216. "z6",
  7217. "z7",
  7218. "z8"
  7219. ],
  7220. "xaml+xml": "xaml",
  7221. "xcap-diff+xml": "xdf",
  7222. "xenc+xml": "xenc",
  7223. "xml-dtd": "dtd",
  7224. "xop+xml": "xop",
  7225. "xproc+xml": "xpl",
  7226. "xslt+xml": "xslt",
  7227. "xv+xml": [
  7228. "mxml",
  7229. "xhvml",
  7230. "xvml",
  7231. "xvm"
  7232. ],
  7233. "yang": "yang",
  7234. "yin+xml": "yin",
  7235. "envoy": "evy",
  7236. "fractals": "fif",
  7237. "internet-property-stream": "acx",
  7238. "olescript": "axs",
  7239. "vnd.ms-outlook": "msg",
  7240. "vnd.ms-pkicertstore": "sst",
  7241. "x-compress": "z",
  7242. "x-perfmon": [
  7243. "pma",
  7244. "pmc",
  7245. "pmr",
  7246. "pmw"
  7247. ],
  7248. "ynd.ms-pkipko": "pko",
  7249. "gzip": [
  7250. "gz",
  7251. "tgz"
  7252. ],
  7253. "smil+xml": [
  7254. "smi",
  7255. "smil"
  7256. ],
  7257. "vnd.debian.binary-package": [
  7258. "deb",
  7259. "udeb"
  7260. ],
  7261. "vnd.hzn-3d-crossword": "x3d",
  7262. "vnd.sqlite3": [
  7263. "db",
  7264. "sqlite",
  7265. "sqlite3",
  7266. "db-wal",
  7267. "sqlite-wal",
  7268. "db-shm",
  7269. "sqlite-shm"
  7270. ],
  7271. "vnd.wap.sic": "sic",
  7272. "vnd.wap.slc": "slc",
  7273. "x-krita": [
  7274. "kra",
  7275. "krz"
  7276. ],
  7277. "x-perl": [
  7278. "pm",
  7279. "pl"
  7280. ],
  7281. "yaml": [
  7282. "yaml",
  7283. "yml"
  7284. ]
  7285. },
  7286. "audio": {
  7287. "amr": "amr",
  7288. "amr-wb": "awb",
  7289. "annodex": "axa",
  7290. "basic": [
  7291. "au",
  7292. "snd"
  7293. ],
  7294. "flac": "flac",
  7295. "midi": [
  7296. "mid",
  7297. "midi",
  7298. "kar",
  7299. "rmi"
  7300. ],
  7301. "mpeg": [
  7302. "mpga",
  7303. "mpega",
  7304. "mp3",
  7305. "m4a",
  7306. "mp2a",
  7307. "m2a",
  7308. "m3a"
  7309. ],
  7310. "mpegurl": "m3u",
  7311. "ogg": [
  7312. "oga",
  7313. "ogg",
  7314. "spx"
  7315. ],
  7316. "prs.sid": "sid",
  7317. "x-aiff": "aifc",
  7318. "x-gsm": "gsm",
  7319. "x-ms-wma": "wma",
  7320. "x-ms-wax": "wax",
  7321. "x-pn-realaudio": "ram",
  7322. "x-realaudio": "ra",
  7323. "x-sd2": "sd2",
  7324. "adpcm": "adp",
  7325. "mp4": "mp4a",
  7326. "s3m": "s3m",
  7327. "silk": "sil",
  7328. "vnd.dece.audio": [
  7329. "uva",
  7330. "uvva"
  7331. ],
  7332. "vnd.digital-winds": "eol",
  7333. "vnd.dra": "dra",
  7334. "vnd.dts": "dts",
  7335. "vnd.dts.hd": "dtshd",
  7336. "vnd.lucent.voice": "lvp",
  7337. "vnd.ms-playready.media.pya": "pya",
  7338. "vnd.nuera.ecelp4800": "ecelp4800",
  7339. "vnd.nuera.ecelp7470": "ecelp7470",
  7340. "vnd.nuera.ecelp9600": "ecelp9600",
  7341. "vnd.rip": "rip",
  7342. "webm": "weba",
  7343. "x-caf": "caf",
  7344. "x-matroska": "mka",
  7345. "x-pn-realaudio-plugin": "rmp",
  7346. "xm": "xm",
  7347. "aac": "aac",
  7348. "aiff": [
  7349. "aiff",
  7350. "aif",
  7351. "aff"
  7352. ],
  7353. "opus": "opus",
  7354. "wav": "wav"
  7355. },
  7356. "chemical": {
  7357. "x-alchemy": "alc",
  7358. "x-cache": [
  7359. "cac",
  7360. "cache"
  7361. ],
  7362. "x-cache-csf": "csf",
  7363. "x-cactvs-binary": [
  7364. "cbin",
  7365. "cascii",
  7366. "ctab"
  7367. ],
  7368. "x-cdx": "cdx",
  7369. "x-chem3d": "c3d",
  7370. "x-cif": "cif",
  7371. "x-cmdf": "cmdf",
  7372. "x-cml": "cml",
  7373. "x-compass": "cpa",
  7374. "x-crossfire": "bsd",
  7375. "x-csml": [
  7376. "csml",
  7377. "csm"
  7378. ],
  7379. "x-ctx": "ctx",
  7380. "x-cxf": [
  7381. "cxf",
  7382. "cef"
  7383. ],
  7384. "x-embl-dl-nucleotide": [
  7385. "emb",
  7386. "embl"
  7387. ],
  7388. "x-gamess-input": [
  7389. "inp",
  7390. "gam",
  7391. "gamin"
  7392. ],
  7393. "x-gaussian-checkpoint": [
  7394. "fch",
  7395. "fchk"
  7396. ],
  7397. "x-gaussian-cube": "cub",
  7398. "x-gaussian-input": [
  7399. "gau",
  7400. "gjc",
  7401. "gjf"
  7402. ],
  7403. "x-gaussian-log": "gal",
  7404. "x-gcg8-sequence": "gcg",
  7405. "x-genbank": "gen",
  7406. "x-hin": "hin",
  7407. "x-isostar": [
  7408. "istr",
  7409. "ist"
  7410. ],
  7411. "x-jcamp-dx": [
  7412. "jdx",
  7413. "dx"
  7414. ],
  7415. "x-kinemage": "kin",
  7416. "x-macmolecule": "mcm",
  7417. "x-macromodel-input": "mmod",
  7418. "x-mdl-molfile": "mol",
  7419. "x-mdl-rdfile": "rd",
  7420. "x-mdl-rxnfile": "rxn",
  7421. "x-mdl-sdfile": "sd",
  7422. "x-mdl-tgf": "tgf",
  7423. "x-mmcif": "mcif",
  7424. "x-mol2": "mol2",
  7425. "x-molconn-Z": "b",
  7426. "x-mopac-graph": "gpt",
  7427. "x-mopac-input": [
  7428. "mop",
  7429. "mopcrt",
  7430. "zmt"
  7431. ],
  7432. "x-mopac-out": "moo",
  7433. "x-ncbi-asn1": "asn",
  7434. "x-ncbi-asn1-ascii": [
  7435. "prt",
  7436. "ent"
  7437. ],
  7438. "x-ncbi-asn1-binary": "val",
  7439. "x-rosdal": "ros",
  7440. "x-swissprot": "sw",
  7441. "x-vamas-iso14976": "vms",
  7442. "x-vmd": "vmd",
  7443. "x-xtel": "xtel",
  7444. "x-xyz": "xyz"
  7445. },
  7446. "font": {
  7447. "otf": "otf",
  7448. "woff": "woff",
  7449. "woff2": "woff2"
  7450. },
  7451. "image": {
  7452. "gif": "gif",
  7453. "ief": "ief",
  7454. "jpeg": [
  7455. "jpeg",
  7456. "jpg",
  7457. "jpe",
  7458. "jfif",
  7459. "jfif-tbnl",
  7460. "jif"
  7461. ],
  7462. "pcx": "pcx",
  7463. "png": "png",
  7464. "svg+xml": [
  7465. "svg",
  7466. "svgz"
  7467. ],
  7468. "tiff": [
  7469. "tiff",
  7470. "tif"
  7471. ],
  7472. "vnd.djvu": [
  7473. "djvu",
  7474. "djv"
  7475. ],
  7476. "vnd.wap.wbmp": "wbmp",
  7477. "x-canon-cr2": "cr2",
  7478. "x-canon-crw": "crw",
  7479. "x-cmu-raster": "ras",
  7480. "x-coreldraw": "cdr",
  7481. "x-coreldrawpattern": "pat",
  7482. "x-coreldrawtemplate": "cdt",
  7483. "x-corelphotopaint": "cpt",
  7484. "x-epson-erf": "erf",
  7485. "x-icon": "ico",
  7486. "x-jg": "art",
  7487. "x-jng": "jng",
  7488. "x-nikon-nef": "nef",
  7489. "x-olympus-orf": "orf",
  7490. "x-portable-anymap": "pnm",
  7491. "x-portable-bitmap": "pbm",
  7492. "x-portable-graymap": "pgm",
  7493. "x-portable-pixmap": "ppm",
  7494. "x-rgb": "rgb",
  7495. "x-xbitmap": "xbm",
  7496. "x-xpixmap": "xpm",
  7497. "x-xwindowdump": "xwd",
  7498. "bmp": "bmp",
  7499. "cgm": "cgm",
  7500. "g3fax": "g3",
  7501. "ktx": "ktx",
  7502. "prs.btif": "btif",
  7503. "sgi": "sgi",
  7504. "vnd.dece.graphic": [
  7505. "uvi",
  7506. "uvvi",
  7507. "uvg",
  7508. "uvvg"
  7509. ],
  7510. "vnd.dwg": "dwg",
  7511. "vnd.dxf": "dxf",
  7512. "vnd.fastbidsheet": "fbs",
  7513. "vnd.fpx": "fpx",
  7514. "vnd.fst": "fst",
  7515. "vnd.fujixerox.edmics-mmr": "mmr",
  7516. "vnd.fujixerox.edmics-rlc": "rlc",
  7517. "vnd.ms-modi": "mdi",
  7518. "vnd.ms-photo": "wdp",
  7519. "vnd.net-fpx": "npx",
  7520. "vnd.xiff": "xif",
  7521. "webp": "webp",
  7522. "x-3ds": "3ds",
  7523. "x-cmx": "cmx",
  7524. "x-freehand": [
  7525. "fh",
  7526. "fhc",
  7527. "fh4",
  7528. "fh5",
  7529. "fh7"
  7530. ],
  7531. "x-pict": [
  7532. "pic",
  7533. "pct"
  7534. ],
  7535. "x-tga": "tga",
  7536. "cis-cod": "cod",
  7537. "avif": "avifs",
  7538. "heic": [
  7539. "heif",
  7540. "heic"
  7541. ],
  7542. "pjpeg": [
  7543. "pjpg"
  7544. ],
  7545. "vnd.adobe.photoshop": "psd",
  7546. "x-adobe-dng": "dng",
  7547. "x-fuji-raf": "raf",
  7548. "x-icns": "icns",
  7549. "x-kodak-dcr": "dcr",
  7550. "x-kodak-k25": "k25",
  7551. "x-kodak-kdc": "kdc",
  7552. "x-minolta-mrw": "mrw",
  7553. "x-panasonic-raw": [
  7554. "raw",
  7555. "rw2",
  7556. "rwl"
  7557. ],
  7558. "x-pentax-pef": [
  7559. "pef",
  7560. "ptx"
  7561. ],
  7562. "x-sigma-x3f": "x3f",
  7563. "x-sony-arw": "arw",
  7564. "x-sony-sr2": "sr2",
  7565. "x-sony-srf": "srf"
  7566. },
  7567. "message": {
  7568. "rfc822": [
  7569. "eml",
  7570. "mime",
  7571. "mht",
  7572. "mhtml",
  7573. "nws"
  7574. ]
  7575. },
  7576. "model": {
  7577. "iges": [
  7578. "igs",
  7579. "iges"
  7580. ],
  7581. "mesh": [
  7582. "msh",
  7583. "mesh",
  7584. "silo"
  7585. ],
  7586. "vrml": [
  7587. "wrl",
  7588. "vrml"
  7589. ],
  7590. "x3d+vrml": [
  7591. "x3dv",
  7592. "x3dvz"
  7593. ],
  7594. "x3d+xml": "x3dz",
  7595. "x3d+binary": [
  7596. "x3db",
  7597. "x3dbz"
  7598. ],
  7599. "vnd.collada+xml": "dae",
  7600. "vnd.dwf": "dwf",
  7601. "vnd.gdl": "gdl",
  7602. "vnd.gtw": "gtw",
  7603. "vnd.mts": "mts",
  7604. "vnd.usdz+zip": "usdz",
  7605. "vnd.vtu": "vtu"
  7606. },
  7607. "text": {
  7608. "cache-manifest": [
  7609. "manifest",
  7610. "appcache"
  7611. ],
  7612. "calendar": [
  7613. "ics",
  7614. "icz",
  7615. "ifb"
  7616. ],
  7617. "css": "css",
  7618. "csv": "csv",
  7619. "h323": "323",
  7620. "html": [
  7621. "html",
  7622. "htm",
  7623. "shtml",
  7624. "stm"
  7625. ],
  7626. "iuls": "uls",
  7627. "plain": [
  7628. "txt",
  7629. "text",
  7630. "brf",
  7631. "conf",
  7632. "def",
  7633. "list",
  7634. "log",
  7635. "in",
  7636. "bas",
  7637. "diff",
  7638. "ksh"
  7639. ],
  7640. "richtext": "rtx",
  7641. "scriptlet": [
  7642. "sct",
  7643. "wsc"
  7644. ],
  7645. "texmacs": "tm",
  7646. "tab-separated-values": "tsv",
  7647. "vnd.sun.j2me.app-descriptor": "jad",
  7648. "vnd.wap.wml": "wml",
  7649. "vnd.wap.wmlscript": "wmls",
  7650. "x-bibtex": "bib",
  7651. "x-boo": "boo",
  7652. "x-c++hdr": [
  7653. "h++",
  7654. "hpp",
  7655. "hxx",
  7656. "hh"
  7657. ],
  7658. "x-c++src": [
  7659. "c++",
  7660. "cpp",
  7661. "cxx",
  7662. "cc"
  7663. ],
  7664. "x-component": "htc",
  7665. "x-dsrc": "d",
  7666. "x-diff": "patch",
  7667. "x-haskell": "hs",
  7668. "x-java": "java",
  7669. "x-literate-haskell": "lhs",
  7670. "x-moc": "moc",
  7671. "x-pascal": [
  7672. "p",
  7673. "pas",
  7674. "pp",
  7675. "inc"
  7676. ],
  7677. "x-pcs-gcd": "gcd",
  7678. "x-python": "py",
  7679. "x-scala": "scala",
  7680. "x-setext": "etx",
  7681. "x-tcl": [
  7682. "tcl",
  7683. "tk"
  7684. ],
  7685. "x-tex": [
  7686. "tex",
  7687. "ltx",
  7688. "sty",
  7689. "cls"
  7690. ],
  7691. "x-vcalendar": "vcs",
  7692. "x-vcard": "vcf",
  7693. "n3": "n3",
  7694. "prs.lines.tag": "dsc",
  7695. "sgml": [
  7696. "sgml",
  7697. "sgm"
  7698. ],
  7699. "troff": [
  7700. "t",
  7701. "tr",
  7702. "roff",
  7703. "man",
  7704. "me",
  7705. "ms"
  7706. ],
  7707. "turtle": "ttl",
  7708. "uri-list": [
  7709. "uri",
  7710. "uris",
  7711. "urls"
  7712. ],
  7713. "vcard": "vcard",
  7714. "vnd.curl": "curl",
  7715. "vnd.curl.dcurl": "dcurl",
  7716. "vnd.curl.scurl": "scurl",
  7717. "vnd.curl.mcurl": "mcurl",
  7718. "vnd.dvb.subtitle": "sub",
  7719. "vnd.fly": "fly",
  7720. "vnd.fmi.flexstor": "flx",
  7721. "vnd.graphviz": "gv",
  7722. "vnd.in3d.3dml": "3dml",
  7723. "vnd.in3d.spot": "spot",
  7724. "x-asm": [
  7725. "s",
  7726. "asm"
  7727. ],
  7728. "x-c": [
  7729. "c",
  7730. "h",
  7731. "dic"
  7732. ],
  7733. "x-fortran": [
  7734. "f",
  7735. "for",
  7736. "f77",
  7737. "f90"
  7738. ],
  7739. "x-opml": "opml",
  7740. "x-nfo": "nfo",
  7741. "x-sfv": "sfv",
  7742. "x-uuencode": "uu",
  7743. "webviewhtml": "htt",
  7744. "javascript": "js",
  7745. "json": "json",
  7746. "markdown": [
  7747. "md",
  7748. "markdown",
  7749. "mdown",
  7750. "markdn"
  7751. ],
  7752. "vnd.wap.si": "si",
  7753. "vnd.wap.sl": "sl"
  7754. },
  7755. "video": {
  7756. "avif": "avif",
  7757. "3gpp": "3gp",
  7758. "annodex": "axv",
  7759. "dl": "dl",
  7760. "dv": [
  7761. "dif",
  7762. "dv"
  7763. ],
  7764. "fli": "fli",
  7765. "gl": "gl",
  7766. "mpeg": [
  7767. "mpeg",
  7768. "mpg",
  7769. "mpe",
  7770. "m1v",
  7771. "m2v",
  7772. "mp2",
  7773. "mpa",
  7774. "mpv2"
  7775. ],
  7776. "mp4": [
  7777. "mp4",
  7778. "mp4v",
  7779. "mpg4"
  7780. ],
  7781. "quicktime": [
  7782. "qt",
  7783. "mov"
  7784. ],
  7785. "ogg": "ogv",
  7786. "vnd.mpegurl": [
  7787. "mxu",
  7788. "m4u"
  7789. ],
  7790. "x-flv": "flv",
  7791. "x-la-asf": [
  7792. "lsf",
  7793. "lsx"
  7794. ],
  7795. "x-mng": "mng",
  7796. "x-ms-asf": [
  7797. "asf",
  7798. "asx",
  7799. "asr"
  7800. ],
  7801. "x-ms-wm": "wm",
  7802. "x-ms-wmv": "wmv",
  7803. "x-ms-wmx": "wmx",
  7804. "x-ms-wvx": "wvx",
  7805. "x-msvideo": "avi",
  7806. "x-sgi-movie": "movie",
  7807. "x-matroska": [
  7808. "mpv",
  7809. "mkv",
  7810. "mk3d",
  7811. "mks"
  7812. ],
  7813. "3gpp2": "3g2",
  7814. "h261": "h261",
  7815. "h263": "h263",
  7816. "h264": "h264",
  7817. "jpeg": "jpgv",
  7818. "jpm": [
  7819. "jpm",
  7820. "jpgm"
  7821. ],
  7822. "mj2": [
  7823. "mj2",
  7824. "mjp2"
  7825. ],
  7826. "vnd.dece.hd": [
  7827. "uvh",
  7828. "uvvh"
  7829. ],
  7830. "vnd.dece.mobile": [
  7831. "uvm",
  7832. "uvvm"
  7833. ],
  7834. "vnd.dece.pd": [
  7835. "uvp",
  7836. "uvvp"
  7837. ],
  7838. "vnd.dece.sd": [
  7839. "uvs",
  7840. "uvvs"
  7841. ],
  7842. "vnd.dece.video": [
  7843. "uvv",
  7844. "uvvv"
  7845. ],
  7846. "vnd.dvb.file": "dvb",
  7847. "vnd.fvt": "fvt",
  7848. "vnd.ms-playready.media.pyv": "pyv",
  7849. "vnd.uvvu.mp4": [
  7850. "uvu",
  7851. "uvvu"
  7852. ],
  7853. "vnd.vivo": "viv",
  7854. "webm": "webm",
  7855. "x-f4v": "f4v",
  7856. "x-m4v": "m4v",
  7857. "x-ms-vob": "vob",
  7858. "x-smv": "smv",
  7859. "mp2t": "ts"
  7860. },
  7861. "x-conference": {
  7862. "x-cooltalk": "ice"
  7863. },
  7864. "x-world": {
  7865. "x-vrml": [
  7866. "vrm",
  7867. "flr",
  7868. "wrz",
  7869. "xaf",
  7870. "xof"
  7871. ]
  7872. }
  7873. };
  7874. const mimeTypes = (() => {
  7875. const mimeTypes = {};
  7876. for (const type of Object.keys(table)) {
  7877. for (const subtype of Object.keys(table[type])) {
  7878. const value = table[type][subtype];
  7879. if (typeof value == "string") {
  7880. mimeTypes[value] = type + "/" + subtype;
  7881. } else {
  7882. for (let indexMimeType = 0; indexMimeType < value.length; indexMimeType++) {
  7883. mimeTypes[value[indexMimeType]] = type + "/" + subtype;
  7884. }
  7885. }
  7886. }
  7887. }
  7888. return mimeTypes;
  7889. })();
  7890. function getMimeType(filename) {
  7891. return filename && mimeTypes[filename.split(".").pop().toLowerCase()] || getMimeType$1();
  7892. }
  7893. /*
  7894. Copyright (c) 2025 Gildas Lormeau. All rights reserved.
  7895. Redistribution and use in source and binary forms, with or without
  7896. modification, are permitted provided that the following conditions are met:
  7897. 1. Redistributions of source code must retain the above copyright notice,
  7898. this list of conditions and the following disclaimer.
  7899. 2. Redistributions in binary form must reproduce the above copyright
  7900. notice, this list of conditions and the following disclaimer in
  7901. the documentation and/or other materials provided with the distribution.
  7902. 3. The names of the authors may not be used to endorse or promote products
  7903. derived from this software without specific prior written permission.
  7904. THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
  7905. INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  7906. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
  7907. INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
  7908. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  7909. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  7910. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  7911. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  7912. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  7913. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  7914. */
  7915. g$1(configure);
  7916. exports.BlobReader = BlobReader;
  7917. exports.BlobWriter = BlobWriter;
  7918. exports.Data64URIReader = Data64URIReader;
  7919. exports.Data64URIWriter = Data64URIWriter;
  7920. exports.ERR_BAD_FORMAT = ERR_BAD_FORMAT;
  7921. exports.ERR_CENTRAL_DIRECTORY_NOT_FOUND = ERR_CENTRAL_DIRECTORY_NOT_FOUND;
  7922. exports.ERR_DUPLICATED_NAME = ERR_DUPLICATED_NAME;
  7923. exports.ERR_ENCRYPTED = ERR_ENCRYPTED;
  7924. exports.ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND;
  7925. exports.ERR_EOCDR_NOT_FOUND = ERR_EOCDR_NOT_FOUND;
  7926. exports.ERR_EXTRAFIELD_ZIP64_NOT_FOUND = ERR_EXTRAFIELD_ZIP64_NOT_FOUND;
  7927. exports.ERR_HTTP_RANGE = ERR_HTTP_RANGE;
  7928. exports.ERR_INVALID_COMMENT = ERR_INVALID_COMMENT;
  7929. exports.ERR_INVALID_ENCRYPTION_STRENGTH = ERR_INVALID_ENCRYPTION_STRENGTH;
  7930. exports.ERR_INVALID_ENTRY_COMMENT = ERR_INVALID_ENTRY_COMMENT;
  7931. exports.ERR_INVALID_ENTRY_NAME = ERR_INVALID_ENTRY_NAME;
  7932. exports.ERR_INVALID_EXTRAFIELD_DATA = ERR_INVALID_EXTRAFIELD_DATA;
  7933. exports.ERR_INVALID_EXTRAFIELD_TYPE = ERR_INVALID_EXTRAFIELD_TYPE;
  7934. exports.ERR_INVALID_PASSWORD = ERR_INVALID_PASSWORD;
  7935. exports.ERR_INVALID_SIGNATURE = ERR_INVALID_SIGNATURE;
  7936. exports.ERR_INVALID_UNCOMPRESSED_SIZE = ERR_INVALID_UNCOMPRESSED_SIZE;
  7937. exports.ERR_INVALID_VERSION = ERR_INVALID_VERSION;
  7938. exports.ERR_LOCAL_FILE_HEADER_NOT_FOUND = ERR_LOCAL_FILE_HEADER_NOT_FOUND;
  7939. exports.ERR_OVERLAPPING_ENTRY = ERR_OVERLAPPING_ENTRY;
  7940. exports.ERR_SPLIT_ZIP_FILE = ERR_SPLIT_ZIP_FILE;
  7941. exports.ERR_UNDEFINED_UNCOMPRESSED_SIZE = ERR_UNDEFINED_UNCOMPRESSED_SIZE;
  7942. exports.ERR_UNSUPPORTED_COMPRESSION = ERR_UNSUPPORTED_COMPRESSION;
  7943. exports.ERR_UNSUPPORTED_ENCRYPTION = ERR_UNSUPPORTED_ENCRYPTION;
  7944. exports.ERR_UNSUPPORTED_FORMAT = ERR_UNSUPPORTED_FORMAT;
  7945. exports.ERR_ZIP_NOT_EMPTY = ERR_ZIP_NOT_EMPTY;
  7946. exports.HttpRangeReader = HttpRangeReader;
  7947. exports.HttpReader = HttpReader;
  7948. exports.Reader = Reader;
  7949. exports.SplitDataReader = SplitDataReader;
  7950. exports.SplitDataWriter = SplitDataWriter;
  7951. exports.TextReader = TextReader;
  7952. exports.TextWriter = TextWriter;
  7953. exports.Uint8ArrayReader = Uint8ArrayReader;
  7954. exports.Uint8ArrayWriter = Uint8ArrayWriter;
  7955. exports.Writer = Writer;
  7956. exports.ZipReader = ZipReader;
  7957. exports.ZipReaderStream = ZipReaderStream;
  7958. exports.ZipWriter = ZipWriter;
  7959. exports.ZipWriterStream = ZipWriterStream;
  7960. exports.configure = configure;
  7961. exports.fs = fs;
  7962. exports.getMimeType = getMimeType;
  7963. exports.terminateWorkers = terminateWorkers;