EasyPlayer-lib.min.js 3.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357
  1. ! function(e, t) {
  2. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define &&
  3. define.amd ? define(t) : e.videojs = t()
  4. }(this, function() {
  5. var e = "7.2.4",
  6. t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ?
  7. self : {};
  8. function i(e, t) {
  9. return e(t = {
  10. exports: {}
  11. }, t.exports), t.exports
  12. }
  13. var r, n = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {},
  14. a = {},
  15. s = Object.freeze({
  16. default: a
  17. }),
  18. o = s && a || s,
  19. u = void 0 !== t ? t : "undefined" != typeof window ? window : {};
  20. "undefined" != typeof document ? r = document : (r = u["__GLOBAL_DOCUMENT_CACHE@4"]) || (r = u[
  21. "__GLOBAL_DOCUMENT_CACHE@4"] = o);
  22. var l = r,
  23. d = void 0,
  24. c = "info",
  25. h = [],
  26. f = function(e, t) {
  27. var i = d.levels[c],
  28. r = new RegExp("^(" + i + ")$");
  29. if ("log" !== e && t.unshift(e.toUpperCase() + ":"), h && h.push([].concat(t)), t.unshift("VIDEOJS:"), n
  30. .console) {
  31. var a = n.console[e];
  32. a || "debug" !== e || (a = n.console.info || n.console.log), a && i && r.test(e)
  33. }
  34. };
  35. (d = function() {
  36. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  37. f("log", t)
  38. }).levels = {
  39. all: "debug|log|warn|error",
  40. off: "",
  41. debug: "debug|log|warn|error",
  42. info: "log|warn|error",
  43. warn: "warn|error",
  44. error: "error",
  45. DEFAULT: c
  46. }, d.level = function(e) {
  47. if ("string" == typeof e) {
  48. if (!d.levels.hasOwnProperty(e)) throw new Error('"' + e + '" in not a valid log level');
  49. c = e
  50. }
  51. return c
  52. }, d.history = function() {
  53. return h ? [].concat(h) : []
  54. }, d.history.clear = function() {
  55. h && (h.length = 0)
  56. }, d.history.disable = function() {
  57. null !== h && (h.length = 0, h = null)
  58. }, d.history.enable = function() {
  59. null === h && (h = [])
  60. }, d.error = function() {
  61. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  62. return f("error", t)
  63. }, d.warn = function() {
  64. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  65. return f("warn", t)
  66. }, d.debug = function() {
  67. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  68. return f("debug", t)
  69. };
  70. var p = d;
  71. function m(e) {
  72. return e.replace(/\n\r?\s*/g, "")
  73. }
  74. var g = function(e) {
  75. for (var t = "", i = 0; i < arguments.length; i++) t += m(e[i]) + (arguments[i + 1] || "");
  76. return t
  77. },
  78. v = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
  79. return typeof e
  80. } : function(e) {
  81. return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" :
  82. typeof e
  83. },
  84. y = function(e, t) {
  85. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  86. },
  87. _ = function(e, t) {
  88. if ("function" != typeof t && null !== t) throw new TypeError(
  89. "Super expression must either be null or a function, not " + typeof t);
  90. e.prototype = Object.create(t && t.prototype, {
  91. constructor: {
  92. value: e,
  93. enumerable: !1,
  94. writable: !0,
  95. configurable: !0
  96. }
  97. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  98. },
  99. b = function(e, t) {
  100. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  101. return !t || "object" != typeof t && "function" != typeof t ? e : t
  102. },
  103. w = function(e, t) {
  104. return e.raw = t, e
  105. },
  106. E = Object.prototype.toString,
  107. T = function(e) {
  108. return k(e) ? Object.keys(e) : []
  109. };
  110. function S(e, t) {
  111. T(e).forEach(function(i) {
  112. return t(e[i], i)
  113. })
  114. }
  115. function A(e) {
  116. for (var t = arguments.length, i = Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) i[r - 1] = arguments[r];
  117. return Object.assign ? Object.assign.apply(Object, [e].concat(i)) : (i.forEach(function(t) {
  118. t && S(t, function(t, i) {
  119. e[i] = t
  120. })
  121. }), e)
  122. }
  123. function k(e) {
  124. return !!e && "object" === (void 0 === e ? "undefined" : v(e))
  125. }
  126. function R(e) {
  127. return k(e) && "[object Object]" === E.call(e) && e.constructor === Object
  128. }
  129. function M(e, t) {
  130. if (!e || !t) return "";
  131. if ("function" == typeof n.getComputedStyle) {
  132. var i = n.getComputedStyle(e);
  133. return i ? i[t] : ""
  134. }
  135. return ""
  136. }
  137. var O = w([
  138. "Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ",
  139. " to ", "."
  140. ], [
  141. "Setting attributes in the second argument of createEl()\n has been deprecated. Use the third argument instead.\n createEl(type, properties, attributes). Attempting to set ",
  142. " to ", "."
  143. ]);
  144. function C(e) {
  145. return "string" == typeof e && /\S/.test(e)
  146. }
  147. function D(e) {
  148. if (/\s/.test(e)) throw new Error("class has illegal whitespace characters")
  149. }
  150. function I() {
  151. return l === n.document
  152. }
  153. function L(e) {
  154. return k(e) && 1 === e.nodeType
  155. }
  156. function x() {
  157. try {
  158. return n.parent !== n.self
  159. } catch (e) {
  160. return !0
  161. }
  162. }
  163. function P(e) {
  164. return function(t, i) {
  165. if (!C(t)) return l[e](null);
  166. C(i) && (i = l.querySelector(i));
  167. var r = L(i) ? i : l;
  168. return r[e] && r[e](t)
  169. }
  170. }
  171. function U() {
  172. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div",
  173. t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  174. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
  175. r = arguments[3],
  176. n = l.createElement(e);
  177. return Object.getOwnPropertyNames(t).forEach(function(e) {
  178. var i = t[e]; - 1 !== e.indexOf("aria-") || "role" === e || "type" === e ? (p.warn(g(O, e, i)), n
  179. .setAttribute(e, i)) : "textContent" === e ? N(n, i) : n[e] = i
  180. }), Object.getOwnPropertyNames(i).forEach(function(e) {
  181. n.setAttribute(e, i[e])
  182. }), r && ie(n, r), n
  183. }
  184. function N(e, t) {
  185. return void 0 === e.textContent ? e.innerText = t : e.textContent = t, e
  186. }
  187. function B(e, t) {
  188. t.firstChild ? t.insertBefore(e, t.firstChild) : t.appendChild(e)
  189. }
  190. function F(e, t) {
  191. return D(t), e.classList ? e.classList.contains(t) : (i = t, new RegExp("(^|\\s)" + i + "($|\\s)")).test(e
  192. .className);
  193. var i
  194. }
  195. function j(e, t) {
  196. return e.classList ? e.classList.add(t) : F(e, t) || (e.className = (e.className + " " + t).trim()), e
  197. }
  198. function H(e, t) {
  199. return e.classList ? e.classList.remove(t) : (D(t), e.className = e.className.split(/\s+/).filter(function(e) {
  200. return e !== t
  201. }).join(" ")), e
  202. }
  203. function G(e, t, i) {
  204. var r = F(e, t);
  205. if ("function" == typeof i && (i = i(e, t)), "boolean" != typeof i && (i = !r), i !== r) return i ? j(e, t) : H(e,
  206. t), e
  207. }
  208. function V(e, t) {
  209. Object.getOwnPropertyNames(t).forEach(function(i) {
  210. var r = t[i];
  211. null === r || void 0 === r || !1 === r ? e.removeAttribute(i) : e.setAttribute(i, !0 === r ? "" : r)
  212. })
  213. }
  214. function W(e) {
  215. var t = {},
  216. i = ",autoplay,stretch,fluent,controls,playsinline,loop,muted,default,defaultMuted,";
  217. if (e && e.attributes && e.attributes.length > 0)
  218. for (var r = e.attributes, n = r.length - 1; n >= 0; n--) {
  219. var a = r[n].name,
  220. s = r[n].value;
  221. "boolean" != typeof e[a] && -1 === i.indexOf("," + a + ",") || (s = null !== s), t[a] = s
  222. }
  223. return t
  224. }
  225. function q(e, t) {
  226. return e.getAttribute(t)
  227. }
  228. function X(e, t, i) {
  229. e.setAttribute(t, i)
  230. }
  231. function z(e, t) {
  232. e.removeAttribute(t)
  233. }
  234. function K() {
  235. l.body.focus(), l.onselectstart = function() {
  236. return !1
  237. }
  238. }
  239. function Y() {
  240. l.onselectstart = function() {
  241. return !0
  242. }
  243. }
  244. function Q(e) {
  245. if (e && e.getBoundingClientRect && e.parentNode) {
  246. var t = e.getBoundingClientRect(),
  247. i = {};
  248. return ["bottom", "height", "left", "right", "top", "width"].forEach(function(e) {
  249. void 0 !== t[e] && (i[e] = t[e])
  250. }), i.height || (i.height = parseFloat(M(e, "height"))), i.width || (i.width = parseFloat(M(e, "width"))), i
  251. }
  252. }
  253. function J(e) {
  254. var t = void 0;
  255. if (e.getBoundingClientRect && e.parentNode && (t = e.getBoundingClientRect()), !t) return {
  256. left: 0,
  257. top: 0
  258. };
  259. var i = l.documentElement,
  260. r = l.body,
  261. a = i.clientLeft || r.clientLeft || 0,
  262. s = n.pageXOffset || r.scrollLeft,
  263. o = t.left + s - a,
  264. u = i.clientTop || r.clientTop || 0,
  265. d = n.pageYOffset || r.scrollTop,
  266. c = t.top + d - u;
  267. return {
  268. left: Math.round(o),
  269. top: Math.round(c)
  270. }
  271. }
  272. function Z(e, t) {
  273. var i = {},
  274. r = J(e),
  275. n = e.offsetWidth,
  276. a = e.offsetHeight,
  277. s = r.top,
  278. o = r.left,
  279. u = t.pageY,
  280. l = t.pageX;
  281. return t.changedTouches && (l = t.changedTouches[0].pageX, u = t.changedTouches[0].pageY), i.y = Math.max(0, Math
  282. .min(1, (s - u + a) / a)), i.x = Math.max(0, Math.min(1, (l - o) / n)), i
  283. }
  284. function $(e) {
  285. return k(e) && 3 === e.nodeType
  286. }
  287. function ee(e) {
  288. for (; e.firstChild;) e.removeChild(e.firstChild);
  289. return e
  290. }
  291. function te(e) {
  292. return "function" == typeof e && (e = e()), (Array.isArray(e) ? e : [e]).map(function(e) {
  293. return "function" == typeof e && (e = e()), L(e) || $(e) ? e : "string" == typeof e && /\S/.test(e) ? l
  294. .createTextNode(e) : void 0
  295. }).filter(function(e) {
  296. return e
  297. })
  298. }
  299. function ie(e, t) {
  300. return te(t).forEach(function(t) {
  301. return e.appendChild(t)
  302. }), e
  303. }
  304. function re(e, t) {
  305. return ie(ee(e), t)
  306. }
  307. function ne(e) {
  308. return void 0 === e.button && void 0 === e.buttons || (0 === e.button && void 0 === e.buttons || 0 === e.button &&
  309. 1 === e.buttons)
  310. }
  311. var ae = P("querySelector"),
  312. se = P("querySelectorAll"),
  313. oe = Object.freeze({
  314. isReal: I,
  315. isEl: L,
  316. isInFrame: x,
  317. createEl: U,
  318. textContent: N,
  319. prependTo: B,
  320. hasClass: F,
  321. addClass: j,
  322. removeClass: H,
  323. toggleClass: G,
  324. setAttributes: V,
  325. getAttributes: W,
  326. getAttribute: q,
  327. setAttribute: X,
  328. removeAttribute: z,
  329. blockTextSelection: K,
  330. unblockTextSelection: Y,
  331. getBoundingClientRect: Q,
  332. findPosition: J,
  333. getPointerPosition: Z,
  334. isTextNode: $,
  335. emptyEl: ee,
  336. normalizeContent: te,
  337. appendContent: ie,
  338. insertContent: re,
  339. isSingleLeftClick: ne,
  340. $: ae,
  341. $$: se
  342. }),
  343. ue = 1;
  344. function le() {
  345. return ue++
  346. }
  347. var de = {},
  348. ce = "vdata" + (new Date).getTime();
  349. function he(e) {
  350. var t = e[ce];
  351. return t || (t = e[ce] = le()), de[t] || (de[t] = {}), de[t]
  352. }
  353. function fe(e) {
  354. var t = e[ce];
  355. return !!t && !!Object.getOwnPropertyNames(de[t]).length
  356. }
  357. function pe(e) {
  358. var t = e[ce];
  359. if (t) {
  360. delete de[t];
  361. try {
  362. delete e[ce]
  363. } catch (t) {
  364. e.removeAttribute ? e.removeAttribute(ce) : e[ce] = null
  365. }
  366. }
  367. }
  368. function me(e, t) {
  369. var i = he(e);
  370. 0 === i.handlers[t].length && (delete i.handlers[t], e.removeEventListener ? e.removeEventListener(t, i
  371. .dispatcher, !1) : e.detachEvent && e.detachEvent("on" + t, i.dispatcher)), Object.getOwnPropertyNames(i
  372. .handlers).length <= 0 && (delete i.handlers, delete i.dispatcher, delete i.disabled), 0 === Object
  373. .getOwnPropertyNames(i).length && pe(e)
  374. }
  375. function ge(e, t, i, r) {
  376. i.forEach(function(i) {
  377. e(t, i, r)
  378. })
  379. }
  380. function ve(e) {
  381. function t() {
  382. return !0
  383. }
  384. function i() {
  385. return !1
  386. }
  387. if (!e || !e.isPropagationStopped) {
  388. var r = e || n.event;
  389. for (var a in e = {}, r) "layerX" !== a && "layerY" !== a && "keyLocation" !== a && "webkitMovementX" !== a &&
  390. "webkitMovementY" !== a && ("returnValue" === a && r.preventDefault || (e[a] = r[a]));
  391. if (e.target || (e.target = e.srcElement || l), e.relatedTarget || (e.relatedTarget = e.fromElement === e
  392. .target ? e.toElement : e.fromElement), e.preventDefault = function() {
  393. r.preventDefault && r.preventDefault(), e.returnValue = !1, r.returnValue = !1, e.defaultPrevented = !0
  394. }, e.defaultPrevented = !1, e.stopPropagation = function() {
  395. r.stopPropagation && r.stopPropagation(), e.cancelBubble = !0, r.cancelBubble = !0, e.isPropagationStopped =
  396. t
  397. }, e.isPropagationStopped = i, e.stopImmediatePropagation = function() {
  398. r.stopImmediatePropagation && r.stopImmediatePropagation(), e.isImmediatePropagationStopped = t, e
  399. .stopPropagation()
  400. }, e.isImmediatePropagationStopped = i, null !== e.clientX && void 0 !== e.clientX) {
  401. var s = l.documentElement,
  402. o = l.body;
  403. e.pageX = e.clientX + (s && s.scrollLeft || o && o.scrollLeft || 0) - (s && s.clientLeft || o && o
  404. .clientLeft || 0), e.pageY = e.clientY + (s && s.scrollTop || o && o.scrollTop || 0) - (s && s
  405. .clientTop || o && o.clientTop || 0)
  406. }
  407. e.which = e.charCode || e.keyCode, null !== e.button && void 0 !== e.button && (e.button = 1 & e.button ? 0 :
  408. 4 & e.button ? 1 : 2 & e.button ? 2 : 0)
  409. }
  410. return e
  411. }
  412. var ye = !1;
  413. ! function() {
  414. try {
  415. var e = Object.defineProperty({}, "passive", {
  416. get: function() {
  417. ye = !0
  418. }
  419. });
  420. n.addEventListener("test", null, e), n.removeEventListener("test", null, e)
  421. } catch (e) {}
  422. }();
  423. var _e = ["touchstart", "touchmove"];
  424. function be(e, t, i) {
  425. if (Array.isArray(t)) return ge(be, e, t, i);
  426. var r = he(e);
  427. if (r.handlers || (r.handlers = {}), r.handlers[t] || (r.handlers[t] = []), i.guid || (i.guid = le()), r.handlers[
  428. t].push(i), r.dispatcher || (r.disabled = !1, r.dispatcher = function(t, i) {
  429. if (!r.disabled) {
  430. t = ve(t);
  431. var n = r.handlers[t.type];
  432. if (n)
  433. for (var a = n.slice(0), s = 0, o = a.length; s < o && !t.isImmediatePropagationStopped(); s++) try {
  434. a[s].call(e, t, i)
  435. } catch (e) {
  436. p.error(e)
  437. }
  438. }
  439. }), 1 === r.handlers[t].length)
  440. if (e.addEventListener) {
  441. var n = !1;
  442. ye && _e.indexOf(t) > -1 && (n = {
  443. passive: !0
  444. }), e.addEventListener(t, r.dispatcher, n)
  445. } else e.attachEvent && e.attachEvent("on" + t, r.dispatcher)
  446. }
  447. function we(e, t, i) {
  448. if (fe(e)) {
  449. var r = he(e);
  450. if (r.handlers) {
  451. if (Array.isArray(t)) return ge(we, e, t, i);
  452. var n = function(e, t) {
  453. r.handlers[t] = [], me(e, t)
  454. };
  455. if (void 0 !== t) {
  456. var a = r.handlers[t];
  457. if (a)
  458. if (i) {
  459. if (i.guid)
  460. for (var s = 0; s < a.length; s++) a[s].guid === i.guid && a.splice(s--, 1);
  461. me(e, t)
  462. } else n(e, t)
  463. } else
  464. for (var o in r.handlers) Object.prototype.hasOwnProperty.call(r.handlers || {}, o) && n(e, o)
  465. }
  466. }
  467. }
  468. function Ee(e, t, i) {
  469. var r = fe(e) ? he(e) : {},
  470. n = e.parentNode || e.ownerDocument;
  471. if ("string" == typeof t ? t = {
  472. type: t,
  473. target: e
  474. } : t.target || (t.target = e), t = ve(t), r.dispatcher && r.dispatcher.call(e, t, i), n && !t
  475. .isPropagationStopped() && !0 === t.bubbles) Ee.call(null, n, t, i);
  476. else if (!n && !t.defaultPrevented) {
  477. var a = he(t.target);
  478. t.target[t.type] && (a.disabled = !0, "function" == typeof t.target[t.type] && t.target[t.type](), a
  479. .disabled = !1)
  480. }
  481. return !t.defaultPrevented
  482. }
  483. function Te(e, t, i) {
  484. if (Array.isArray(t)) return ge(Te, e, t, i);
  485. var r = function r() {
  486. we(e, t, r), i.apply(this, arguments)
  487. };
  488. r.guid = i.guid = i.guid || le(), be(e, t, r)
  489. }
  490. var Se = Object.freeze({
  491. fixEvent: ve,
  492. on: be,
  493. off: we,
  494. trigger: Ee,
  495. one: Te
  496. }),
  497. Ae = !1,
  498. ke = void 0,
  499. Re = function() {
  500. if (I() && !1 !== ke.options.autoSetup) {
  501. var e = Array.prototype.slice.call(l.getElementsByTagName("video")),
  502. t = Array.prototype.slice.call(l.getElementsByTagName("audio")),
  503. i = Array.prototype.slice.call(l.getElementsByTagName("video-js")),
  504. r = e.concat(t, i);
  505. if (r && r.length > 0)
  506. for (var n = 0, a = r.length; n < a; n++) {
  507. var s = r[n];
  508. if (!s || !s.getAttribute) {
  509. Me(1);
  510. break
  511. }
  512. void 0 === s.player && null !== s.getAttribute("data-setup") && ke(s)
  513. } else Ae || Me(1)
  514. }
  515. };
  516. function Me(e, t) {
  517. t && (ke = t), n.setTimeout(Re, e)
  518. }
  519. I() && "complete" === l.readyState ? Ae = !0 : Te(n, "load", function() {
  520. Ae = !0
  521. });
  522. var Oe = function(e) {
  523. var t = l.createElement("style");
  524. return t.className = e, t
  525. },
  526. Ce = function(e, t) {
  527. e.styleSheet ? e.styleSheet.cssText = t : e.textContent = t
  528. },
  529. De = function(e, t, i) {
  530. t.guid || (t.guid = le());
  531. var r = function() {
  532. return t.apply(e, arguments)
  533. };
  534. return r.guid = i ? i + "_" + t.guid : t.guid, r
  535. },
  536. Ie = function(e, t) {
  537. var i = Date.now();
  538. return function() {
  539. var r = Date.now();
  540. r - i >= t && (e.apply(void 0, arguments), i = r)
  541. }
  542. },
  543. Le = function(e, t, i) {
  544. var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : n,
  545. a = void 0,
  546. s = function() {
  547. var n = this,
  548. s = arguments,
  549. o = function() {
  550. a = null, o = null, i || e.apply(n, s)
  551. };
  552. !a && i && e.apply(n, s), r.clearTimeout(a), a = r.setTimeout(o, t)
  553. };
  554. return s.cancel = function() {
  555. r.clearTimeout(a), a = null
  556. }, s
  557. },
  558. xe = function() {};
  559. xe.prototype.allowedEvents_ = {}, xe.prototype.on = function(e, t) {
  560. var i = this.addEventListener;
  561. this.addEventListener = function() {}, be(this, e, t), this.addEventListener = i
  562. }, xe.prototype.addEventListener = xe.prototype.on, xe.prototype.off = function(e, t) {
  563. we(this, e, t)
  564. }, xe.prototype.removeEventListener = xe.prototype.off, xe.prototype.one = function(e, t) {
  565. var i = this.addEventListener;
  566. this.addEventListener = function() {}, Te(this, e, t), this.addEventListener = i
  567. }, xe.prototype.trigger = function(e) {
  568. var t = e.type || e;
  569. "string" == typeof e && (e = {
  570. type: t
  571. }), e = ve(e), this.allowedEvents_[t] && this["on" + t] && this["on" + t](e), Ee(this, e)
  572. }, xe.prototype.dispatchEvent = xe.prototype.trigger;
  573. var Pe = void 0;
  574. xe.prototype.queueTrigger = function(e) {
  575. var t = this;
  576. Pe || (Pe = new Map);
  577. var i = e.type || e,
  578. r = Pe.get(this);
  579. r || (r = new Map, Pe.set(this, r));
  580. var a = r.get(i);
  581. r.delete(i), n.clearTimeout(a);
  582. var s = n.setTimeout(function() {
  583. 0 === r.size && (r = null, Pe.delete(t)), t.trigger(e)
  584. }, 0);
  585. r.set(i, s)
  586. };
  587. var Ue = function(e) {
  588. return e instanceof xe || !!e.eventBusEl_ && ["on", "one", "off", "trigger"].every(function(t) {
  589. return "function" == typeof e[t]
  590. })
  591. },
  592. Ne = function(e) {
  593. return "string" == typeof e && /\S/.test(e) || Array.isArray(e) && !!e.length
  594. },
  595. Be = function(e) {
  596. if (!e.nodeName && !Ue(e)) throw new Error("Invalid target; must be a DOM node or evented object.")
  597. },
  598. Fe = function(e) {
  599. if (!Ne(e)) throw new Error("Invalid event type; must be a non-empty string or array.")
  600. },
  601. je = function(e) {
  602. if ("function" != typeof e) throw new Error("Invalid listener; must be a function.")
  603. },
  604. He = function(e, t) {
  605. var i = t.length < 3 || t[0] === e || t[0] === e.eventBusEl_,
  606. r = void 0,
  607. n = void 0,
  608. a = void 0;
  609. return i ? (r = e.eventBusEl_, t.length >= 3 && t.shift(), n = t[0], a = t[1]) : (r = t[0], n = t[1], a = t[2]),
  610. Be(r), Fe(n), je(a), {
  611. isTargetingSelf: i,
  612. target: r,
  613. type: n,
  614. listener: a = De(e, a)
  615. }
  616. },
  617. Ge = function(e, t, i, r) {
  618. Be(e), e.nodeName ? Se[t](e, i, r) : e[t](i, r)
  619. },
  620. Ve = {
  621. on: function() {
  622. for (var e = this, t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r];
  623. var n = He(this, i),
  624. a = n.isTargetingSelf,
  625. s = n.target,
  626. o = n.type,
  627. u = n.listener;
  628. if (Ge(s, "on", o, u), !a) {
  629. var l = function() {
  630. return e.off(s, o, u)
  631. };
  632. l.guid = u.guid;
  633. var d = function() {
  634. return e.off("dispose", l)
  635. };
  636. d.guid = u.guid, Ge(this, "on", "dispose", l), Ge(s, "on", "dispose", d)
  637. }
  638. },
  639. one: function() {
  640. for (var e = this, t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r];
  641. var n = He(this, i),
  642. a = n.isTargetingSelf,
  643. s = n.target,
  644. o = n.type,
  645. u = n.listener;
  646. if (a) Ge(s, "one", o, u);
  647. else {
  648. var l = function t() {
  649. for (var i = arguments.length, r = Array(i), n = 0; n < i; n++) r[n] = arguments[n];
  650. e.off(s, o, t), u.apply(null, r)
  651. };
  652. l.guid = u.guid, Ge(s, "one", o, l)
  653. }
  654. },
  655. off: function(e, t, i) {
  656. if (!e || Ne(e)) we(this.eventBusEl_, e, t);
  657. else {
  658. var r = e,
  659. n = t;
  660. Be(r), Fe(n), je(i), i = De(this, i), this.off("dispose", i), r.nodeName ? (we(r, n, i), we(r, "dispose",
  661. i)) : Ue(r) && (r.off(n, i), r.off("dispose", i))
  662. }
  663. },
  664. trigger: function(e, t) {
  665. return Ee(this.eventBusEl_, e, t)
  666. }
  667. };
  668. function We(e) {
  669. var t = (arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}).eventBusKey;
  670. if (t) {
  671. if (!e[t].nodeName) throw new Error('The eventBusKey "' + t + '" does not refer to an element.');
  672. e.eventBusEl_ = e[t]
  673. } else e.eventBusEl_ = U("span", {
  674. className: "vjs-event-bus"
  675. });
  676. return A(e, Ve), e.on("dispose", function() {
  677. e.off(), n.setTimeout(function() {
  678. e.eventBusEl_ = null
  679. }, 0)
  680. }), e
  681. }
  682. var qe = {
  683. state: {},
  684. setState: function(e) {
  685. var t = this;
  686. "function" == typeof e && (e = e());
  687. var i = void 0;
  688. return S(e, function(e, r) {
  689. t.state[r] !== e && ((i = i || {})[r] = {
  690. from: t.state[r],
  691. to: e
  692. }), t.state[r] = e
  693. }), i && Ue(this) && this.trigger({
  694. changes: i,
  695. type: "statechanged"
  696. }), i
  697. }
  698. };
  699. function Xe(e, t) {
  700. return A(e, qe), e.state = A({}, e.state, t), "function" == typeof e.handleStateChanged && Ue(e) && e.on(
  701. "statechanged", e.handleStateChanged), e
  702. }
  703. function ze(e) {
  704. return "string" != typeof e ? e : e.charAt(0).toUpperCase() + e.slice(1)
  705. }
  706. function Ke() {
  707. for (var e = {}, t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r];
  708. return i.forEach(function(t) {
  709. t && S(t, function(t, i) {
  710. R(t) ? (R(e[i]) || (e[i] = {}), e[i] = Ke(e[i], t)) : e[i] = t
  711. })
  712. }), e
  713. }
  714. var Ye = function() {
  715. function e(t, i, r) {
  716. if (y(this, e), !t && this.play ? this.player_ = t = this : this.player_ = t, this.options_ = Ke({}, this
  717. .options_), i = this.options_ = Ke(this.options_, i), this.id_ = i.id || i.el && i.el.id, !this.id_) {
  718. var n = t && t.id && t.id() || "no_player";
  719. this.id_ = n + "_component_" + le()
  720. }
  721. this.name_ = i.name || null, i.el ? this.el_ = i.el : !1 !== i.createEl && (this.el_ = this.createEl()), !
  722. 1 !== i.evented && We(this, {
  723. eventBusKey: this.el_ ? "el_" : null
  724. }), Xe(this, this.constructor.defaultState), this.children_ = [], this.childIndex_ = {}, this
  725. .childNameIndex_ = {}, !1 !== i.initChildren && this.initChildren(), this.ready(r), !1 !== i
  726. .reportTouchActivity && this.enableTouchActivity()
  727. }
  728. return e.prototype.dispose = function() {
  729. if (this.trigger({
  730. type: "dispose",
  731. bubbles: !1
  732. }), this.children_)
  733. for (var e = this.children_.length - 1; e >= 0; e--) this.children_[e].dispose && this.children_[e]
  734. .dispose();
  735. this.children_ = null, this.childIndex_ = null, this.childNameIndex_ = null, this.el_ && (this.el_
  736. .parentNode && this.el_.parentNode.removeChild(this.el_), pe(this.el_), this.el_ = null), this.player_ =
  737. null
  738. }, e.prototype.player = function() {
  739. return this.player_
  740. }, e.prototype.options = function(e) {
  741. return p.warn("this.options() has been deprecated and will be moved to the constructor in 6.0"), e ? (this
  742. .options_ = Ke(this.options_, e), this.options_) : this.options_
  743. }, e.prototype.el = function() {
  744. return this.el_
  745. }, e.prototype.createEl = function(e, t, i) {
  746. return U(e, t, i)
  747. }, e.prototype.localize = function(e, t) {
  748. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e,
  749. r = this.player_.language && this.player_.language(),
  750. n = this.player_.languages && this.player_.languages(),
  751. a = n && n[r],
  752. s = r && r.split("-")[0],
  753. o = n && n[s],
  754. u = i;
  755. return a && a[e] ? u = a[e] : o && o[e] && (u = o[e]), t && (u = u.replace(/\{(\d+)\}/g, function(e, i) {
  756. var r = t[i - 1],
  757. n = r;
  758. return void 0 === r && (n = e), n
  759. })), u
  760. }, e.prototype.contentEl = function() {
  761. return this.contentEl_ || this.el_
  762. }, e.prototype.id = function() {
  763. return this.id_
  764. }, e.prototype.name = function() {
  765. return this.name_
  766. }, e.prototype.children = function() {
  767. return this.children_
  768. }, e.prototype.getChildById = function(e) {
  769. return this.childIndex_[e]
  770. }, e.prototype.getChild = function(e) {
  771. if (e) return e = ze(e), this.childNameIndex_[e]
  772. }, e.prototype.addChild = function(t) {
  773. var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  774. r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : this.children_.length,
  775. n = void 0,
  776. a = void 0;
  777. if ("string" == typeof t) {
  778. a = ze(t);
  779. var s = i.componentClass || a;
  780. i.name = a;
  781. var o = e.getComponent(s);
  782. if (!o) throw new Error("Component " + s + " does not exist");
  783. if ("function" != typeof o) return null;
  784. n = new o(this.player_ || this, i)
  785. } else n = t;
  786. if (this.children_.splice(r, 0, n), "function" == typeof n.id && (this.childIndex_[n.id()] = n), (a = a || n
  787. .name && ze(n.name())) && (this.childNameIndex_[a] = n), "function" == typeof n.el && n.el()) {
  788. var u = this.contentEl().children[r] || null;
  789. this.contentEl().insertBefore(n.el(), u)
  790. }
  791. return n
  792. }, e.prototype.removeChild = function(e) {
  793. if ("string" == typeof e && (e = this.getChild(e)), e && this.children_) {
  794. for (var t = !1, i = this.children_.length - 1; i >= 0; i--)
  795. if (this.children_[i] === e) {
  796. t = !0, this.children_.splice(i, 1);
  797. break
  798. } if (t) {
  799. this.childIndex_[e.id()] = null, this.childNameIndex_[e.name()] = null;
  800. var r = e.el();
  801. r && r.parentNode === this.contentEl() && this.contentEl().removeChild(e.el())
  802. }
  803. }
  804. }, e.prototype.initChildren = function() {
  805. var t = this,
  806. i = this.options_.children;
  807. if (i) {
  808. var r = this.options_,
  809. n = void 0,
  810. a = e.getComponent("Tech");
  811. (n = Array.isArray(i) ? i : Object.keys(i)).concat(Object.keys(this.options_).filter(function(e) {
  812. return !n.some(function(t) {
  813. return "string" == typeof t ? e === t : e === t.name
  814. })
  815. })).map(function(e) {
  816. var r = void 0,
  817. n = void 0;
  818. return "string" == typeof e ? n = i[r = e] || t.options_[r] || {} : (r = e.name, n = e), {
  819. name: r,
  820. opts: n
  821. }
  822. }).filter(function(t) {
  823. var i = e.getComponent(t.opts.componentClass || ze(t.name));
  824. return i && !a.isTech(i)
  825. }).forEach(function(e) {
  826. var i = e.name,
  827. n = e.opts;
  828. if (void 0 !== r[i] && (n = r[i]), !1 !== n) {
  829. !0 === n && (n = {}), n.playerOptions = t.options_.playerOptions;
  830. var a = t.addChild(i, n);
  831. a && (t[i] = a)
  832. }
  833. })
  834. }
  835. }, e.prototype.buildCSSClass = function() {
  836. return ""
  837. }, e.prototype.ready = function(e) {
  838. var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  839. if (e) return this.isReady_ ? void(t ? e.call(this) : this.setTimeout(e, 1)) : (this.readyQueue_ = this
  840. .readyQueue_ || [], void this.readyQueue_.push(e))
  841. }, e.prototype.triggerReady = function() {
  842. this.isReady_ = !0, this.setTimeout(function() {
  843. var e = this.readyQueue_;
  844. this.readyQueue_ = [], e && e.length > 0 && e.forEach(function(e) {
  845. e.call(this)
  846. }, this), this.trigger("ready")
  847. }, 1)
  848. }, e.prototype.$ = function(e, t) {
  849. return ae(e, t || this.contentEl())
  850. }, e.prototype.$$ = function(e, t) {
  851. return se(e, t || this.contentEl())
  852. }, e.prototype.hasClass = function(e) {
  853. return F(this.el_, e)
  854. }, e.prototype.addClass = function(e) {
  855. j(this.el_, e)
  856. }, e.prototype.removeClass = function(e) {
  857. H(this.el_, e)
  858. }, e.prototype.toggleClass = function(e, t) {
  859. G(this.el_, e, t)
  860. }, e.prototype.show = function() {
  861. this.removeClass("vjs-hidden")
  862. }, e.prototype.hide = function() {
  863. this.addClass("vjs-hidden")
  864. }, e.prototype.lockShowing = function() {
  865. this.addClass("vjs-lock-showing")
  866. }, e.prototype.unlockShowing = function() {
  867. this.removeClass("vjs-lock-showing")
  868. }, e.prototype.getAttribute = function(e) {
  869. return q(this.el_, e)
  870. }, e.prototype.setAttribute = function(e, t) {
  871. X(this.el_, e, t)
  872. }, e.prototype.removeAttribute = function(e) {
  873. z(this.el_, e)
  874. }, e.prototype.width = function(e, t) {
  875. return this.dimension("width", e, t)
  876. }, e.prototype.height = function(e, t) {
  877. return this.dimension("height", e, t)
  878. }, e.prototype.dimensions = function(e, t) {
  879. this.width(e, !0), this.height(t)
  880. }, e.prototype.dimension = function(e, t, i) {
  881. if (void 0 !== t) return null !== t && t == t || (t = 0), -1 !== ("" + t).indexOf("%") || -1 !== ("" + t)
  882. .indexOf("px") ? this.el_.style[e] = t : this.el_.style[e] = "auto" === t ? "" : t + "px", void(i ||
  883. this.trigger("componentresize"));
  884. if (!this.el_) return 0;
  885. var r = this.el_.style[e],
  886. n = r.indexOf("px");
  887. return -1 !== n ? parseInt(r.slice(0, n), 10) : parseInt(this.el_["offset" + ze(e)], 10)
  888. }, e.prototype.currentDimension = function(e) {
  889. var t = 0;
  890. if ("width" !== e && "height" !== e) throw new Error("currentDimension only accepts width or height value");
  891. if ("function" == typeof n.getComputedStyle) {
  892. var i = n.getComputedStyle(this.el_);
  893. t = i.getPropertyValue(e) || i[e]
  894. }
  895. if (0 === (t = parseFloat(t))) {
  896. var r = "offset" + ze(e);
  897. t = this.el_[r]
  898. }
  899. return t
  900. }, e.prototype.currentDimensions = function() {
  901. return {
  902. width: this.currentDimension("width"),
  903. height: this.currentDimension("height")
  904. }
  905. }, e.prototype.currentWidth = function() {
  906. return this.currentDimension("width")
  907. }, e.prototype.currentHeight = function() {
  908. return this.currentDimension("height")
  909. }, e.prototype.focus = function() {
  910. this.el_.focus()
  911. }, e.prototype.blur = function() {
  912. this.el_.blur()
  913. }, e.prototype.emitTapEvents = function() {
  914. var e = 0,
  915. t = null,
  916. i = void 0;
  917. this.on("touchstart", function(r) {
  918. 1 === r.touches.length && (t = {
  919. pageX: r.touches[0].pageX,
  920. pageY: r.touches[0].pageY
  921. }, e = (new Date).getTime(), i = !0)
  922. }), this.on("touchmove", function(e) {
  923. if (e.touches.length > 1) i = !1;
  924. else if (t) {
  925. var r = e.touches[0].pageX - t.pageX,
  926. n = e.touches[0].pageY - t.pageY;
  927. Math.sqrt(r * r + n * n) > 10 && (i = !1)
  928. }
  929. });
  930. var r = function() {
  931. i = !1
  932. };
  933. this.on("touchleave", r), this.on("touchcancel", r), this.on("touchend", function(r) {
  934. (t = null, !0 === i) && ((new Date).getTime() - e < 200 && (r.preventDefault(), this.trigger("tap")))
  935. })
  936. }, e.prototype.enableTouchActivity = function() {
  937. if (this.player() && this.player().reportUserActivity) {
  938. var e = De(this.player(), this.player().reportUserActivity),
  939. t = void 0;
  940. this.on("touchstart", function() {
  941. e(), this.clearInterval(t), t = this.setInterval(e, 250)
  942. });
  943. var i = function(i) {
  944. e(), this.clearInterval(t)
  945. };
  946. this.on("touchmove", e), this.on("touchend", i), this.on("touchcancel", i)
  947. }
  948. }, e.prototype.setTimeout = function(e, t) {
  949. var i, r, a = this;
  950. return e = De(this, e), i = n.setTimeout(function() {
  951. a.off("dispose", r), e()
  952. }, t), (r = function() {
  953. return a.clearTimeout(i)
  954. }).guid = "vjs-timeout-" + i, this.on("dispose", r), i
  955. }, e.prototype.clearTimeout = function(e) {
  956. n.clearTimeout(e);
  957. var t = function() {};
  958. return t.guid = "vjs-timeout-" + e, this.off("dispose", t), e
  959. }, e.prototype.setInterval = function(e, t) {
  960. var i = this;
  961. e = De(this, e);
  962. var r = n.setInterval(e, t),
  963. a = function() {
  964. return i.clearInterval(r)
  965. };
  966. return a.guid = "vjs-interval-" + r, this.on("dispose", a), r
  967. }, e.prototype.clearInterval = function(e) {
  968. n.clearInterval(e);
  969. var t = function() {};
  970. return t.guid = "vjs-interval-" + e, this.off("dispose", t), e
  971. }, e.prototype.requestAnimationFrame = function(e) {
  972. var t, i, r = this;
  973. return this.supportsRaf_ ? (e = De(this, e), t = n.requestAnimationFrame(function() {
  974. r.off("dispose", i), e()
  975. }), (i = function() {
  976. return r.cancelAnimationFrame(t)
  977. }).guid = "vjs-raf-" + t, this.on("dispose", i), t) : this.setTimeout(e, 1e3 / 60)
  978. }, e.prototype.cancelAnimationFrame = function(e) {
  979. if (this.supportsRaf_) {
  980. n.cancelAnimationFrame(e);
  981. var t = function() {};
  982. return t.guid = "vjs-raf-" + e, this.off("dispose", t), e
  983. }
  984. return this.clearTimeout(e)
  985. }, e.registerComponent = function(t, i) {
  986. if ("string" != typeof t || !t) throw new Error('Illegal component name, "' + t +
  987. '"; must be a non-empty string.');
  988. var r = e.getComponent("Tech"),
  989. n = r && r.isTech(i),
  990. a = e === i || e.prototype.isPrototypeOf(i.prototype);
  991. if (n || !a) {
  992. var s = void 0;
  993. throw s = n ? "techs must be registered using Tech.registerTech()" : "must be a Component subclass",
  994. new Error('Illegal component, "' + t + '"; ' + s + ".")
  995. }
  996. t = ze(t), e.components_ || (e.components_ = {});
  997. var o = e.getComponent("Player");
  998. if ("Player" === t && o && o.players) {
  999. var u = o.players,
  1000. l = Object.keys(u);
  1001. if (u && l.length > 0 && l.map(function(e) {
  1002. return u[e]
  1003. }).every(Boolean)) throw new Error("Can not register Player component after player has been created.")
  1004. }
  1005. return e.components_[t] = i, i
  1006. }, e.getComponent = function(t) {
  1007. if (t) return t = ze(t), e.components_ && e.components_[t] ? e.components_[t] : void 0
  1008. }, e
  1009. }();
  1010. Ye.prototype.supportsRaf_ = "function" == typeof n.requestAnimationFrame && "function" == typeof n
  1011. .cancelAnimationFrame, Ye.registerComponent("Component", Ye);
  1012. var Qe, Je = n.navigator && n.navigator.userAgent || "",
  1013. Ze = /AppleWebKit\/([\d.]+)/i.exec(Je),
  1014. $e = Ze ? parseFloat(Ze.pop()) : null,
  1015. et = /iPad/i.test(Je),
  1016. tt = /iPhone/i.test(Je) && !et,
  1017. it = /iPod/i.test(Je),
  1018. rt = tt || et || it,
  1019. nt = (Qe = Je.match(/OS (\d+)_/i)) && Qe[1] ? Qe[1] : null,
  1020. at = /Android/i.test(Je),
  1021. st = function() {
  1022. var e = Je.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  1023. if (!e) return null;
  1024. var t = e[1] && parseFloat(e[1]),
  1025. i = e[2] && parseFloat(e[2]);
  1026. return t && i ? parseFloat(e[1] + "." + e[2]) : t || null
  1027. }(),
  1028. ot = at && st < 5 && $e < 537,
  1029. ut = /Firefox/i.test(Je),
  1030. lt = /Edge/i.test(Je),
  1031. dt = !lt && (/Chrome/i.test(Je) || /CriOS/i.test(Je)),
  1032. ct = function() {
  1033. var e = Je.match(/(Chrome|CriOS)\/(\d+)/);
  1034. return e && e[2] ? parseFloat(e[2]) : null
  1035. }(),
  1036. ht = function() {
  1037. var e = /MSIE\s(\d+)\.\d/.exec(Je),
  1038. t = e && parseFloat(e[1]);
  1039. return !t && /Trident\/7.0/i.test(Je) && /rv:11.0/.test(Je) && (t = 11), t
  1040. }(),
  1041. ft = /Safari/i.test(Je) && !dt && !at && !lt,
  1042. pt = (ft || rt) && !dt,
  1043. mt = I() && ("ontouchstart" in n || n.navigator.maxTouchPoints || n.DocumentTouch && n.document instanceof n
  1044. .DocumentTouch),
  1045. gt = Object.freeze({
  1046. IS_IPAD: et,
  1047. IS_IPHONE: tt,
  1048. IS_IPOD: it,
  1049. IS_IOS: rt,
  1050. IOS_VERSION: nt,
  1051. IS_ANDROID: at,
  1052. ANDROID_VERSION: st,
  1053. IS_NATIVE_ANDROID: ot,
  1054. IS_FIREFOX: ut,
  1055. IS_EDGE: lt,
  1056. IS_CHROME: dt,
  1057. CHROME_VERSION: ct,
  1058. IE_VERSION: ht,
  1059. IS_SAFARI: ft,
  1060. IS_ANY_SAFARI: pt,
  1061. TOUCH_ENABLED: mt
  1062. });
  1063. function vt(e, t, i, r) {
  1064. return function(e, t, i) {
  1065. if ("number" != typeof t || t < 0 || t > i) throw new Error("Failed to execute '" + e +
  1066. "' on 'TimeRanges': The index provided (" + t + ") is non-numeric or out of bounds (0-" + i + ").")
  1067. }(e, r, i.length - 1), i[r][t]
  1068. }
  1069. function yt(e) {
  1070. return void 0 === e || 0 === e.length ? {
  1071. length: 0,
  1072. start: function() {
  1073. throw new Error("This TimeRanges object is empty")
  1074. },
  1075. end: function() {
  1076. throw new Error("This TimeRanges object is empty")
  1077. }
  1078. } : {
  1079. length: e.length,
  1080. start: vt.bind(null, "start", 0, e),
  1081. end: vt.bind(null, "end", 1, e)
  1082. }
  1083. }
  1084. function _t(e, t) {
  1085. return Array.isArray(e) ? yt(e) : void 0 === e || void 0 === t ? yt() : yt([
  1086. [e, t]
  1087. ])
  1088. }
  1089. function bt(e, t) {
  1090. var i = 0,
  1091. r = void 0,
  1092. n = void 0;
  1093. if (!t) return 0;
  1094. e && e.length || (e = _t(0, 0));
  1095. for (var a = 0; a < e.length; a++) r = e.start(a), (n = e.end(a)) > t && (n = t), i += n - r;
  1096. return i / t
  1097. }
  1098. for (var wt = {}, Et = [
  1099. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange",
  1100. "fullscreenerror"
  1101. ],
  1102. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled",
  1103. "webkitfullscreenchange", "webkitfullscreenerror"
  1104. ],
  1105. ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement",
  1106. "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"
  1107. ],
  1108. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled",
  1109. "mozfullscreenchange", "mozfullscreenerror"
  1110. ],
  1111. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled",
  1112. "MSFullscreenChange", "MSFullscreenError"
  1113. ]
  1114. ], Tt = Et[0], St = void 0, At = 0; At < Et.length; At++)
  1115. if (Et[At][1] in l) {
  1116. St = Et[At];
  1117. break
  1118. } if (St)
  1119. for (var kt = 0; kt < St.length; kt++) wt[Tt[kt]] = St[kt];
  1120. function Rt(e) {
  1121. if (e instanceof Rt) return e;
  1122. "number" == typeof e ? this.code = e : "string" == typeof e ? this.message = e : k(e) && ("number" == typeof e
  1123. .code && (this.code = e.code), A(this, e)), this.message || (this.message = Rt.defaultMessages[this.code] ||
  1124. "")
  1125. }
  1126. Rt.prototype.code = 0, Rt.prototype.message = "", Rt.prototype.status = null, Rt.errorTypes = ["MEDIA_ERR_CUSTOM",
  1127. "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED",
  1128. "MEDIA_ERR_ENCRYPTED"
  1129. ], Rt.defaultMessages = {
  1130. 1: "You aborted the media playback",
  1131. 2: "A network error caused the media download to fail part-way.",
  1132. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  1133. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  1134. 5: "The media is encrypted and we do not have the keys to decrypt it."
  1135. };
  1136. for (var Mt = 0; Mt < Rt.errorTypes.length; Mt++) Rt[Rt.errorTypes[Mt]] = Mt, Rt.prototype[Rt.errorTypes[Mt]] = Mt;
  1137. var Ot = function(e, t) {
  1138. var i, r = null;
  1139. try {
  1140. i = JSON.parse(e, t)
  1141. } catch (e) {
  1142. r = e
  1143. }
  1144. return [r, i]
  1145. };
  1146. function Ct(e) {
  1147. return void 0 !== e && null !== e && "function" == typeof e.then
  1148. }
  1149. function Dt(e) {
  1150. Ct(e) && e.then(null, function(e) {})
  1151. }
  1152. var It = function(e) {
  1153. return ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function(t,
  1154. i, r) {
  1155. return e[i] && (t[i] = e[i]), t
  1156. }, {
  1157. cues: e.cues && Array.prototype.map.call(e.cues, function(e) {
  1158. return {
  1159. startTime: e.startTime,
  1160. endTime: e.endTime,
  1161. text: e.text,
  1162. id: e.id
  1163. }
  1164. })
  1165. })
  1166. },
  1167. Lt = function(e) {
  1168. var t = e.$$("track"),
  1169. i = Array.prototype.map.call(t, function(e) {
  1170. return e.track
  1171. });
  1172. return Array.prototype.map.call(t, function(e) {
  1173. var t = It(e.track);
  1174. return e.src && (t.src = e.src), t
  1175. }).concat(Array.prototype.filter.call(e.textTracks(), function(e) {
  1176. return -1 === i.indexOf(e)
  1177. }).map(It))
  1178. },
  1179. xt = function(e, t) {
  1180. return e.forEach(function(e) {
  1181. var i = t.addRemoteTextTrack(e).track;
  1182. !e.src && e.cues && e.cues.forEach(function(e) {
  1183. return i.addCue(e)
  1184. })
  1185. }), t.textTracks()
  1186. },
  1187. Pt = "vjs-modal-dialog",
  1188. Ut = function(e) {
  1189. function t(i, r) {
  1190. y(this, t);
  1191. var n = b(this, e.call(this, i, r));
  1192. return n.opened_ = n.hasBeenOpened_ = n.hasBeenFilled_ = !1, n.closeable(!n.options_.uncloseable), n.content(n
  1193. .options_.content), n.contentEl_ = U("div", {
  1194. className: Pt + "-content"
  1195. }, {
  1196. role: "document"
  1197. }), n.descEl_ = U("p", {
  1198. className: Pt + "-description vjs-control-text",
  1199. id: n.el().getAttribute("aria-describedby")
  1200. }), N(n.descEl_, n.description()), n.el_.appendChild(n.descEl_), n.el_.appendChild(n.contentEl_), n
  1201. }
  1202. return _(t, e), t.prototype.createEl = function() {
  1203. return e.prototype.createEl.call(this, "div", {
  1204. className: this.buildCSSClass(),
  1205. tabIndex: -1
  1206. }, {
  1207. "aria-describedby": this.id() + "_description",
  1208. "aria-hidden": "true",
  1209. "aria-label": this.label(),
  1210. role: "dialog"
  1211. })
  1212. }, t.prototype.dispose = function() {
  1213. this.contentEl_ = null, this.descEl_ = null, this.previouslyActiveEl_ = null, e.prototype.dispose.call(this)
  1214. }, t.prototype.buildCSSClass = function() {
  1215. return Pt + " vjs-hidden " + e.prototype.buildCSSClass.call(this)
  1216. }, t.prototype.handleKeyPress = function(e) {
  1217. 27 === e.which && this.closeable() && this.close()
  1218. }, t.prototype.label = function() {
  1219. return this.localize(this.options_.label || "Modal Window")
  1220. }, t.prototype.description = function() {
  1221. var e = this.options_.description || this.localize("This is a modal window.");
  1222. return this.closeable() && (e += " " + this.localize(
  1223. "This modal can be closed by pressing the Escape key or activating the close button.")), e
  1224. }, t.prototype.open = function() {
  1225. if (!this.opened_) {
  1226. var e = this.player();
  1227. this.trigger("beforemodalopen"), this.opened_ = !0, (this.options_.fillAlways || !this.hasBeenOpened_ && !
  1228. this.hasBeenFilled_) && this.fill(), this.wasPlaying_ = !e.paused(), this.options_.pauseOnOpen && this
  1229. .wasPlaying_ && e.pause(), this.closeable() && this.on(this.el_.ownerDocument, "keydown", De(this, this
  1230. .handleKeyPress)), this.hadControls_ = e.controls(), e.controls(!1), this.show(), this
  1231. .conditionalFocus_(), this.el().setAttribute("aria-hidden", "false"), this.trigger("modalopen"), this
  1232. .hasBeenOpened_ = !0
  1233. }
  1234. }, t.prototype.opened = function(e) {
  1235. return "boolean" == typeof e && this[e ? "open" : "close"](), this.opened_
  1236. }, t.prototype.close = function() {
  1237. if (this.opened_) {
  1238. var e = this.player();
  1239. this.trigger("beforemodalclose"), this.opened_ = !1, this.wasPlaying_ && this.options_.pauseOnOpen && e
  1240. .play(), this.closeable() && this.off(this.el_.ownerDocument, "keydown", De(this, this.handleKeyPress)),
  1241. this.hadControls_ && e.controls(!0), this.hide(), this.el().setAttribute("aria-hidden", "true"), this
  1242. .trigger("modalclose"), this.conditionalBlur_(), this.options_.temporary && this.dispose()
  1243. }
  1244. }, t.prototype.closeable = function(e) {
  1245. if ("boolean" == typeof e) {
  1246. var t = this.closeable_ = !!e,
  1247. i = this.getChild("closeButton");
  1248. if (t && !i) {
  1249. var r = this.contentEl_;
  1250. this.contentEl_ = this.el_, i = this.addChild("closeButton", {
  1251. controlText: "Close Modal Dialog"
  1252. }), this.contentEl_ = r, this.on(i, "close", this.close)
  1253. }!t && i && (this.off(i, "close", this.close), this.removeChild(i), i.dispose())
  1254. }
  1255. return this.closeable_
  1256. }, t.prototype.fill = function() {
  1257. this.fillWith(this.content())
  1258. }, t.prototype.fillWith = function(e) {
  1259. var t = this.contentEl(),
  1260. i = t.parentNode,
  1261. r = t.nextSibling;
  1262. this.trigger("beforemodalfill"), this.hasBeenFilled_ = !0, i.removeChild(t), this.empty(), re(t, e), this
  1263. .trigger("modalfill"), r ? i.insertBefore(t, r) : i.appendChild(t);
  1264. var n = this.getChild("closeButton");
  1265. n && i.appendChild(n.el_)
  1266. }, t.prototype.empty = function() {
  1267. this.trigger("beforemodalempty"), ee(this.contentEl()), this.trigger("modalempty")
  1268. }, t.prototype.content = function(e) {
  1269. return void 0 !== e && (this.content_ = e), this.content_
  1270. }, t.prototype.conditionalFocus_ = function() {
  1271. var e = l.activeElement,
  1272. t = this.player_.el_;
  1273. this.previouslyActiveEl_ = null, (t.contains(e) || t === e) && (this.previouslyActiveEl_ = e, this.focus(),
  1274. this.on(l, "keydown", this.handleKeyDown))
  1275. }, t.prototype.conditionalBlur_ = function() {
  1276. this.previouslyActiveEl_ && (this.previouslyActiveEl_.focus(), this.previouslyActiveEl_ = null), this.off(l,
  1277. "keydown", this.handleKeyDown)
  1278. }, t.prototype.handleKeyDown = function(e) {
  1279. if (9 === e.which) {
  1280. for (var t = this.focusableEls_(), i = this.el_.querySelector(":focus"), r = void 0, n = 0; n < t
  1281. .length; n++)
  1282. if (i === t[n]) {
  1283. r = n;
  1284. break
  1285. } l.activeElement === this.el_ && (r = 0), e.shiftKey && 0 === r ? (t[t.length - 1].focus(), e
  1286. .preventDefault()) : e.shiftKey || r !== t.length - 1 || (t[0].focus(), e.preventDefault())
  1287. }
  1288. }, t.prototype.focusableEls_ = function() {
  1289. var e = this.el_.querySelectorAll("*");
  1290. return Array.prototype.filter.call(e, function(e) {
  1291. return (e instanceof n.HTMLAnchorElement || e instanceof n.HTMLAreaElement) && e.hasAttribute(
  1292. "href") || (e instanceof n.HTMLInputElement || e instanceof n.HTMLSelectElement || e instanceof n
  1293. .HTMLTextAreaElement || e instanceof n.HTMLButtonElement) && !e.hasAttribute("disabled") ||
  1294. e instanceof n.HTMLIFrameElement || e instanceof n.HTMLObjectElement || e instanceof n
  1295. .HTMLEmbedElement || e.hasAttribute("tabindex") && -1 !== e.getAttribute("tabindex") || e
  1296. .hasAttribute("contenteditable")
  1297. })
  1298. }, t
  1299. }(Ye);
  1300. Ut.prototype.options_ = {
  1301. pauseOnOpen: !0,
  1302. temporary: !0
  1303. }, Ye.registerComponent("ModalDialog", Ut);
  1304. var Nt = function(e) {
  1305. function t() {
  1306. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
  1307. y(this, t);
  1308. var r = b(this, e.call(this));
  1309. r.tracks_ = [], Object.defineProperty(r, "length", {
  1310. get: function() {
  1311. return this.tracks_.length
  1312. }
  1313. });
  1314. for (var n = 0; n < i.length; n++) r.addTrack(i[n]);
  1315. return r
  1316. }
  1317. return _(t, e), t.prototype.addTrack = function(e) {
  1318. var t = this.tracks_.length;
  1319. "" + t in this || Object.defineProperty(this, t, {
  1320. get: function() {
  1321. return this.tracks_[t]
  1322. }
  1323. }), -1 === this.tracks_.indexOf(e) && (this.tracks_.push(e), this.trigger({
  1324. track: e,
  1325. type: "addtrack"
  1326. }))
  1327. }, t.prototype.removeTrack = function(e) {
  1328. for (var t = void 0, i = 0, r = this.length; i < r; i++)
  1329. if (this[i] === e) {
  1330. (t = this[i]).off && t.off(), this.tracks_.splice(i, 1);
  1331. break
  1332. } t && this.trigger({
  1333. track: t,
  1334. type: "removetrack"
  1335. })
  1336. }, t.prototype.getTrackById = function(e) {
  1337. for (var t = null, i = 0, r = this.length; i < r; i++) {
  1338. var n = this[i];
  1339. if (n.id === e) {
  1340. t = n;
  1341. break
  1342. }
  1343. }
  1344. return t
  1345. }, t
  1346. }(xe);
  1347. for (var Bt in Nt.prototype.allowedEvents_ = {
  1348. change: "change",
  1349. addtrack: "addtrack",
  1350. removetrack: "removetrack"
  1351. }, Nt.prototype.allowedEvents_) Nt.prototype["on" + Bt] = null;
  1352. var Ft = function(e, t) {
  1353. for (var i = 0; i < e.length; i++) Object.keys(e[i]).length && t.id !== e[i].id && (e[i].enabled = !1)
  1354. },
  1355. jt = function(e) {
  1356. function t() {
  1357. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
  1358. y(this, t);
  1359. for (var r = i.length - 1; r >= 0; r--)
  1360. if (i[r].enabled) {
  1361. Ft(i, i[r]);
  1362. break
  1363. } var n = b(this, e.call(this, i));
  1364. return n.changing_ = !1, n
  1365. }
  1366. return _(t, e), t.prototype.addTrack = function(t) {
  1367. var i = this;
  1368. t.enabled && Ft(this, t), e.prototype.addTrack.call(this, t), t.addEventListener && t.addEventListener(
  1369. "enabledchange",
  1370. function() {
  1371. i.changing_ || (i.changing_ = !0, Ft(i, t), i.changing_ = !1, i.trigger("change"))
  1372. })
  1373. }, t
  1374. }(Nt),
  1375. Ht = function(e, t) {
  1376. for (var i = 0; i < e.length; i++) Object.keys(e[i]).length && t.id !== e[i].id && (e[i].selected = !1)
  1377. },
  1378. Gt = function(e) {
  1379. function t() {
  1380. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
  1381. y(this, t);
  1382. for (var r = i.length - 1; r >= 0; r--)
  1383. if (i[r].selected) {
  1384. Ht(i, i[r]);
  1385. break
  1386. } var n = b(this, e.call(this, i));
  1387. return n.changing_ = !1, Object.defineProperty(n, "selectedIndex", {
  1388. get: function() {
  1389. for (var e = 0; e < this.length; e++)
  1390. if (this[e].selected) return e;
  1391. return -1
  1392. },
  1393. set: function() {}
  1394. }), n
  1395. }
  1396. return _(t, e), t.prototype.addTrack = function(t) {
  1397. var i = this;
  1398. t.selected && Ht(this, t), e.prototype.addTrack.call(this, t), t.addEventListener && t.addEventListener(
  1399. "selectedchange",
  1400. function() {
  1401. i.changing_ || (i.changing_ = !0, Ht(i, t), i.changing_ = !1, i.trigger("change"))
  1402. })
  1403. }, t
  1404. }(Nt),
  1405. Vt = function(e) {
  1406. function t() {
  1407. return y(this, t), b(this, e.apply(this, arguments))
  1408. }
  1409. return _(t, e), t.prototype.addTrack = function(t) {
  1410. e.prototype.addTrack.call(this, t), t.addEventListener("modechange", De(this, function() {
  1411. this.queueTrigger("change")
  1412. })); - 1 === ["metadata", "chapters"].indexOf(t.kind) && t.addEventListener("modechange", De(this,
  1413. function() {
  1414. this.trigger("selectedlanguagechange")
  1415. }))
  1416. }, t
  1417. }(Nt),
  1418. Wt = function() {
  1419. function e() {
  1420. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
  1421. y(this, e), this.trackElements_ = [], Object.defineProperty(this, "length", {
  1422. get: function() {
  1423. return this.trackElements_.length
  1424. }
  1425. });
  1426. for (var i = 0, r = t.length; i < r; i++) this.addTrackElement_(t[i])
  1427. }
  1428. return e.prototype.addTrackElement_ = function(e) {
  1429. var t = this.trackElements_.length;
  1430. "" + t in this || Object.defineProperty(this, t, {
  1431. get: function() {
  1432. return this.trackElements_[t]
  1433. }
  1434. }), -1 === this.trackElements_.indexOf(e) && this.trackElements_.push(e)
  1435. }, e.prototype.getTrackElementByTrack_ = function(e) {
  1436. for (var t = void 0, i = 0, r = this.trackElements_.length; i < r; i++)
  1437. if (e === this.trackElements_[i].track) {
  1438. t = this.trackElements_[i];
  1439. break
  1440. } return t
  1441. }, e.prototype.removeTrackElement_ = function(e) {
  1442. for (var t = 0, i = this.trackElements_.length; t < i; t++)
  1443. if (e === this.trackElements_[t]) {
  1444. this.trackElements_.splice(t, 1);
  1445. break
  1446. }
  1447. }, e
  1448. }(),
  1449. qt = function() {
  1450. function e(t) {
  1451. y(this, e), e.prototype.setCues_.call(this, t), Object.defineProperty(this, "length", {
  1452. get: function() {
  1453. return this.length_
  1454. }
  1455. })
  1456. }
  1457. return e.prototype.setCues_ = function(e) {
  1458. var t = this.length || 0,
  1459. i = 0,
  1460. r = e.length;
  1461. this.cues_ = e, this.length_ = e.length;
  1462. var n = function(e) {
  1463. "" + e in this || Object.defineProperty(this, "" + e, {
  1464. get: function() {
  1465. return this.cues_[e]
  1466. }
  1467. })
  1468. };
  1469. if (t < r)
  1470. for (i = t; i < r; i++) n.call(this, i)
  1471. }, e.prototype.getCueById = function(e) {
  1472. for (var t = null, i = 0, r = this.length; i < r; i++) {
  1473. var n = this[i];
  1474. if (n.id === e) {
  1475. t = n;
  1476. break
  1477. }
  1478. }
  1479. return t
  1480. }, e
  1481. }(),
  1482. Xt = {
  1483. alternative: "alternative",
  1484. captions: "captions",
  1485. main: "main",
  1486. sign: "sign",
  1487. subtitles: "subtitles",
  1488. commentary: "commentary"
  1489. },
  1490. zt = {
  1491. alternative: "alternative",
  1492. descriptions: "descriptions",
  1493. main: "main",
  1494. "main-desc": "main-desc",
  1495. translation: "translation",
  1496. commentary: "commentary"
  1497. },
  1498. Kt = {
  1499. subtitles: "subtitles",
  1500. captions: "captions",
  1501. descriptions: "descriptions",
  1502. chapters: "chapters",
  1503. metadata: "metadata"
  1504. },
  1505. Yt = {
  1506. disabled: "disabled",
  1507. hidden: "hidden",
  1508. showing: "showing"
  1509. },
  1510. Qt = function(e) {
  1511. function t() {
  1512. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  1513. y(this, t);
  1514. var r = b(this, e.call(this)),
  1515. n = {
  1516. id: i.id || "vjs_track_" + le(),
  1517. kind: i.kind || "",
  1518. label: i.label || "",
  1519. language: i.language || ""
  1520. },
  1521. a = function(e) {
  1522. Object.defineProperty(r, e, {
  1523. get: function() {
  1524. return n[e]
  1525. },
  1526. set: function() {}
  1527. })
  1528. };
  1529. for (var s in n) a(s);
  1530. return r
  1531. }
  1532. return _(t, e), t
  1533. }(xe),
  1534. Jt = function(e) {
  1535. var t = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"],
  1536. i = l.createElement("a");
  1537. i.href = e;
  1538. var r = "" === i.host && "file:" !== i.protocol,
  1539. a = void 0;
  1540. r && ((a = l.createElement("div")).innerHTML = '<a href="' + e + '"></a>', i = a.firstChild, a.setAttribute(
  1541. "style", "display:none; position:absolute;"), l.body.appendChild(a));
  1542. for (var s = {}, o = 0; o < t.length; o++) s[t[o]] = i[t[o]];
  1543. return "http:" === s.protocol && (s.host = s.host.replace(/:80$/, "")), "https:" === s.protocol && (s.host = s
  1544. .host.replace(/:443$/, "")), s.protocol || (s.protocol = n.location.protocol), r && l.body.removeChild(a), s
  1545. },
  1546. Zt = function(e) {
  1547. if (!e.match(/^https?:\/\//)) {
  1548. var t = l.createElement("div");
  1549. t.innerHTML = '<a href="' + e + '">x</a>', e = t.firstChild.href
  1550. }
  1551. return e
  1552. },
  1553. $t = function(e) {
  1554. if ("string" == typeof e) {
  1555. var t = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/i.exec(e);
  1556. if (t) return t.pop().toLowerCase()
  1557. }
  1558. return ""
  1559. },
  1560. ei = function(e) {
  1561. var t = n.location,
  1562. i = Jt(e);
  1563. return (":" === i.protocol ? t.protocol : i.protocol) + i.host !== t.protocol + t.host
  1564. },
  1565. ti = Object.freeze({
  1566. parseUrl: Jt,
  1567. getAbsoluteURL: Zt,
  1568. getFileExtension: $t,
  1569. isCrossOrigin: ei
  1570. }),
  1571. ii = function(e) {
  1572. var t = ri.call(e);
  1573. return "[object Function]" === t || "function" == typeof e && "[object RegExp]" !== t || "undefined" !=
  1574. typeof window && (e === window.setTimeout || e === window.alert || e === window.confirm || e === window
  1575. .prompt)
  1576. },
  1577. ri = Object.prototype.toString;
  1578. var ni = Object.freeze({
  1579. default: ii,
  1580. __moduleExports: ii
  1581. }),
  1582. ai = i(function(e, t) {
  1583. (t = e.exports = function(e) {
  1584. return e.replace(/^\s*|\s*$/g, "")
  1585. }).left = function(e) {
  1586. return e.replace(/^\s*/, "")
  1587. }, t.right = function(e) {
  1588. return e.replace(/\s*$/, "")
  1589. }
  1590. }),
  1591. si = ai.left,
  1592. oi = ai.right,
  1593. ui = Object.freeze({
  1594. default: ai,
  1595. __moduleExports: ai,
  1596. left: si,
  1597. right: oi
  1598. }),
  1599. li = ni && ii || ni,
  1600. di = function(e, t, i) {
  1601. if (!li(t)) throw new TypeError("iterator must be a function");
  1602. arguments.length < 3 && (i = this);
  1603. "[object Array]" === ci.call(e) ? function(e, t, i) {
  1604. for (var r = 0, n = e.length; r < n; r++) hi.call(e, r) && t.call(i, e[r], r, e)
  1605. }(e, t, i) : "string" == typeof e ? function(e, t, i) {
  1606. for (var r = 0, n = e.length; r < n; r++) t.call(i, e.charAt(r), r, e)
  1607. }(e, t, i) : function(e, t, i) {
  1608. for (var r in e) hi.call(e, r) && t.call(i, e[r], r, e)
  1609. }(e, t, i)
  1610. },
  1611. ci = Object.prototype.toString,
  1612. hi = Object.prototype.hasOwnProperty;
  1613. var fi = Object.freeze({
  1614. default: di,
  1615. __moduleExports: di
  1616. }),
  1617. pi = ui && ai || ui,
  1618. mi = fi && di || fi,
  1619. gi = function(e) {
  1620. if (!e) return {};
  1621. var t = {};
  1622. return mi(pi(e).split("\n"), function(e) {
  1623. var i, r = e.indexOf(":"),
  1624. n = pi(e.slice(0, r)).toLowerCase(),
  1625. a = pi(e.slice(r + 1));
  1626. void 0 === t[n] ? t[n] = a : (i = t[n], "[object Array]" === Object.prototype.toString.call(i) ? t[n]
  1627. .push(a) : t[n] = [t[n], a])
  1628. }), t
  1629. },
  1630. vi = Object.freeze({
  1631. default: gi,
  1632. __moduleExports: gi
  1633. }),
  1634. yi = function() {
  1635. for (var e = {}, t = 0; t < arguments.length; t++) {
  1636. var i = arguments[t];
  1637. for (var r in i) _i.call(i, r) && (e[r] = i[r])
  1638. }
  1639. return e
  1640. },
  1641. _i = Object.prototype.hasOwnProperty;
  1642. var bi = Object.freeze({
  1643. default: yi,
  1644. __moduleExports: yi
  1645. }),
  1646. wi = vi && gi || vi,
  1647. Ei = bi && yi || bi,
  1648. Ti = Ai;
  1649. function Si(e, t, i) {
  1650. var r = e;
  1651. return li(t) ? (i = t, "string" == typeof e && (r = {
  1652. uri: e
  1653. })) : r = Ei(t, {
  1654. uri: e
  1655. }), r.callback = i, r
  1656. }
  1657. function Ai(e, t, i) {
  1658. return ki(t = Si(e, t, i))
  1659. }
  1660. function ki(e) {
  1661. if (void 0 === e.callback) throw new Error("callback argument missing");
  1662. var t = !1,
  1663. i = function(i, r, n) {
  1664. t || (t = !0, e.callback(i, r, n))
  1665. };
  1666. function r(e) {
  1667. return clearTimeout(u), e instanceof Error || (e = new Error("" + (e || "Unknown XMLHttpRequest Error"))), e
  1668. .statusCode = 0, i(e, m)
  1669. }
  1670. function n() {
  1671. if (!s) {
  1672. var t;
  1673. clearTimeout(u), t = e.useXDR && void 0 === o.status ? 200 : 1223 === o.status ? 204 : o.status;
  1674. var r = m,
  1675. n = null;
  1676. return 0 !== t ? (r = {
  1677. body: function() {
  1678. var e = void 0;
  1679. if (e = o.response ? o.response : o.responseText || function(e) {
  1680. if ("document" === e.responseType) return e.responseXML;
  1681. var t = e.responseXML && "parsererror" === e.responseXML.documentElement.nodeName;
  1682. return "" !== e.responseType || t ? null : e.responseXML
  1683. }(o), p) try {
  1684. e = JSON.parse(e)
  1685. } catch (e) {}
  1686. return e
  1687. }(),
  1688. statusCode: t,
  1689. method: d,
  1690. headers: {},
  1691. url: l,
  1692. rawRequest: o
  1693. }, o.getAllResponseHeaders && (r.headers = wi(o.getAllResponseHeaders()))) : n = new Error(
  1694. "Internal XMLHttpRequest Error"), i(n, r, r.body)
  1695. }
  1696. }
  1697. var a, s, o = e.xhr || null;
  1698. o || (o = e.cors || e.useXDR ? new Ai.XDomainRequest : new Ai.XMLHttpRequest);
  1699. var u, l = o.url = e.uri || e.url,
  1700. d = o.method = e.method || "GET",
  1701. c = e.body || e.data,
  1702. h = o.headers = e.headers || {},
  1703. f = !!e.sync,
  1704. p = !1,
  1705. m = {
  1706. body: void 0,
  1707. headers: {},
  1708. statusCode: 0,
  1709. method: d,
  1710. url: l,
  1711. rawRequest: o
  1712. };
  1713. if ("json" in e && !1 !== e.json && (p = !0, h.accept || h.Accept || (h.Accept = "application/json"), "GET" !==
  1714. d && "HEAD" !== d && (h["content-type"] || h["Content-Type"] || (h["Content-Type"] = "application/json"), c =
  1715. JSON.stringify(!0 === e.json ? c : e.json))), o.onreadystatechange = function() {
  1716. 4 === o.readyState && setTimeout(n, 0)
  1717. }, o.onload = n, o.onerror = r, o.onprogress = function() {}, o.onabort = function() {
  1718. s = !0
  1719. }, o.ontimeout = r, o.open(d, l, !f, e.username, e.password), f || (o.withCredentials = !!e.withCredentials), !
  1720. f && e.timeout > 0 && (u = setTimeout(function() {
  1721. if (!s) {
  1722. s = !0, o.abort("timeout");
  1723. var e = new Error("XMLHttpRequest timeout");
  1724. e.code = "ETIMEDOUT", r(e)
  1725. }
  1726. }, e.timeout)), o.setRequestHeader)
  1727. for (a in h) h.hasOwnProperty(a) && o.setRequestHeader(a, h[a]);
  1728. else e.headers && function(e) {
  1729. for (var t in e)
  1730. if (e.hasOwnProperty(t)) return !1
  1731. }(e.headers);
  1732. return "responseType" in e && (o.responseType = e.responseType), "beforeSend" in e && "function" == typeof e
  1733. .beforeSend && e.beforeSend(o), o.send(c || null), o
  1734. }
  1735. Ai.XMLHttpRequest = n.XMLHttpRequest || function() {}, Ai.XDomainRequest = "withCredentials" in new Ai
  1736. .XMLHttpRequest ? Ai.XMLHttpRequest : n.XDomainRequest,
  1737. function(e, t) {
  1738. for (var i = 0; i < e.length; i++) t(e[i])
  1739. }(["get", "put", "post", "patch", "head", "delete"], function(e) {
  1740. Ai["delete" === e ? "del" : e] = function(t, i, r) {
  1741. return (i = Si(t, i, r)).method = e.toUpperCase(), ki(i)
  1742. }
  1743. });
  1744. var Ri = function(e, t) {
  1745. var i = new n.WebVTT.Parser(n, n.vttjs, n.WebVTT.StringDecoder()),
  1746. r = [];
  1747. i.oncue = function(e) {
  1748. t.addCue(e)
  1749. }, i.onparsingerror = function(e) {
  1750. r.push(e)
  1751. }, i.onflush = function() {
  1752. t.trigger({
  1753. type: "loadeddata",
  1754. target: t
  1755. })
  1756. }, i.parse(e), r.length > 0 && (n.console && n.console.groupCollapsed && n.console.groupCollapsed(
  1757. "Text Track parsing errors for " + t.src), r.forEach(function(e) {
  1758. return p.error(e)
  1759. }), n.console && n.console.groupEnd && n.console.groupEnd()), i.flush()
  1760. },
  1761. Mi = function(e, t) {
  1762. var i = {
  1763. uri: e
  1764. },
  1765. r = ei(e);
  1766. r && (i.cors = r), Ti(i, De(this, function(e, i, r) {
  1767. if (e) return p.error(e, i);
  1768. if (t.loaded_ = !0, "function" != typeof n.WebVTT) {
  1769. if (t.tech_) {
  1770. var a = function() {
  1771. return Ri(r, t)
  1772. };
  1773. t.tech_.on("vttjsloaded", a), t.tech_.on("vttjserror", function() {
  1774. p.error("vttjs failed to load, stopping trying to process " + t.src), t.tech_.off(
  1775. "vttjsloaded", a)
  1776. })
  1777. }
  1778. } else Ri(r, t)
  1779. }))
  1780. },
  1781. Oi = function(e) {
  1782. function t() {
  1783. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  1784. if (y(this, t), !i.tech) throw new Error("A tech was not provided.");
  1785. var r = Ke(i, {
  1786. kind: Kt[i.kind] || "subtitles",
  1787. language: i.language || i.srclang || ""
  1788. }),
  1789. n = Yt[r.mode] || "disabled",
  1790. a = r.default;
  1791. "metadata" !== r.kind && "chapters" !== r.kind || (n = "hidden");
  1792. var s = b(this, e.call(this, r));
  1793. s.tech_ = r.tech, s.cues_ = [], s.activeCues_ = [];
  1794. var o = new qt(s.cues_),
  1795. u = new qt(s.activeCues_),
  1796. l = !1,
  1797. d = De(s, function() {
  1798. this.activeCues = this.activeCues, l && (this.trigger("cuechange"), l = !1)
  1799. });
  1800. return "disabled" !== n && s.tech_.ready(function() {
  1801. s.tech_.on("timeupdate", d)
  1802. }, !0), Object.defineProperties(s, {
  1803. default: {
  1804. get: function() {
  1805. return a
  1806. },
  1807. set: function() {}
  1808. },
  1809. mode: {
  1810. get: function() {
  1811. return n
  1812. },
  1813. set: function(e) {
  1814. var t = this;
  1815. Yt[e] && ("disabled" !== (n = e) ? this.tech_.ready(function() {
  1816. t.tech_.on("timeupdate", d)
  1817. }, !0) : this.tech_.off("timeupdate", d), this.trigger("modechange"))
  1818. }
  1819. },
  1820. cues: {
  1821. get: function() {
  1822. return this.loaded_ ? o : null
  1823. },
  1824. set: function() {}
  1825. },
  1826. activeCues: {
  1827. get: function() {
  1828. if (!this.loaded_) return null;
  1829. if (0 === this.cues.length) return u;
  1830. for (var e = this.tech_.currentTime(), t = [], i = 0, r = this.cues.length; i < r; i++) {
  1831. var n = this.cues[i];
  1832. n.startTime <= e && n.endTime >= e ? t.push(n) : n.startTime === n.endTime && n.startTime <=
  1833. e && n.startTime + .5 >= e && t.push(n)
  1834. }
  1835. if (l = !1, t.length !== this.activeCues_.length) l = !0;
  1836. else
  1837. for (var a = 0; a < t.length; a++) - 1 === this.activeCues_.indexOf(t[a]) && (l = !0);
  1838. return this.activeCues_ = t, u.setCues_(this.activeCues_), u
  1839. },
  1840. set: function() {}
  1841. }
  1842. }), r.src ? (s.src = r.src, Mi(r.src, s)) : s.loaded_ = !0, s
  1843. }
  1844. return _(t, e), t.prototype.addCue = function(e) {
  1845. var t = e;
  1846. if (n.vttjs && !(e instanceof n.vttjs.VTTCue)) {
  1847. for (var i in t = new n.vttjs.VTTCue(e.startTime, e.endTime, e.text), e) i in t || (t[i] = e[i]);
  1848. t.id = e.id, t.originalCue_ = e
  1849. }
  1850. for (var r = this.tech_.textTracks(), a = 0; a < r.length; a++) r[a] !== this && r[a].removeCue(t);
  1851. this.cues_.push(t), this.cues.setCues_(this.cues_)
  1852. }, t.prototype.removeCue = function(e) {
  1853. for (var t = this.cues_.length; t--;) {
  1854. var i = this.cues_[t];
  1855. if (i === e || i.originalCue_ && i.originalCue_ === e) {
  1856. this.cues_.splice(t, 1), this.cues.setCues_(this.cues_);
  1857. break
  1858. }
  1859. }
  1860. }, t
  1861. }(Qt);
  1862. Oi.prototype.allowedEvents_ = {
  1863. cuechange: "cuechange"
  1864. };
  1865. var Ci = function(e) {
  1866. function t() {
  1867. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  1868. y(this, t);
  1869. var r = Ke(i, {
  1870. kind: zt[i.kind] || ""
  1871. }),
  1872. n = b(this, e.call(this, r)),
  1873. a = !1;
  1874. return Object.defineProperty(n, "enabled", {
  1875. get: function() {
  1876. return a
  1877. },
  1878. set: function(e) {
  1879. "boolean" == typeof e && e !== a && (a = e, this.trigger("enabledchange"))
  1880. }
  1881. }), r.enabled && (n.enabled = r.enabled), n.loaded_ = !0, n
  1882. }
  1883. return _(t, e), t
  1884. }(Qt),
  1885. Di = function(e) {
  1886. function t() {
  1887. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  1888. y(this, t);
  1889. var r = Ke(i, {
  1890. kind: Xt[i.kind] || ""
  1891. }),
  1892. n = b(this, e.call(this, r)),
  1893. a = !1;
  1894. return Object.defineProperty(n, "selected", {
  1895. get: function() {
  1896. return a
  1897. },
  1898. set: function(e) {
  1899. "boolean" == typeof e && e !== a && (a = e, this.trigger("selectedchange"))
  1900. }
  1901. }), r.selected && (n.selected = r.selected), n
  1902. }
  1903. return _(t, e), t
  1904. }(Qt),
  1905. Ii = 0,
  1906. Li = 2,
  1907. xi = function(e) {
  1908. function t() {
  1909. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  1910. y(this, t);
  1911. var r = b(this, e.call(this)),
  1912. n = void 0,
  1913. a = new Oi(i);
  1914. return r.kind = a.kind, r.src = a.src, r.srclang = a.language, r.label = a.label, r.default = a.default,
  1915. Object.defineProperties(r, {
  1916. readyState: {
  1917. get: function() {
  1918. return n
  1919. }
  1920. },
  1921. track: {
  1922. get: function() {
  1923. return a
  1924. }
  1925. }
  1926. }), n = Ii, a.addEventListener("loadeddata", function() {
  1927. n = Li, r.trigger({
  1928. type: "load",
  1929. target: r
  1930. })
  1931. }), r
  1932. }
  1933. return _(t, e), t
  1934. }(xe);
  1935. xi.prototype.allowedEvents_ = {
  1936. load: "load"
  1937. }, xi.NONE = Ii, xi.LOADING = 1, xi.LOADED = Li, xi.ERROR = 3;
  1938. var Pi = {
  1939. audio: {
  1940. ListClass: jt,
  1941. TrackClass: Ci,
  1942. capitalName: "Audio"
  1943. },
  1944. video: {
  1945. ListClass: Gt,
  1946. TrackClass: Di,
  1947. capitalName: "Video"
  1948. },
  1949. text: {
  1950. ListClass: Vt,
  1951. TrackClass: Oi,
  1952. capitalName: "Text"
  1953. }
  1954. };
  1955. Object.keys(Pi).forEach(function(e) {
  1956. Pi[e].getterName = e + "Tracks", Pi[e].privateName = e + "Tracks_"
  1957. });
  1958. var Ui = {
  1959. remoteText: {
  1960. ListClass: Vt,
  1961. TrackClass: Oi,
  1962. capitalName: "RemoteText",
  1963. getterName: "remoteTextTracks",
  1964. privateName: "remoteTextTracks_"
  1965. },
  1966. remoteTextEl: {
  1967. ListClass: Wt,
  1968. TrackClass: xi,
  1969. capitalName: "RemoteTextTrackEls",
  1970. getterName: "remoteTextTrackEls",
  1971. privateName: "remoteTextTrackEls_"
  1972. }
  1973. },
  1974. Ni = Ke(Pi, Ui);
  1975. Ui.names = Object.keys(Ui), Pi.names = Object.keys(Pi), Ni.names = [].concat(Ui.names).concat(Pi.names);
  1976. var Bi = Object.create || function() {
  1977. function e() {}
  1978. return function(t) {
  1979. if (1 !== arguments.length) throw new Error("Object.create shim only accepts one parameter.");
  1980. return e.prototype = t, new e
  1981. }
  1982. }();
  1983. function Fi(e, t) {
  1984. this.name = "ParsingError", this.code = e.code, this.message = t || e.message
  1985. }
  1986. function ji(e) {
  1987. function t(e, t, i, r) {
  1988. return 3600 * (0 | e) + 60 * (0 | t) + (0 | i) + (0 | r) / 1e3
  1989. }
  1990. var i = e.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);
  1991. return i ? i[3] ? t(i[1], i[2], i[3].replace(":", ""), i[4]) : i[1] > 59 ? t(i[1], i[2], 0, i[4]) : t(0, i[1], i[
  1992. 2], i[4]) : null
  1993. }
  1994. function Hi() {
  1995. this.values = Bi(null)
  1996. }
  1997. function Gi(e, t, i, r) {
  1998. var n = r ? e.split(r) : [e];
  1999. for (var a in n)
  2000. if ("string" == typeof n[a]) {
  2001. var s = n[a].split(i);
  2002. if (2 === s.length) t(s[0], s[1])
  2003. }
  2004. }
  2005. function Vi(e, t, i) {
  2006. var r = e;
  2007. function n() {
  2008. var t = ji(e);
  2009. if (null === t) throw new Fi(Fi.Errors.BadTimeStamp, "Malformed timestamp: " + r);
  2010. return e = e.replace(/^[^\sa-zA-Z-]+/, ""), t
  2011. }
  2012. function a() {
  2013. e = e.replace(/^\s+/, "")
  2014. }
  2015. if (a(), t.startTime = n(), a(), "--\x3e" !== e.substr(0, 3)) throw new Fi(Fi.Errors.BadTimeStamp,
  2016. "Malformed time stamp (time stamps must be separated by '--\x3e'): " + r);
  2017. e = e.substr(3), a(), t.endTime = n(), a(),
  2018. function(e, t) {
  2019. var r = new Hi;
  2020. Gi(e, function(e, t) {
  2021. switch (e) {
  2022. case "region":
  2023. for (var n = i.length - 1; n >= 0; n--)
  2024. if (i[n].id === t) {
  2025. r.set(e, i[n].region);
  2026. break
  2027. } break;
  2028. case "vertical":
  2029. r.alt(e, t, ["rl", "lr"]);
  2030. break;
  2031. case "line":
  2032. var a = t.split(","),
  2033. s = a[0];
  2034. r.integer(e, s), r.percent(e, s) && r.set("snapToLines", !1), r.alt(e, s, ["auto"]), 2 === a
  2035. .length && r.alt("lineAlign", a[1], ["start", "middle", "end"]);
  2036. break;
  2037. case "position":
  2038. a = t.split(","), r.percent(e, a[0]), 2 === a.length && r.alt("positionAlign", a[1], ["start",
  2039. "middle", "end"
  2040. ]);
  2041. break;
  2042. case "size":
  2043. r.percent(e, t);
  2044. break;
  2045. case "align":
  2046. r.alt(e, t, ["start", "middle", "end", "left", "right"])
  2047. }
  2048. }, /:/, /\s/), t.region = r.get("region", null), t.vertical = r.get("vertical", ""), t.line = r.get("line",
  2049. "auto"), t.lineAlign = r.get("lineAlign", "start"), t.snapToLines = r.get("snapToLines", !0), t.size = r
  2050. .get("size", 100), t.align = r.get("align", "middle"), t.position = r.get("position", {
  2051. start: 0,
  2052. left: 0,
  2053. middle: 50,
  2054. end: 100,
  2055. right: 100
  2056. }, t.align), t.positionAlign = r.get("positionAlign", {
  2057. start: "start",
  2058. left: "start",
  2059. middle: "middle",
  2060. end: "end",
  2061. right: "end"
  2062. }, t.align)
  2063. }(e, t)
  2064. }
  2065. Fi.prototype = Bi(Error.prototype), Fi.prototype.constructor = Fi, Fi.Errors = {
  2066. BadSignature: {
  2067. code: 0,
  2068. message: "Malformed WebVTT signature."
  2069. },
  2070. BadTimeStamp: {
  2071. code: 1,
  2072. message: "Malformed time stamp."
  2073. }
  2074. }, Hi.prototype = {
  2075. set: function(e, t) {
  2076. this.get(e) || "" === t || (this.values[e] = t)
  2077. },
  2078. get: function(e, t, i) {
  2079. return i ? this.has(e) ? this.values[e] : t[i] : this.has(e) ? this.values[e] : t
  2080. },
  2081. has: function(e) {
  2082. return e in this.values
  2083. },
  2084. alt: function(e, t, i) {
  2085. for (var r = 0; r < i.length; ++r)
  2086. if (t === i[r]) {
  2087. this.set(e, t);
  2088. break
  2089. }
  2090. },
  2091. integer: function(e, t) {
  2092. /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10))
  2093. },
  2094. percent: function(e, t) {
  2095. return !!(t.match(/^([\d]{1,3})(\.[\d]*)?%$/) && (t = parseFloat(t)) >= 0 && t <= 100) && (this.set(e, t), !
  2096. 0)
  2097. }
  2098. };
  2099. var Wi = {
  2100. "&amp;": "&",
  2101. "&lt;": "<",
  2102. "&gt;": ">",
  2103. "&lrm;": "‎",
  2104. "&rlm;": "‏",
  2105. "&nbsp;": " "
  2106. },
  2107. qi = {
  2108. c: "span",
  2109. i: "i",
  2110. b: "b",
  2111. u: "u",
  2112. ruby: "ruby",
  2113. rt: "rt",
  2114. v: "span",
  2115. lang: "span"
  2116. },
  2117. Xi = {
  2118. v: "title",
  2119. lang: "lang"
  2120. },
  2121. zi = {
  2122. rt: "ruby"
  2123. };
  2124. function Ki(e, t) {
  2125. function i() {
  2126. if (!t) return null;
  2127. var e, i = t.match(/^([^<]*)(<[^>]*>?)?/);
  2128. return e = i[1] ? i[1] : i[2], t = t.substr(e.length), e
  2129. }
  2130. function r(e) {
  2131. return Wi[e]
  2132. }
  2133. function n(e) {
  2134. for (; f = e.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);) e = e.replace(f[0], r);
  2135. return e
  2136. }
  2137. function a(e, t) {
  2138. return !zi[t.localName] || zi[t.localName] === e.localName
  2139. }
  2140. function s(t, i) {
  2141. var r = qi[t];
  2142. if (!r) return null;
  2143. var n = e.document.createElement(r);
  2144. n.localName = r;
  2145. var a = Xi[t];
  2146. return a && i && (n[a] = i.trim()), n
  2147. }
  2148. for (var o, u = e.document.createElement("div"), l = u, d = []; null !== (o = i());)
  2149. if ("<" !== o[0]) l.appendChild(e.document.createTextNode(n(o)));
  2150. else {
  2151. if ("/" === o[1]) {
  2152. d.length && d[d.length - 1] === o.substr(2).replace(">", "") && (d.pop(), l = l.parentNode);
  2153. continue
  2154. }
  2155. var c, h = ji(o.substr(1, o.length - 2));
  2156. if (h) {
  2157. c = e.document.createProcessingInstruction("timestamp", h), l.appendChild(c);
  2158. continue
  2159. }
  2160. var f = o.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
  2161. if (!f) continue;
  2162. if (!(c = s(f[1], f[3]))) continue;
  2163. if (!a(l, c)) continue;
  2164. f[2] && (c.className = f[2].substr(1).replace(".", " ")), d.push(f[1]), l.appendChild(c), l = c
  2165. } return u
  2166. }
  2167. var Yi = [
  2168. [1470, 1470],
  2169. [1472, 1472],
  2170. [1475, 1475],
  2171. [1478, 1478],
  2172. [1488, 1514],
  2173. [1520, 1524],
  2174. [1544, 1544],
  2175. [1547, 1547],
  2176. [1549, 1549],
  2177. [1563, 1563],
  2178. [1566, 1610],
  2179. [1645, 1647],
  2180. [1649, 1749],
  2181. [1765, 1766],
  2182. [1774, 1775],
  2183. [1786, 1805],
  2184. [1807, 1808],
  2185. [1810, 1839],
  2186. [1869, 1957],
  2187. [1969, 1969],
  2188. [1984, 2026],
  2189. [2036, 2037],
  2190. [2042, 2042],
  2191. [2048, 2069],
  2192. [2074, 2074],
  2193. [2084, 2084],
  2194. [2088, 2088],
  2195. [2096, 2110],
  2196. [2112, 2136],
  2197. [2142, 2142],
  2198. [2208, 2208],
  2199. [2210, 2220],
  2200. [8207, 8207],
  2201. [64285, 64285],
  2202. [64287, 64296],
  2203. [64298, 64310],
  2204. [64312, 64316],
  2205. [64318, 64318],
  2206. [64320, 64321],
  2207. [64323, 64324],
  2208. [64326, 64449],
  2209. [64467, 64829],
  2210. [64848, 64911],
  2211. [64914, 64967],
  2212. [65008, 65020],
  2213. [65136, 65140],
  2214. [65142, 65276],
  2215. [67584, 67589],
  2216. [67592, 67592],
  2217. [67594, 67637],
  2218. [67639, 67640],
  2219. [67644, 67644],
  2220. [67647, 67669],
  2221. [67671, 67679],
  2222. [67840, 67867],
  2223. [67872, 67897],
  2224. [67903, 67903],
  2225. [67968, 68023],
  2226. [68030, 68031],
  2227. [68096, 68096],
  2228. [68112, 68115],
  2229. [68117, 68119],
  2230. [68121, 68147],
  2231. [68160, 68167],
  2232. [68176, 68184],
  2233. [68192, 68223],
  2234. [68352, 68405],
  2235. [68416, 68437],
  2236. [68440, 68466],
  2237. [68472, 68479],
  2238. [68608, 68680],
  2239. [126464, 126467],
  2240. [126469, 126495],
  2241. [126497, 126498],
  2242. [126500, 126500],
  2243. [126503, 126503],
  2244. [126505, 126514],
  2245. [126516, 126519],
  2246. [126521, 126521],
  2247. [126523, 126523],
  2248. [126530, 126530],
  2249. [126535, 126535],
  2250. [126537, 126537],
  2251. [126539, 126539],
  2252. [126541, 126543],
  2253. [126545, 126546],
  2254. [126548, 126548],
  2255. [126551, 126551],
  2256. [126553, 126553],
  2257. [126555, 126555],
  2258. [126557, 126557],
  2259. [126559, 126559],
  2260. [126561, 126562],
  2261. [126564, 126564],
  2262. [126567, 126570],
  2263. [126572, 126578],
  2264. [126580, 126583],
  2265. [126585, 126588],
  2266. [126590, 126590],
  2267. [126592, 126601],
  2268. [126603, 126619],
  2269. [126625, 126627],
  2270. [126629, 126633],
  2271. [126635, 126651],
  2272. [1114109, 1114109]
  2273. ];
  2274. function Qi(e) {
  2275. for (var t = 0; t < Yi.length; t++) {
  2276. var i = Yi[t];
  2277. if (e >= i[0] && e <= i[1]) return !0
  2278. }
  2279. return !1
  2280. }
  2281. function Ji() {}
  2282. function Zi(e, t, i) {
  2283. Ji.call(this), this.cue = t, this.cueDiv = Ki(e, t.text);
  2284. var r = {
  2285. color: "rgba(255, 255, 255, 1)",
  2286. backgroundColor: "rgba(0, 0, 0, 0.8)",
  2287. position: "relative",
  2288. left: 0,
  2289. right: 0,
  2290. top: 0,
  2291. bottom: 0,
  2292. display: "inline",
  2293. writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl",
  2294. unicodeBidi: "plaintext"
  2295. };
  2296. this.applyStyles(r, this.cueDiv), this.div = e.document.createElement("div"), r = {
  2297. direction: function(e) {
  2298. var t = [],
  2299. i = "";
  2300. if (!e || !e.childNodes) return "ltr";
  2301. function r(e, t) {
  2302. for (var i = t.childNodes.length - 1; i >= 0; i--) e.push(t.childNodes[i])
  2303. }
  2304. function n(e) {
  2305. if (!e || !e.length) return null;
  2306. var t = e.pop(),
  2307. i = t.textContent || t.innerText;
  2308. if (i) {
  2309. var a = i.match(/^.*(\n|\r)/);
  2310. return a ? (e.length = 0, a[0]) : i
  2311. }
  2312. return "ruby" === t.tagName ? n(e) : t.childNodes ? (r(e, t), n(e)) : void 0
  2313. }
  2314. for (r(t, e); i = n(t);)
  2315. for (var a = 0; a < i.length; a++)
  2316. if (Qi(i.charCodeAt(a))) return "rtl";
  2317. return "ltr"
  2318. }(this.cueDiv),
  2319. writingMode: "" === t.vertical ? "horizontal-tb" : "lr" === t.vertical ? "vertical-lr" : "vertical-rl",
  2320. unicodeBidi: "plaintext",
  2321. textAlign: "middle" === t.align ? "center" : t.align,
  2322. font: i.font,
  2323. whiteSpace: "pre-line",
  2324. position: "absolute"
  2325. }, this.applyStyles(r), this.div.appendChild(this.cueDiv);
  2326. var n = 0;
  2327. switch (t.positionAlign) {
  2328. case "start":
  2329. n = t.position;
  2330. break;
  2331. case "middle":
  2332. n = t.position - t.size / 2;
  2333. break;
  2334. case "end":
  2335. n = t.position - t.size
  2336. }
  2337. "" === t.vertical ? this.applyStyles({
  2338. left: this.formatStyle(n, "%"),
  2339. width: this.formatStyle(t.size, "%")
  2340. }) : this.applyStyles({
  2341. top: this.formatStyle(n, "%"),
  2342. height: this.formatStyle(t.size, "%")
  2343. }), this.move = function(e) {
  2344. this.applyStyles({
  2345. top: this.formatStyle(e.top, "px"),
  2346. bottom: this.formatStyle(e.bottom, "px"),
  2347. left: this.formatStyle(e.left, "px"),
  2348. right: this.formatStyle(e.right, "px"),
  2349. height: this.formatStyle(e.height, "px"),
  2350. width: this.formatStyle(e.width, "px")
  2351. })
  2352. }
  2353. }
  2354. function $i(e) {
  2355. var t, i, r, n;
  2356. if (e.div) {
  2357. i = e.div.offsetHeight, r = e.div.offsetWidth, n = e.div.offsetTop;
  2358. var a = (a = e.div.childNodes) && (a = a[0]) && a.getClientRects && a.getClientRects();
  2359. e = e.div.getBoundingClientRect(), t = a ? Math.max(a[0] && a[0].height || 0, e.height / a.length) : 0
  2360. }
  2361. this.left = e.left, this.right = e.right, this.top = e.top || n, this.height = e.height || i, this.bottom = e
  2362. .bottom || n + (e.height || i), this.width = e.width || r, this.lineHeight = void 0 !== t ? t : e.lineHeight
  2363. }
  2364. function er(e, t, i, r) {
  2365. var n = new $i(t),
  2366. a = t.cue,
  2367. s = function(e) {
  2368. if ("number" == typeof e.line && (e.snapToLines || e.line >= 0 && e.line <= 100)) return e.line;
  2369. if (!e.track || !e.track.textTrackList || !e.track.textTrackList.mediaElement) return -1;
  2370. for (var t = e.track, i = t.textTrackList, r = 0, n = 0; n < i.length && i[n] !== t; n++) "showing" === i[n]
  2371. .mode && r++;
  2372. return -1 * ++r
  2373. }(a),
  2374. o = [];
  2375. if (a.snapToLines) {
  2376. var u;
  2377. switch (a.vertical) {
  2378. case "":
  2379. o = ["+y", "-y"], u = "height";
  2380. break;
  2381. case "rl":
  2382. o = ["+x", "-x"], u = "width";
  2383. break;
  2384. case "lr":
  2385. o = ["-x", "+x"], u = "width"
  2386. }
  2387. var l = n.lineHeight,
  2388. d = l * Math.round(s),
  2389. c = i[u] + l,
  2390. h = o[0];
  2391. Math.abs(d) > c && (d = d < 0 ? -1 : 1, d *= Math.ceil(c / l) * l), s < 0 && (d += "" === a.vertical ? i
  2392. .height : i.width, o = o.reverse()), n.move(h, d)
  2393. } else {
  2394. var f = n.lineHeight / i.height * 100;
  2395. switch (a.lineAlign) {
  2396. case "middle":
  2397. s -= f / 2;
  2398. break;
  2399. case "end":
  2400. s -= f
  2401. }
  2402. switch (a.vertical) {
  2403. case "":
  2404. t.applyStyles({
  2405. top: t.formatStyle(s, "%")
  2406. });
  2407. break;
  2408. case "rl":
  2409. t.applyStyles({
  2410. left: t.formatStyle(s, "%")
  2411. });
  2412. break;
  2413. case "lr":
  2414. t.applyStyles({
  2415. right: t.formatStyle(s, "%")
  2416. })
  2417. }
  2418. o = ["+y", "-x", "+x", "-y"], n = new $i(t)
  2419. }
  2420. var p = function(e, t) {
  2421. for (var n, a = new $i(e), s = 1, o = 0; o < t.length; o++) {
  2422. for (; e.overlapsOppositeAxis(i, t[o]) || e.within(i) && e.overlapsAny(r);) e.move(t[o]);
  2423. if (e.within(i)) return e;
  2424. var u = e.intersectPercentage(i);
  2425. s > u && (n = new $i(e), s = u), e = new $i(a)
  2426. }
  2427. return n || a
  2428. }(n, o);
  2429. t.move(p.toCSSCompatValues(i))
  2430. }
  2431. function tr() {}
  2432. Ji.prototype.applyStyles = function(e, t) {
  2433. for (var i in t = t || this.div, e) e.hasOwnProperty(i) && (t.style[i] = e[i])
  2434. }, Ji.prototype.formatStyle = function(e, t) {
  2435. return 0 === e ? 0 : e + t
  2436. }, Zi.prototype = Bi(Ji.prototype), Zi.prototype.constructor = Zi, $i.prototype.move = function(e, t) {
  2437. switch (t = void 0 !== t ? t : this.lineHeight, e) {
  2438. case "+x":
  2439. this.left += t, this.right += t;
  2440. break;
  2441. case "-x":
  2442. this.left -= t, this.right -= t;
  2443. break;
  2444. case "+y":
  2445. this.top += t, this.bottom += t;
  2446. break;
  2447. case "-y":
  2448. this.top -= t, this.bottom -= t
  2449. }
  2450. }, $i.prototype.overlaps = function(e) {
  2451. return this.left < e.right && this.right > e.left && this.top < e.bottom && this.bottom > e.top
  2452. }, $i.prototype.overlapsAny = function(e) {
  2453. for (var t = 0; t < e.length; t++)
  2454. if (this.overlaps(e[t])) return !0;
  2455. return !1
  2456. }, $i.prototype.within = function(e) {
  2457. return this.top >= e.top && this.bottom <= e.bottom && this.left >= e.left && this.right <= e.right
  2458. }, $i.prototype.overlapsOppositeAxis = function(e, t) {
  2459. switch (t) {
  2460. case "+x":
  2461. return this.left < e.left;
  2462. case "-x":
  2463. return this.right > e.right;
  2464. case "+y":
  2465. return this.top < e.top;
  2466. case "-y":
  2467. return this.bottom > e.bottom
  2468. }
  2469. }, $i.prototype.intersectPercentage = function(e) {
  2470. return Math.max(0, Math.min(this.right, e.right) - Math.max(this.left, e.left)) * Math.max(0, Math.min(this
  2471. .bottom, e.bottom) - Math.max(this.top, e.top)) / (this.height * this.width)
  2472. }, $i.prototype.toCSSCompatValues = function(e) {
  2473. return {
  2474. top: this.top - e.top,
  2475. bottom: e.bottom - this.bottom,
  2476. left: this.left - e.left,
  2477. right: e.right - this.right,
  2478. height: this.height,
  2479. width: this.width
  2480. }
  2481. }, $i.getSimpleBoxPosition = function(e) {
  2482. var t = e.div ? e.div.offsetHeight : e.tagName ? e.offsetHeight : 0,
  2483. i = e.div ? e.div.offsetWidth : e.tagName ? e.offsetWidth : 0,
  2484. r = e.div ? e.div.offsetTop : e.tagName ? e.offsetTop : 0;
  2485. return {
  2486. left: (e = e.div ? e.div.getBoundingClientRect() : e.tagName ? e.getBoundingClientRect() : e).left,
  2487. right: e.right,
  2488. top: e.top || r,
  2489. height: e.height || t,
  2490. bottom: e.bottom || r + (e.height || t),
  2491. width: e.width || i
  2492. }
  2493. }, tr.StringDecoder = function() {
  2494. return {
  2495. decode: function(e) {
  2496. if (!e) return "";
  2497. if ("string" != typeof e) throw new Error("Error - expected string data.");
  2498. return decodeURIComponent(encodeURIComponent(e))
  2499. }
  2500. }
  2501. }, tr.convertCueToDOMTree = function(e, t) {
  2502. return e && t ? Ki(e, t) : null
  2503. };
  2504. tr.processCues = function(e, t, i) {
  2505. if (!e || !t || !i) return null;
  2506. for (; i.firstChild;) i.removeChild(i.firstChild);
  2507. var r = e.document.createElement("div");
  2508. if (r.style.position = "absolute", r.style.left = "0", r.style.right = "0", r.style.top = "0", r.style.bottom =
  2509. "0", r.style.margin = "1.5%", i.appendChild(r),
  2510. function(e) {
  2511. for (var t = 0; t < e.length; t++)
  2512. if (e[t].hasBeenReset || !e[t].displayState) return !0;
  2513. return !1
  2514. }(t)) {
  2515. var n = [],
  2516. a = $i.getSimpleBoxPosition(r),
  2517. s = {
  2518. font: Math.round(.05 * a.height * 100) / 100 + "px sans-serif"
  2519. };
  2520. ! function() {
  2521. for (var i, o, u = 0; u < t.length; u++) o = t[u], i = new Zi(e, o, s), r.appendChild(i.div), er(0, i, a,
  2522. n), o.displayState = i.div, n.push($i.getSimpleBoxPosition(i))
  2523. }()
  2524. } else
  2525. for (var o = 0; o < t.length; o++) r.appendChild(t[o].displayState)
  2526. }, tr.Parser = function(e, t, i) {
  2527. i || (i = t, t = {}), t || (t = {}), this.window = e, this.vttjs = t, this.state = "INITIAL", this.buffer = "",
  2528. this.decoder = i || new TextDecoder("utf8"), this.regionList = []
  2529. }, tr.Parser.prototype = {
  2530. reportOrThrowError: function(e) {
  2531. if (!(e instanceof Fi)) throw e;
  2532. this.onparsingerror && this.onparsingerror(e)
  2533. },
  2534. parse: function(e) {
  2535. var t = this;
  2536. function i() {
  2537. for (var e = t.buffer, i = 0; i < e.length && "\r" !== e[i] && "\n" !== e[i];) ++i;
  2538. var r = e.substr(0, i);
  2539. return "\r" === e[i] && ++i, "\n" === e[i] && ++i, t.buffer = e.substr(i), r
  2540. }
  2541. function r(e) {
  2542. e.match(/X-TIMESTAMP-MAP/) ? Gi(e, function(e, i) {
  2543. switch (e) {
  2544. case "X-TIMESTAMP-MAP":
  2545. r = i, n = new Hi, Gi(r, function(e, t) {
  2546. switch (e) {
  2547. case "MPEGT":
  2548. n.integer(e + "S", t);
  2549. break;
  2550. case "LOCA":
  2551. n.set(e + "L", ji(t))
  2552. }
  2553. }, /[^\d]:/, /,/), t.ontimestampmap && t.ontimestampmap({
  2554. MPEGTS: n.get("MPEGTS"),
  2555. LOCAL: n.get("LOCAL")
  2556. })
  2557. }
  2558. var r, n
  2559. }, /=/) : Gi(e, function(e, i) {
  2560. switch (e) {
  2561. case "Region":
  2562. ! function(e) {
  2563. var i = new Hi;
  2564. if (Gi(e, function(e, t) {
  2565. switch (e) {
  2566. case "id":
  2567. i.set(e, t);
  2568. break;
  2569. case "width":
  2570. i.percent(e, t);
  2571. break;
  2572. case "lines":
  2573. i.integer(e, t);
  2574. break;
  2575. case "regionanchor":
  2576. case "viewportanchor":
  2577. var r = t.split(",");
  2578. if (2 !== r.length) break;
  2579. var n = new Hi;
  2580. if (n.percent("x", r[0]), n.percent("y", r[1]), !n.has("x") || !n.has("y")) break;
  2581. i.set(e + "X", n.get("x")), i.set(e + "Y", n.get("y"));
  2582. break;
  2583. case "scroll":
  2584. i.alt(e, t, ["up"])
  2585. }
  2586. }, /=/, /\s/), i.has("id")) {
  2587. var r = new(t.vttjs.VTTRegion || t.window.VTTRegion);
  2588. r.width = i.get("width", 100), r.lines = i.get("lines", 3), r.regionAnchorX = i.get(
  2589. "regionanchorX", 0), r.regionAnchorY = i.get("regionanchorY", 100), r.viewportAnchorX =
  2590. i.get("viewportanchorX", 0), r.viewportAnchorY = i.get("viewportanchorY", 100), r.scroll =
  2591. i.get("scroll", ""), t.onregion && t.onregion(r), t.regionList.push({
  2592. id: i.get("id"),
  2593. region: r
  2594. })
  2595. }
  2596. }(i)
  2597. }
  2598. }, /:/)
  2599. }
  2600. e && (t.buffer += t.decoder.decode(e, {
  2601. stream: !0
  2602. }));
  2603. try {
  2604. var n;
  2605. if ("INITIAL" === t.state) {
  2606. if (!/\r\n|\n/.test(t.buffer)) return this;
  2607. var a = (n = i()).match(/^WEBVTT([ \t].*)?$/);
  2608. if (!a || !a[0]) throw new Fi(Fi.Errors.BadSignature);
  2609. t.state = "HEADER"
  2610. }
  2611. for (var s = !1; t.buffer;) {
  2612. if (!/\r\n|\n/.test(t.buffer)) return this;
  2613. switch (s ? s = !1 : n = i(), t.state) {
  2614. case "HEADER":
  2615. /:/.test(n) ? r(n) : n || (t.state = "ID");
  2616. continue;
  2617. case "NOTE":
  2618. n || (t.state = "ID");
  2619. continue;
  2620. case "ID":
  2621. if (/^NOTE($|[ \t])/.test(n)) {
  2622. t.state = "NOTE";
  2623. break
  2624. }
  2625. if (!n) continue;
  2626. if (t.cue = new(t.vttjs.VTTCue || t.window.VTTCue)(0, 0, ""), t.state = "CUE", -1 === n.indexOf(
  2627. "--\x3e")) {
  2628. t.cue.id = n;
  2629. continue
  2630. }
  2631. case "CUE":
  2632. try {
  2633. Vi(n, t.cue, t.regionList)
  2634. } catch (e) {
  2635. t.reportOrThrowError(e), t.cue = null, t.state = "BADCUE";
  2636. continue
  2637. }
  2638. t.state = "CUETEXT";
  2639. continue;
  2640. case "CUETEXT":
  2641. var o = -1 !== n.indexOf("--\x3e");
  2642. if (!n || o && (s = !0)) {
  2643. t.oncue && t.oncue(t.cue), t.cue = null, t.state = "ID";
  2644. continue
  2645. }
  2646. t.cue.text && (t.cue.text += "\n"), t.cue.text += n;
  2647. continue;
  2648. case "BADCUE":
  2649. n || (t.state = "ID");
  2650. continue
  2651. }
  2652. }
  2653. } catch (e) {
  2654. t.reportOrThrowError(e), "CUETEXT" === t.state && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t
  2655. .state = "INITIAL" === t.state ? "BADWEBVTT" : "BADCUE"
  2656. }
  2657. return this
  2658. },
  2659. flush: function() {
  2660. try {
  2661. if (this.buffer += this.decoder.decode(), (this.cue || "HEADER" === this.state) && (this.buffer += "\n\n",
  2662. this.parse()), "INITIAL" === this.state) throw new Fi(Fi.Errors.BadSignature)
  2663. } catch (e) {
  2664. this.reportOrThrowError(e)
  2665. }
  2666. return this.onflush && this.onflush(), this
  2667. }
  2668. };
  2669. var ir = tr,
  2670. rr = Object.freeze({
  2671. default: ir,
  2672. __moduleExports: ir
  2673. }),
  2674. nr = "auto",
  2675. ar = {
  2676. "": 1,
  2677. lr: 1,
  2678. rl: 1
  2679. },
  2680. sr = {
  2681. start: 1,
  2682. middle: 1,
  2683. end: 1,
  2684. left: 1,
  2685. right: 1
  2686. };
  2687. function or(e) {
  2688. return "string" == typeof e && (!!sr[e.toLowerCase()] && e.toLowerCase())
  2689. }
  2690. function ur(e, t, i) {
  2691. this.hasBeenReset = !1;
  2692. var r = "",
  2693. n = !1,
  2694. a = e,
  2695. s = t,
  2696. o = i,
  2697. u = null,
  2698. l = "",
  2699. d = !0,
  2700. c = "auto",
  2701. h = "start",
  2702. f = 50,
  2703. p = "middle",
  2704. m = 50,
  2705. g = "middle";
  2706. Object.defineProperties(this, {
  2707. id: {
  2708. enumerable: !0,
  2709. get: function() {
  2710. return r
  2711. },
  2712. set: function(e) {
  2713. r = "" + e
  2714. }
  2715. },
  2716. pauseOnExit: {
  2717. enumerable: !0,
  2718. get: function() {
  2719. return n
  2720. },
  2721. set: function(e) {
  2722. n = !!e
  2723. }
  2724. },
  2725. startTime: {
  2726. enumerable: !0,
  2727. get: function() {
  2728. return a
  2729. },
  2730. set: function(e) {
  2731. if ("number" != typeof e) throw new TypeError("Start time must be set to a number.");
  2732. a = e, this.hasBeenReset = !0
  2733. }
  2734. },
  2735. endTime: {
  2736. enumerable: !0,
  2737. get: function() {
  2738. return s
  2739. },
  2740. set: function(e) {
  2741. if ("number" != typeof e) throw new TypeError("End time must be set to a number.");
  2742. s = e, this.hasBeenReset = !0
  2743. }
  2744. },
  2745. text: {
  2746. enumerable: !0,
  2747. get: function() {
  2748. return o
  2749. },
  2750. set: function(e) {
  2751. o = "" + e, this.hasBeenReset = !0
  2752. }
  2753. },
  2754. region: {
  2755. enumerable: !0,
  2756. get: function() {
  2757. return u
  2758. },
  2759. set: function(e) {
  2760. u = e, this.hasBeenReset = !0
  2761. }
  2762. },
  2763. vertical: {
  2764. enumerable: !0,
  2765. get: function() {
  2766. return l
  2767. },
  2768. set: function(e) {
  2769. var t = function(e) {
  2770. return "string" == typeof e && !!ar[e.toLowerCase()] && e.toLowerCase()
  2771. }(e);
  2772. if (!1 === t) throw new SyntaxError("An invalid or illegal string was specified.");
  2773. l = t, this.hasBeenReset = !0
  2774. }
  2775. },
  2776. snapToLines: {
  2777. enumerable: !0,
  2778. get: function() {
  2779. return d
  2780. },
  2781. set: function(e) {
  2782. d = !!e, this.hasBeenReset = !0
  2783. }
  2784. },
  2785. line: {
  2786. enumerable: !0,
  2787. get: function() {
  2788. return c
  2789. },
  2790. set: function(e) {
  2791. if ("number" != typeof e && e !== nr) throw new SyntaxError(
  2792. "An invalid number or illegal string was specified.");
  2793. c = e, this.hasBeenReset = !0
  2794. }
  2795. },
  2796. lineAlign: {
  2797. enumerable: !0,
  2798. get: function() {
  2799. return h
  2800. },
  2801. set: function(e) {
  2802. var t = or(e);
  2803. if (!t) throw new SyntaxError("An invalid or illegal string was specified.");
  2804. h = t, this.hasBeenReset = !0
  2805. }
  2806. },
  2807. position: {
  2808. enumerable: !0,
  2809. get: function() {
  2810. return f
  2811. },
  2812. set: function(e) {
  2813. if (e < 0 || e > 100) throw new Error("Position must be between 0 and 100.");
  2814. f = e, this.hasBeenReset = !0
  2815. }
  2816. },
  2817. positionAlign: {
  2818. enumerable: !0,
  2819. get: function() {
  2820. return p
  2821. },
  2822. set: function(e) {
  2823. var t = or(e);
  2824. if (!t) throw new SyntaxError("An invalid or illegal string was specified.");
  2825. p = t, this.hasBeenReset = !0
  2826. }
  2827. },
  2828. size: {
  2829. enumerable: !0,
  2830. get: function() {
  2831. return m
  2832. },
  2833. set: function(e) {
  2834. if (e < 0 || e > 100) throw new Error("Size must be between 0 and 100.");
  2835. m = e, this.hasBeenReset = !0
  2836. }
  2837. },
  2838. align: {
  2839. enumerable: !0,
  2840. get: function() {
  2841. return g
  2842. },
  2843. set: function(e) {
  2844. var t = or(e);
  2845. if (!t) throw new SyntaxError("An invalid or illegal string was specified.");
  2846. g = t, this.hasBeenReset = !0
  2847. }
  2848. }
  2849. }), this.displayState = void 0
  2850. }
  2851. ur.prototype.getCueAsHTML = function() {
  2852. return WebVTT.convertCueToDOMTree(window, this.text)
  2853. };
  2854. var lr = ur,
  2855. dr = Object.freeze({
  2856. default: lr,
  2857. __moduleExports: lr
  2858. }),
  2859. cr = {
  2860. "": !0,
  2861. up: !0
  2862. };
  2863. function hr(e) {
  2864. return "number" == typeof e && e >= 0 && e <= 100
  2865. }
  2866. var fr = function() {
  2867. var e = 100,
  2868. t = 3,
  2869. i = 0,
  2870. r = 100,
  2871. n = 0,
  2872. a = 100,
  2873. s = "";
  2874. Object.defineProperties(this, {
  2875. width: {
  2876. enumerable: !0,
  2877. get: function() {
  2878. return e
  2879. },
  2880. set: function(t) {
  2881. if (!hr(t)) throw new Error("Width must be between 0 and 100.");
  2882. e = t
  2883. }
  2884. },
  2885. lines: {
  2886. enumerable: !0,
  2887. get: function() {
  2888. return t
  2889. },
  2890. set: function(e) {
  2891. if ("number" != typeof e) throw new TypeError("Lines must be set to a number.");
  2892. t = e
  2893. }
  2894. },
  2895. regionAnchorY: {
  2896. enumerable: !0,
  2897. get: function() {
  2898. return r
  2899. },
  2900. set: function(e) {
  2901. if (!hr(e)) throw new Error("RegionAnchorX must be between 0 and 100.");
  2902. r = e
  2903. }
  2904. },
  2905. regionAnchorX: {
  2906. enumerable: !0,
  2907. get: function() {
  2908. return i
  2909. },
  2910. set: function(e) {
  2911. if (!hr(e)) throw new Error("RegionAnchorY must be between 0 and 100.");
  2912. i = e
  2913. }
  2914. },
  2915. viewportAnchorY: {
  2916. enumerable: !0,
  2917. get: function() {
  2918. return a
  2919. },
  2920. set: function(e) {
  2921. if (!hr(e)) throw new Error("ViewportAnchorY must be between 0 and 100.");
  2922. a = e
  2923. }
  2924. },
  2925. viewportAnchorX: {
  2926. enumerable: !0,
  2927. get: function() {
  2928. return n
  2929. },
  2930. set: function(e) {
  2931. if (!hr(e)) throw new Error("ViewportAnchorX must be between 0 and 100.");
  2932. n = e
  2933. }
  2934. },
  2935. scroll: {
  2936. enumerable: !0,
  2937. get: function() {
  2938. return s
  2939. },
  2940. set: function(e) {
  2941. var t = function(e) {
  2942. return "string" == typeof e && !!cr[e.toLowerCase()] && e.toLowerCase()
  2943. }(e);
  2944. if (!1 === t) throw new SyntaxError("An invalid or illegal string was specified.");
  2945. s = t
  2946. }
  2947. }
  2948. })
  2949. },
  2950. pr = Object.freeze({
  2951. default: fr,
  2952. __moduleExports: fr
  2953. }),
  2954. mr = rr && ir || rr,
  2955. gr = dr && lr || dr,
  2956. vr = pr && fr || pr,
  2957. yr = i(function(e) {
  2958. var t = e.exports = {
  2959. WebVTT: mr,
  2960. VTTCue: gr,
  2961. VTTRegion: vr
  2962. };
  2963. n.vttjs = t, n.WebVTT = t.WebVTT;
  2964. var i = t.VTTCue,
  2965. r = t.VTTRegion,
  2966. a = n.VTTCue,
  2967. s = n.VTTRegion;
  2968. t.shim = function() {
  2969. n.VTTCue = i, n.VTTRegion = r
  2970. }, t.restore = function() {
  2971. n.VTTCue = a, n.VTTRegion = s
  2972. }, n.VTTCue || t.shim()
  2973. });
  2974. yr.WebVTT, yr.VTTCue, yr.VTTRegion;
  2975. var _r = function(e) {
  2976. function t() {
  2977. var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  2978. r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : function() {};
  2979. y(this, t), i.reportTouchActivity = !1;
  2980. var n = b(this, e.call(this, null, i, r));
  2981. return n.hasStarted_ = !1, n.on("playing", function() {
  2982. this.hasStarted_ = !0
  2983. }), n.on("loadstart", function() {
  2984. this.hasStarted_ = !1
  2985. }), Ni.names.forEach(function(e) {
  2986. var t = Ni[e];
  2987. i && i[t.getterName] && (n[t.privateName] = i[t.getterName])
  2988. }), n.featuresProgressEvents || n.manualProgressOn(), n.featuresTimeupdateEvents || n.manualTimeUpdatesOn(),
  2989. ["Text", "Audio", "Video"].forEach(function(e) {
  2990. !1 === i["native" + e + "Tracks"] && (n["featuresNative" + e + "Tracks"] = !1)
  2991. }), !1 === i.nativeCaptions || !1 === i.nativeTextTracks ? n.featuresNativeTextTracks = !1 : !0 !== i
  2992. .nativeCaptions && !0 !== i.nativeTextTracks || (n.featuresNativeTextTracks = !0), n
  2993. .featuresNativeTextTracks || n.emulateTextTracks(), n.autoRemoteTextTracks_ = new Ni.text.ListClass, n
  2994. .initTrackListeners(), i.nativeControlsForTouch || n.emitTapEvents(), n.constructor && (n.name_ = n
  2995. .constructor.name || "Unknown Tech"), n
  2996. }
  2997. return _(t, e), t.prototype.triggerSourceset = function(e) {
  2998. var t = this;
  2999. this.isReady_ || this.one("ready", function() {
  3000. return t.setTimeout(function() {
  3001. return t.triggerSourceset(e)
  3002. }, 1)
  3003. }), this.trigger({
  3004. src: e,
  3005. type: "sourceset"
  3006. })
  3007. }, t.prototype.manualProgressOn = function() {
  3008. this.on("durationchange", this.onDurationChange), this.manualProgress = !0, this.one("ready", this
  3009. .trackProgress)
  3010. }, t.prototype.manualProgressOff = function() {
  3011. this.manualProgress = !1, this.stopTrackingProgress(), this.off("durationchange", this.onDurationChange)
  3012. }, t.prototype.trackProgress = function(e) {
  3013. this.stopTrackingProgress(), this.progressInterval = this.setInterval(De(this, function() {
  3014. var e = this.bufferedPercent();
  3015. this.bufferedPercent_ !== e && this.trigger("progress"), this.bufferedPercent_ = e, 1 === e && this
  3016. .stopTrackingProgress()
  3017. }), 500)
  3018. }, t.prototype.onDurationChange = function(e) {
  3019. this.duration_ = this.duration()
  3020. }, t.prototype.buffered = function() {
  3021. return _t(0, 0)
  3022. }, t.prototype.bufferedPercent = function() {
  3023. return bt(this.buffered(), this.duration_)
  3024. }, t.prototype.stopTrackingProgress = function() {
  3025. this.clearInterval(this.progressInterval)
  3026. }, t.prototype.manualTimeUpdatesOn = function() {
  3027. this.manualTimeUpdates = !0, this.on("play", this.trackCurrentTime), this.on("pause", this
  3028. .stopTrackingCurrentTime)
  3029. }, t.prototype.manualTimeUpdatesOff = function() {
  3030. this.manualTimeUpdates = !1, this.stopTrackingCurrentTime(), this.off("play", this.trackCurrentTime), this
  3031. .off("pause", this.stopTrackingCurrentTime)
  3032. }, t.prototype.trackCurrentTime = function() {
  3033. this.currentTimeInterval && this.stopTrackingCurrentTime(), this.currentTimeInterval = this.setInterval(
  3034. function() {
  3035. this.trigger({
  3036. type: "timeupdate",
  3037. target: this,
  3038. manuallyTriggered: !0
  3039. })
  3040. }, 250)
  3041. }, t.prototype.stopTrackingCurrentTime = function() {
  3042. this.clearInterval(this.currentTimeInterval), this.trigger({
  3043. type: "timeupdate",
  3044. target: this,
  3045. manuallyTriggered: !0
  3046. })
  3047. }, t.prototype.dispose = function() {
  3048. this.clearTracks(Pi.names), this.manualProgress && this.manualProgressOff(), this.manualTimeUpdates && this
  3049. .manualTimeUpdatesOff(), e.prototype.dispose.call(this)
  3050. }, t.prototype.clearTracks = function(e) {
  3051. var t = this;
  3052. (e = [].concat(e)).forEach(function(e) {
  3053. for (var i = t[e + "Tracks"]() || [], r = i.length; r--;) {
  3054. var n = i[r];
  3055. "text" === e && t.removeRemoteTextTrack(n), i.removeTrack(n)
  3056. }
  3057. })
  3058. }, t.prototype.cleanupAutoTextTracks = function() {
  3059. for (var e = this.autoRemoteTextTracks_ || [], t = e.length; t--;) {
  3060. var i = e[t];
  3061. this.removeRemoteTextTrack(i)
  3062. }
  3063. }, t.prototype.reset = function() {}, t.prototype.error = function(e) {
  3064. return void 0 !== e && (this.error_ = new Rt(e), this.trigger("error")), this.error_
  3065. }, t.prototype.played = function() {
  3066. return this.hasStarted_ ? _t(0, 0) : _t()
  3067. }, t.prototype.setCurrentTime = function() {
  3068. this.manualTimeUpdates && this.trigger({
  3069. type: "timeupdate",
  3070. target: this,
  3071. manuallyTriggered: !0
  3072. })
  3073. }, t.prototype.initTrackListeners = function() {
  3074. var e = this;
  3075. Pi.names.forEach(function(t) {
  3076. var i = Pi[t],
  3077. r = function() {
  3078. e.trigger(t + "trackchange")
  3079. },
  3080. n = e[i.getterName]();
  3081. n.addEventListener("removetrack", r), n.addEventListener("addtrack", r), e.on("dispose", function() {
  3082. n.removeEventListener("removetrack", r), n.removeEventListener("addtrack", r)
  3083. })
  3084. })
  3085. }, t.prototype.addWebVttScript_ = function() {
  3086. var e = this;
  3087. if (!n.WebVTT)
  3088. if (l.body.contains(this.el())) {
  3089. if (!this.options_["vtt.js"] && R(yr) && Object.keys(yr).length > 0) return void this.trigger(
  3090. "vttjsloaded");
  3091. var t = l.createElement("script");
  3092. t.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js", t.onload =
  3093. function() {
  3094. e.trigger("vttjsloaded")
  3095. }, t.onerror = function() {
  3096. e.trigger("vttjserror")
  3097. }, this.on("dispose", function() {
  3098. t.onload = null, t.onerror = null
  3099. }), n.WebVTT = !0, this.el().parentNode.appendChild(t)
  3100. } else this.ready(this.addWebVttScript_)
  3101. }, t.prototype.emulateTextTracks = function() {
  3102. var e = this,
  3103. t = this.textTracks(),
  3104. i = this.remoteTextTracks(),
  3105. r = function(e) {
  3106. return t.addTrack(e.track)
  3107. },
  3108. n = function(e) {
  3109. return t.removeTrack(e.track)
  3110. };
  3111. i.on("addtrack", r), i.on("removetrack", n), this.addWebVttScript_();
  3112. var a = function() {
  3113. return e.trigger("texttrackchange")
  3114. },
  3115. s = function() {
  3116. a();
  3117. for (var e = 0; e < t.length; e++) {
  3118. var i = t[e];
  3119. i.removeEventListener("cuechange", a), "showing" === i.mode && i.addEventListener("cuechange", a)
  3120. }
  3121. };
  3122. s(), t.addEventListener("change", s), t.addEventListener("addtrack", s), t.addEventListener("removetrack",
  3123. s), this.on("dispose", function() {
  3124. i.off("addtrack", r), i.off("removetrack", n), t.removeEventListener("change", s), t
  3125. .removeEventListener("addtrack", s), t.removeEventListener("removetrack", s);
  3126. for (var e = 0; e < t.length; e++) {
  3127. t[e].removeEventListener("cuechange", a)
  3128. }
  3129. })
  3130. }, t.prototype.addTextTrack = function(e, t, i) {
  3131. if (!e) throw new Error("TextTrack kind is required but was not provided");
  3132. return function(e, t, i, r) {
  3133. var n = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {},
  3134. a = e.textTracks();
  3135. n.kind = t, i && (n.label = i), r && (n.language = r), n.tech = e;
  3136. var s = new Ni.text.TrackClass(n);
  3137. return a.addTrack(s), s
  3138. }(this, e, t, i)
  3139. }, t.prototype.createRemoteTextTrack = function(e) {
  3140. var t = Ke(e, {
  3141. tech: this
  3142. });
  3143. return new Ui.remoteTextEl.TrackClass(t)
  3144. }, t.prototype.addRemoteTextTrack = function() {
  3145. var e = this,
  3146. t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  3147. i = arguments[1],
  3148. r = this.createRemoteTextTrack(t);
  3149. return !0 !== i && !1 !== i && (p.warn(
  3150. 'Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'
  3151. ), i = !0), this.remoteTextTrackEls().addTrackElement_(r), this.remoteTextTracks().addTrack(r.track), !
  3152. 0 !== i && this.ready(function() {
  3153. return e.autoRemoteTextTracks_.addTrack(r.track)
  3154. }), r
  3155. }, t.prototype.removeRemoteTextTrack = function(e) {
  3156. var t = this.remoteTextTrackEls().getTrackElementByTrack_(e);
  3157. this.remoteTextTrackEls().removeTrackElement_(t), this.remoteTextTracks().removeTrack(e), this
  3158. .autoRemoteTextTracks_.removeTrack(e)
  3159. }, t.prototype.getVideoPlaybackQuality = function() {
  3160. return {}
  3161. }, t.prototype.setPoster = function() {}, t.prototype.playsinline = function() {}, t.prototype
  3162. .setPlaysinline = function() {}, t.prototype.overrideNativeAudioTracks = function() {}, t.prototype
  3163. .overrideNativeVideoTracks = function() {}, t.prototype.canPlayType = function() {
  3164. return ""
  3165. }, t.canPlayType = function() {
  3166. return ""
  3167. }, t.canPlaySource = function(e, i) {
  3168. return t.canPlayType(e.type)
  3169. }, t.isTech = function(e) {
  3170. return e.prototype instanceof t || e instanceof t || e === t
  3171. }, t.registerTech = function(e, i) {
  3172. if (t.techs_ || (t.techs_ = {}), !t.isTech(i)) throw new Error("Tech " + e + " must be a Tech");
  3173. if (!t.canPlayType) throw new Error("Techs must have a static canPlayType method on them");
  3174. if (!t.canPlaySource) throw new Error("Techs must have a static canPlaySource method on them");
  3175. return e = ze(e), t.techs_[e] = i, "Tech" !== e && t.defaultTechOrder_.push(e), i
  3176. }, t.getTech = function(e) {
  3177. if (e) return e = ze(e), t.techs_ && t.techs_[e] ? t.techs_[e] : n && n.videojs && n.videojs[e] ? (p.warn(
  3178. "The " + e +
  3179. " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"
  3180. ), n.videojs[e]) : void 0
  3181. }, t
  3182. }(Ye);
  3183. Ni.names.forEach(function(e) {
  3184. var t = Ni[e];
  3185. _r.prototype[t.getterName] = function() {
  3186. return this[t.privateName] = this[t.privateName] || new t.ListClass, this[t.privateName]
  3187. }
  3188. }), _r.prototype.featuresVolumeControl = !0, _r.prototype.featuresMuteControl = !0, _r.prototype
  3189. .featuresFullscreenResize = !1, _r.prototype.featuresPlaybackRate = !1, _r.prototype.featuresProgressEvents = !1,
  3190. _r.prototype.featuresSourceset = !1, _r.prototype.featuresTimeupdateEvents = !1, _r.prototype
  3191. .featuresNativeTextTracks = !1, _r.withSourceHandlers = function(e) {
  3192. e.registerSourceHandler = function(t, i) {
  3193. var r = e.sourceHandlers;
  3194. r || (r = e.sourceHandlers = []), void 0 === i && (i = r.length), r.splice(i, 0, t)
  3195. }, e.canPlayType = function(t) {
  3196. for (var i = e.sourceHandlers || [], r = void 0, n = 0; n < i.length; n++)
  3197. if (r = i[n].canPlayType(t)) return r;
  3198. return ""
  3199. }, e.selectSourceHandler = function(t, i) {
  3200. for (var r = e.sourceHandlers || [], n = 0; n < r.length; n++)
  3201. if (r[n].canHandleSource(t, i)) return r[n];
  3202. return null
  3203. }, e.canPlaySource = function(t, i) {
  3204. var r = e.selectSourceHandler(t, i);
  3205. return r ? r.canHandleSource(t, i) : ""
  3206. };
  3207. ["seekable", "seeking", "duration"].forEach(function(e) {
  3208. var t = this[e];
  3209. "function" == typeof t && (this[e] = function() {
  3210. return this.sourceHandler_ && this.sourceHandler_[e] ? this.sourceHandler_[e].apply(this
  3211. .sourceHandler_, arguments) : t.apply(this, arguments)
  3212. })
  3213. }, e.prototype), e.prototype.setSource = function(t) {
  3214. var i = e.selectSourceHandler(t, this.options_);
  3215. i || (e.nativeSourceHandler ? i = e.nativeSourceHandler : p.error(
  3216. "No source handler found for the current source.")), this.disposeSourceHandler(), this.off("dispose",
  3217. this.disposeSourceHandler), i !== e.nativeSourceHandler && (this.currentSource_ = t), this
  3218. .sourceHandler_ = i.handleSource(t, this, this.options_), this.on("dispose", this.disposeSourceHandler)
  3219. }, e.prototype.disposeSourceHandler = function() {
  3220. this.currentSource_ && (this.clearTracks(["audio", "video"]), this.currentSource_ = null), this
  3221. .cleanupAutoTextTracks(), this.sourceHandler_ && (this.sourceHandler_.dispose && this.sourceHandler_
  3222. .dispose(), this.sourceHandler_ = null)
  3223. }
  3224. }, Ye.registerComponent("Tech", _r), _r.registerTech("Tech", _r), _r.defaultTechOrder_ = [];
  3225. var br = {},
  3226. wr = {},
  3227. Er = {};
  3228. function Tr(e, t, i) {
  3229. e.setTimeout(function() {
  3230. return function e() {
  3231. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  3232. var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [];
  3233. var r = arguments[2];
  3234. var n = arguments[3];
  3235. var a = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : [];
  3236. var s = arguments.length > 5 && void 0 !== arguments[5] && arguments[5];
  3237. var o = i[0],
  3238. u = i.slice(1);
  3239. if ("string" == typeof o) e(t, br[o], r, n, a, s);
  3240. else if (o) {
  3241. var l = function(e, t) {
  3242. var i = wr[e.id()],
  3243. r = null;
  3244. if (void 0 === i || null === i) return r = t(e), wr[e.id()] = [
  3245. [t, r]
  3246. ], r;
  3247. for (var n = 0; n < i.length; n++) {
  3248. var a = i[n],
  3249. s = a[0],
  3250. o = a[1];
  3251. s === t && (r = o)
  3252. }
  3253. null === r && (r = t(e), i.push([t, r]));
  3254. return r
  3255. }(n, o);
  3256. if (!l.setSource) return a.push(l), e(t, u, r, n, a, s);
  3257. l.setSource(A({}, t), function(i, o) {
  3258. if (i) return e(t, u, r, n, a, s);
  3259. a.push(l), e(o, t.type === o.type ? u : br[o.type], r, n, a, s)
  3260. })
  3261. } else u.length ? e(t, u, r, n, a, s) : s ? r(t, a) : e(t, br["*"], r, n, a, !0)
  3262. }(t, br[t.type], i, e)
  3263. }, 1)
  3264. }
  3265. function Sr(e, t, i) {
  3266. var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null,
  3267. n = "call" + ze(i),
  3268. a = e.reduce(Mr(n), r),
  3269. s = a === Er,
  3270. o = s ? null : t[i](a);
  3271. return function(e, t, i, r) {
  3272. for (var n = e.length - 1; n >= 0; n--) {
  3273. var a = e[n];
  3274. a[t] && a[t](r, i)
  3275. }
  3276. }(e, i, o, s), o
  3277. }
  3278. var Ar = {
  3279. buffered: 1,
  3280. currentTime: 1,
  3281. duration: 1,
  3282. seekable: 1,
  3283. played: 1,
  3284. paused: 1
  3285. },
  3286. kr = {
  3287. setCurrentTime: 1
  3288. },
  3289. Rr = {
  3290. play: 1,
  3291. pause: 1
  3292. };
  3293. function Mr(e) {
  3294. return function(t, i) {
  3295. return t === Er ? Er : i[e] ? i[e](t) : t
  3296. }
  3297. }
  3298. var Or = {
  3299. opus: "video/ogg",
  3300. ogv: "video/ogg",
  3301. mp4: "video/mp4",
  3302. mov: "video/mp4",
  3303. m4v: "video/mp4",
  3304. mkv: "video/x-matroska",
  3305. mp3: "audio/mpeg",
  3306. aac: "audio/aac",
  3307. oga: "audio/ogg",
  3308. m3u8: "application/x-mpegURL"
  3309. },
  3310. Cr = function() {
  3311. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
  3312. t = $t(e);
  3313. return Or[t.toLowerCase()] || ""
  3314. };
  3315. function Dr(e) {
  3316. var t = Cr(e.src);
  3317. return !e.type && t && (e.type = t), e
  3318. }
  3319. var Ir = function(e) {
  3320. function t(i, r, n) {
  3321. y(this, t);
  3322. var a = Ke({
  3323. createEl: !1
  3324. }, r),
  3325. s = b(this, e.call(this, i, a, n));
  3326. if (r.playerOptions.sources && 0 !== r.playerOptions.sources.length) i.src(r.playerOptions.sources);
  3327. else
  3328. for (var o = 0, u = r.playerOptions.techOrder; o < u.length; o++) {
  3329. var l = ze(u[o]),
  3330. d = _r.getTech(l);
  3331. if (l || (d = Ye.getComponent(l)), d && d.isSupported()) {
  3332. i.loadTech_(l);
  3333. break
  3334. }
  3335. }
  3336. return s
  3337. }
  3338. return _(t, e), t
  3339. }(Ye);
  3340. Ye.registerComponent("MediaLoader", Ir);
  3341. var Lr = function(e) {
  3342. function t(i, r) {
  3343. y(this, t);
  3344. var n = b(this, e.call(this, i, r));
  3345. return n.emitTapEvents(), n.enable(), n
  3346. }
  3347. return _(t, e), t.prototype.createEl = function() {
  3348. var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "div",
  3349. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  3350. r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
  3351. i = A({
  3352. innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>',
  3353. className: this.buildCSSClass(),
  3354. tabIndex: 0
  3355. }, i), "button" === t && p.error("Creating a ClickableComponent with an HTML element of " + t +
  3356. " is not supported; use a Button instead."), r = A({
  3357. role: "button"
  3358. }, r), this.tabIndex_ = i.tabIndex;
  3359. var n = e.prototype.createEl.call(this, t, i, r);
  3360. return this.createControlTextEl(n), n
  3361. }, t.prototype.dispose = function() {
  3362. this.controlTextEl_ = null, e.prototype.dispose.call(this)
  3363. }, t.prototype.createControlTextEl = function(e) {
  3364. return this.controlTextEl_ = U("span", {
  3365. className: "vjs-control-text"
  3366. }, {
  3367. "aria-live": "polite"
  3368. }), e && e.appendChild(this.controlTextEl_), this.controlText(this.controlText_, e), this.controlTextEl_
  3369. }, t.prototype.controlText = function(e) {
  3370. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.el();
  3371. if (void 0 === e) return this.controlText_ || "Need Text";
  3372. var i = this.localize(e);
  3373. this.controlText_ = e, N(this.controlTextEl_, i), this.nonIconControl || t.setAttribute("title", i)
  3374. }, t.prototype.buildCSSClass = function() {
  3375. return "vjs-control vjs-button " + e.prototype.buildCSSClass.call(this)
  3376. }, t.prototype.enable = function() {
  3377. this.enabled_ || (this.enabled_ = !0, this.removeClass("vjs-disabled"), this.el_.setAttribute(
  3378. "aria-disabled", "false"), void 0 !== this.tabIndex_ && this.el_.setAttribute("tabIndex", this
  3379. .tabIndex_), this.on(["tap", "click"], this.handleClick), this.on("focus", this.handleFocus), this.on(
  3380. "blur", this.handleBlur))
  3381. }, t.prototype.disable = function() {
  3382. this.enabled_ = !1, this.addClass("vjs-disabled"), this.el_.setAttribute("aria-disabled", "true"),
  3383. void 0 !== this.tabIndex_ && this.el_.removeAttribute("tabIndex"), this.off(["tap", "click"], this
  3384. .handleClick), this.off("focus", this.handleFocus), this.off("blur", this.handleBlur)
  3385. }, t.prototype.handleClick = function(e) {}, t.prototype.handleFocus = function(e) {
  3386. be(l, "keydown", De(this, this.handleKeyPress))
  3387. }, t.prototype.handleKeyPress = function(t) {
  3388. 32 === t.which || 13 === t.which ? (t.preventDefault(), this.trigger("click")) : e.prototype
  3389. .handleKeyPress && e.prototype.handleKeyPress.call(this, t)
  3390. }, t.prototype.handleBlur = function(e) {
  3391. we(l, "keydown", De(this, this.handleKeyPress))
  3392. }, t
  3393. }(Ye);
  3394. Ye.registerComponent("ClickableComponent", Lr);
  3395. var xr = function(e) {
  3396. function t(i, r) {
  3397. y(this, t);
  3398. var n = b(this, e.call(this, i, r));
  3399. return n.update(), i.on("posterchange", De(n, n.update)), n
  3400. }
  3401. return _(t, e), t.prototype.dispose = function() {
  3402. this.player().off("posterchange", this.update), e.prototype.dispose.call(this)
  3403. }, t.prototype.createEl = function() {
  3404. return U("div", {
  3405. className: "vjs-poster",
  3406. tabIndex: -1
  3407. })
  3408. }, t.prototype.update = function(e) {
  3409. var t = this.player().poster();
  3410. this.setSrc(t), t ? this.show() : this.hide()
  3411. }, t.prototype.setSrc = function(e) {
  3412. var t = "";
  3413. e && (t = 'url("' + e + '")'), this.el_.style.backgroundImage = t
  3414. }, t.prototype.handleClick = function(e) {
  3415. this.player_.controls() && (this.player_.paused() ? Dt(this.player_.play()) : this.player_.pause())
  3416. }, t
  3417. }(Lr);
  3418. Ye.registerComponent("PosterImage", xr);
  3419. var Pr = {
  3420. monospace: "monospace",
  3421. sansSerif: "sans-serif",
  3422. serif: "serif",
  3423. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  3424. monospaceSerif: '"Courier New", monospace',
  3425. proportionalSansSerif: "sans-serif",
  3426. proportionalSerif: "serif",
  3427. casual: '"Comic Sans MS", Impact, fantasy',
  3428. script: '"Monotype Corsiva", cursive',
  3429. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  3430. };
  3431. function Ur(e, t) {
  3432. var i = void 0;
  3433. if (4 === e.length) i = e[1] + e[1] + e[2] + e[2] + e[3] + e[3];
  3434. else {
  3435. if (7 !== e.length) throw new Error("Invalid color code provided, " + e +
  3436. "; must be formatted as e.g. #f0e or #f604e2.");
  3437. i = e.slice(1)
  3438. }
  3439. return "rgba(" + parseInt(i.slice(0, 2), 16) + "," + parseInt(i.slice(2, 4), 16) + "," + parseInt(i.slice(4, 6),
  3440. 16) + "," + t + ")"
  3441. }
  3442. function Nr(e, t, i) {
  3443. try {
  3444. e.style[t] = i
  3445. } catch (e) {
  3446. return
  3447. }
  3448. }
  3449. var Br = function(e) {
  3450. function t(i, r, a) {
  3451. y(this, t);
  3452. var s = b(this, e.call(this, i, r, a)),
  3453. o = De(s, s.updateDisplay);
  3454. return i.on("loadstart", De(s, s.toggleDisplay)), i.on("texttrackchange", o), i.on("loadstart", De(s, s
  3455. .preselectTrack)), i.ready(De(s, function() {
  3456. if (i.tech_ && i.tech_.featuresNativeTextTracks) this.hide();
  3457. else {
  3458. i.on("fullscreenchange", o), i.on("playerresize", o), n.addEventListener("orientationchange", o), i
  3459. .on("dispose", function() {
  3460. return n.removeEventListener("orientationchange", o)
  3461. });
  3462. for (var e = this.options_.playerOptions.tracks || [], t = 0; t < e.length; t++) this.player_
  3463. .addRemoteTextTrack(e[t], !0);
  3464. this.preselectTrack()
  3465. }
  3466. })), s
  3467. }
  3468. return _(t, e), t.prototype.preselectTrack = function() {
  3469. for (var e = {
  3470. captions: 1,
  3471. subtitles: 1
  3472. }, t = this.player_.textTracks(), i = this.player_.cache_.selectedLanguage, r = void 0, n = void 0, a =
  3473. void 0, s = 0; s < t.length; s++) {
  3474. var o = t[s];
  3475. i && i.enabled && i.language === o.language ? o.kind === i.kind ? a = o : a || (a = o) : i && !i.enabled ?
  3476. (a = null, r = null, n = null) : o.default && ("descriptions" !== o.kind || r ? o.kind in e && !n && (
  3477. n = o) : r = o)
  3478. }
  3479. a ? a.mode = "showing" : n ? n.mode = "showing" : r && (r.mode = "showing")
  3480. }, t.prototype.toggleDisplay = function() {
  3481. this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks ? this.hide() : this.show()
  3482. }, t.prototype.createEl = function() {
  3483. return e.prototype.createEl.call(this, "div", {
  3484. className: "vjs-text-track-display"
  3485. }, {
  3486. "aria-live": "off",
  3487. "aria-atomic": "true"
  3488. })
  3489. }, t.prototype.clearDisplay = function() {
  3490. "function" == typeof n.WebVTT && n.WebVTT.processCues(n, [], this.el_)
  3491. }, t.prototype.updateDisplay = function() {
  3492. var e = this.player_.textTracks();
  3493. this.clearDisplay();
  3494. for (var t = null, i = null, r = e.length; r--;) {
  3495. var n = e[r];
  3496. "showing" === n.mode && ("descriptions" === n.kind ? t = n : i = n)
  3497. }
  3498. i ? ("off" !== this.getAttribute("aria-live") && this.setAttribute("aria-live", "off"), this.updateForTrack(
  3499. i)) : t && ("assertive" !== this.getAttribute("aria-live") && this.setAttribute("aria-live",
  3500. "assertive"), this.updateForTrack(t))
  3501. }, t.prototype.updateForTrack = function(e) {
  3502. if ("function" == typeof n.WebVTT && e.activeCues) {
  3503. for (var t = [], i = 0; i < e.activeCues.length; i++) t.push(e.activeCues[i]);
  3504. if (n.WebVTT.processCues(n, t, this.el_), this.player_.textTrackSettings)
  3505. for (var r = this.player_.textTrackSettings.getValues(), a = t.length; a--;) {
  3506. var s = t[a];
  3507. if (s) {
  3508. var o = s.displayState;
  3509. if (r.color && (o.firstChild.style.color = r.color), r.textOpacity && Nr(o.firstChild, "color", Ur(r
  3510. .color || "#fff", r.textOpacity)), r.backgroundColor && (o.firstChild.style.backgroundColor = r
  3511. .backgroundColor), r.backgroundOpacity && Nr(o.firstChild, "backgroundColor", Ur(r
  3512. .backgroundColor || "#000", r.backgroundOpacity)), r.windowColor && (r.windowOpacity ? Nr(o,
  3513. "backgroundColor", Ur(r.windowColor, r.windowOpacity)) : o.style.backgroundColor = r
  3514. .windowColor), r.edgeStyle && ("dropshadow" === r.edgeStyle ? o.firstChild.style.textShadow =
  3515. "2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px #222" : "raised" === r.edgeStyle ? o.firstChild
  3516. .style.textShadow = "1px 1px #222, 2px 2px #222, 3px 3px #222" : "depressed" === r.edgeStyle ? o
  3517. .firstChild.style.textShadow = "1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px #222" :
  3518. "uniform" === r.edgeStyle && (o.firstChild.style.textShadow =
  3519. "0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px #222")), r.fontPercent && 1 !== r
  3520. .fontPercent) {
  3521. var u = n.parseFloat(o.style.fontSize);
  3522. o.style.fontSize = u * r.fontPercent + "px", o.style.height = "auto", o.style.top = "auto", o
  3523. .style.bottom = "2px"
  3524. }
  3525. r.fontFamily && "default" !== r.fontFamily && ("small-caps" === r.fontFamily ? o.firstChild.style
  3526. .fontVariant = "small-caps" : o.firstChild.style.fontFamily = Pr[r.fontFamily])
  3527. }
  3528. }
  3529. }
  3530. }, t
  3531. }(Ye);
  3532. Ye.registerComponent("TextTrackDisplay", Br);
  3533. var Fr = function(e) {
  3534. function t() {
  3535. return y(this, t), b(this, e.apply(this, arguments))
  3536. }
  3537. return _(t, e), t.prototype.createEl = function() {
  3538. var t = this.player_.isAudio(),
  3539. i = this.localize(t ? "Audio Player" : "Video Player"),
  3540. r = U("span", {
  3541. className: "vjs-control-text",
  3542. innerHTML: this.localize("{1} is loading.", [i])
  3543. }),
  3544. n = e.prototype.createEl.call(this, "div", {
  3545. className: "vjs-loading-spinner",
  3546. dir: "ltr"
  3547. });
  3548. return n.appendChild(r), n
  3549. }, t
  3550. }(Ye);
  3551. Ye.registerComponent("LoadingSpinner", Fr);
  3552. var jr = function(e) {
  3553. function t() {
  3554. return y(this, t), b(this, e.apply(this, arguments))
  3555. }
  3556. return _(t, e), t.prototype.createEl = function(e) {
  3557. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  3558. i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
  3559. t = A({
  3560. innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span>',
  3561. className: this.buildCSSClass()
  3562. }, t), i = A({
  3563. type: "button"
  3564. }, i);
  3565. var r = Ye.prototype.createEl.call(this, "button", t, i);
  3566. return this.createControlTextEl(r), r
  3567. }, t.prototype.addChild = function(e) {
  3568. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  3569. i = this.constructor.name;
  3570. return p.warn("Adding an actionable (user controllable) child to a Button (" + i +
  3571. ") is not supported; use a ClickableComponent instead."), Ye.prototype.addChild.call(this, e, t)
  3572. }, t.prototype.enable = function() {
  3573. e.prototype.enable.call(this), this.el_.removeAttribute("disabled")
  3574. }, t.prototype.disable = function() {
  3575. e.prototype.disable.call(this), this.el_.setAttribute("disabled", "disabled")
  3576. }, t.prototype.handleKeyPress = function(t) {
  3577. 32 !== t.which && 13 !== t.which && e.prototype.handleKeyPress.call(this, t)
  3578. }, t
  3579. }(Lr);
  3580. Ye.registerComponent("Button", jr);
  3581. var Hr = function(e) {
  3582. function t(i, r) {
  3583. y(this, t);
  3584. var n = b(this, e.call(this, i, r));
  3585. return n.mouseused_ = !1, n.on("mousedown", n.handleMouseDown), n
  3586. }
  3587. return _(t, e), t.prototype.buildCSSClass = function() {
  3588. return "vjs-big-play-button"
  3589. }, t.prototype.handleClick = function(e) {
  3590. var t = this.player_.play();
  3591. if (this.mouseused_ && e.clientX && e.clientY) Dt(t);
  3592. else {
  3593. var i = this.player_.getChild("controlBar"),
  3594. r = i && i.getChild("playToggle");
  3595. if (r) {
  3596. var n = function() {
  3597. return r.focus()
  3598. };
  3599. Ct(t) ? t.then(n, function() {}) : this.setTimeout(n, 1)
  3600. } else this.player_.focus()
  3601. }
  3602. }, t.prototype.handleKeyPress = function(t) {
  3603. this.mouseused_ = !1, e.prototype.handleKeyPress.call(this, t)
  3604. }, t.prototype.handleMouseDown = function(e) {
  3605. this.mouseused_ = !0
  3606. }, t
  3607. }(jr);
  3608. Hr.prototype.controlText_ = "Play Video", Ye.registerComponent("BigPlayButton", Hr);
  3609. var Gr = function(e) {
  3610. function t(i, r) {
  3611. y(this, t);
  3612. var n = b(this, e.call(this, i, r));
  3613. return n.controlText(r && r.controlText || n.localize("Close")), n
  3614. }
  3615. return _(t, e), t.prototype.buildCSSClass = function() {
  3616. return "vjs-close-button " + e.prototype.buildCSSClass.call(this)
  3617. }, t.prototype.handleClick = function(e) {
  3618. this.trigger({
  3619. type: "close",
  3620. bubbles: !1
  3621. })
  3622. }, t
  3623. }(jr);
  3624. Ye.registerComponent("CloseButton", Gr);
  3625. var Vr = function(e) {
  3626. function t(i, r) {
  3627. y(this, t);
  3628. var n = b(this, e.call(this, i, r));
  3629. return n.on(i, "play", n.handlePlay), n.on(i, "pause", n.handlePause), n.on(i, "ended", n.handleEnded), n
  3630. }
  3631. return _(t, e), t.prototype.buildCSSClass = function() {
  3632. return "vjs-play-control " + e.prototype.buildCSSClass.call(this)
  3633. }, t.prototype.handleClick = function(e) {
  3634. this.player_.paused() ? this.player_.play() : this.player_.pause()
  3635. }, t.prototype.handleSeeked = function(e) {
  3636. this.removeClass("vjs-ended"), this.player_.paused() ? this.handlePause(e) : this.handlePlay(e)
  3637. }, t.prototype.handlePlay = function(e) {
  3638. this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this
  3639. .controlText("Pause")
  3640. }, t.prototype.handlePause = function(e) {
  3641. this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.controlText("Play")
  3642. }, t.prototype.handleEnded = function(e) {
  3643. this.removeClass("vjs-playing"), this.addClass("vjs-ended"), this.controlText("Replay"), this.one(this
  3644. .player_, "seeked", this.handleSeeked)
  3645. }, t
  3646. }(jr);
  3647. Vr.prototype.controlText_ = "Play", Ye.registerComponent("PlayToggle", Vr);
  3648. var Wr = function(e, t) {
  3649. e = e < 0 ? 0 : e;
  3650. var i = Math.floor(e % 60),
  3651. r = Math.floor(e / 60 % 60),
  3652. n = Math.floor(e / 3600),
  3653. a = Math.floor(t / 60 % 60),
  3654. s = Math.floor(t / 3600);
  3655. return (isNaN(e) || e === 1 / 0) && (n = r = i = "-"), (n = n > 0 || s > 0 ? n + ":" : "") + (r = ((n || a >=
  3656. 10) && r < 10 ? "0" + r : r) + ":") + (i = i < 10 ? "0" + i : i)
  3657. },
  3658. qr = Wr;
  3659. function Xr(e) {
  3660. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : e;
  3661. return qr(e, t)
  3662. }
  3663. var zr = function(e) {
  3664. function t(i, r) {
  3665. y(this, t);
  3666. var n = b(this, e.call(this, i, r));
  3667. return n.throttledUpdateContent = Ie(De(n, n.updateContent), 25), n.on(i, "timeupdate", n
  3668. .throttledUpdateContent), n
  3669. }
  3670. return _(t, e), t.prototype.createEl = function(t) {
  3671. var i = this.buildCSSClass(),
  3672. r = e.prototype.createEl.call(this, "div", {
  3673. className: i + " vjs-time-control vjs-control",
  3674. innerHTML: '<span class="vjs-control-text">' + this.localize(this.labelText_) + " </span>"
  3675. });
  3676. return this.contentEl_ = U("span", {
  3677. className: i + "-display"
  3678. }, {
  3679. "aria-live": "off"
  3680. }), this.updateTextNode_(), r.appendChild(this.contentEl_), r
  3681. }, t.prototype.dispose = function() {
  3682. this.contentEl_ = null, this.textNode_ = null, e.prototype.dispose.call(this)
  3683. }, t.prototype.updateTextNode_ = function() {
  3684. if (this.contentEl_) {
  3685. for (; this.contentEl_.firstChild;) this.contentEl_.removeChild(this.contentEl_.firstChild);
  3686. this.textNode_ = l.createTextNode(this.formattedTime_ || this.formatTime_(0)), this.contentEl_
  3687. .appendChild(this.textNode_)
  3688. }
  3689. }, t.prototype.formatTime_ = function(e) {
  3690. return Xr(e)
  3691. }, t.prototype.updateFormattedTime_ = function(e) {
  3692. var t = this.formatTime_(e);
  3693. t !== this.formattedTime_ && (this.formattedTime_ = t, this.requestAnimationFrame(this.updateTextNode_))
  3694. }, t.prototype.updateContent = function(e) {}, t
  3695. }(Ye);
  3696. zr.prototype.labelText_ = "Time", zr.prototype.controlText_ = "Time", Ye.registerComponent("TimeDisplay", zr);
  3697. var Kr = function(e) {
  3698. function t(i, r) {
  3699. y(this, t);
  3700. var n = b(this, e.call(this, i, r));
  3701. return n.on(i, "ended", n.handleEnded), n
  3702. }
  3703. return _(t, e), t.prototype.buildCSSClass = function() {
  3704. return "vjs-current-time"
  3705. }, t.prototype.updateContent = function(e) {
  3706. var t = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  3707. this.updateFormattedTime_(t)
  3708. }, t.prototype.handleEnded = function(e) {
  3709. this.player_.duration() && this.updateFormattedTime_(this.player_.duration())
  3710. }, t
  3711. }(zr);
  3712. Kr.prototype.labelText_ = "Current Time", Kr.prototype.controlText_ = "Current Time", Ye.registerComponent(
  3713. "CurrentTimeDisplay", Kr);
  3714. var Yr = function(e) {
  3715. function t(i, r) {
  3716. y(this, t);
  3717. var n = b(this, e.call(this, i, r));
  3718. return n.on(i, "durationchange", n.updateContent), n.on(i, "loadedmetadata", n.throttledUpdateContent), n
  3719. }
  3720. return _(t, e), t.prototype.buildCSSClass = function() {
  3721. return "vjs-duration"
  3722. }, t.prototype.updateContent = function(e) {
  3723. var t = this.player_.duration();
  3724. t && this.duration_ !== t && (this.duration_ = t, this.updateFormattedTime_(t))
  3725. }, t
  3726. }(zr);
  3727. Yr.prototype.labelText_ = "Duration", Yr.prototype.controlText_ = "Duration", Ye.registerComponent(
  3728. "DurationDisplay", Yr);
  3729. var Qr = function(e) {
  3730. function t() {
  3731. return y(this, t), b(this, e.apply(this, arguments))
  3732. }
  3733. return _(t, e), t.prototype.createEl = function() {
  3734. return e.prototype.createEl.call(this, "div", {
  3735. className: "vjs-time-control vjs-time-divider",
  3736. innerHTML: "<div><span>/</span></div>"
  3737. })
  3738. }, t
  3739. }(Ye);
  3740. Ye.registerComponent("TimeDivider", Qr);
  3741. var Jr = function(e) {
  3742. function t(i, r) {
  3743. y(this, t);
  3744. var n = b(this, e.call(this, i, r));
  3745. return n.on(i, "durationchange", n.throttledUpdateContent), n.on(i, "ended", n.handleEnded), n
  3746. }
  3747. return _(t, e), t.prototype.buildCSSClass = function() {
  3748. return "vjs-remaining-time"
  3749. }, t.prototype.formatTime_ = function(t) {
  3750. return "-" + e.prototype.formatTime_.call(this, t)
  3751. }, t.prototype.updateContent = function(e) {
  3752. this.player_.duration() && (this.player_.remainingTimeDisplay ? this.updateFormattedTime_(this.player_
  3753. .remainingTimeDisplay()) : this.updateFormattedTime_(this.player_.remainingTime()))
  3754. }, t.prototype.handleEnded = function(e) {
  3755. this.player_.duration() && this.updateFormattedTime_(0)
  3756. }, t
  3757. }(zr);
  3758. Jr.prototype.labelText_ = "Remaining Time", Jr.prototype.controlText_ = "Remaining Time", Ye.registerComponent(
  3759. "RemainingTimeDisplay", Jr);
  3760. var Zr = function(e) {
  3761. function t(i, r) {
  3762. y(this, t);
  3763. var n = b(this, e.call(this, i, r));
  3764. return n.updateShowing(), n.on(n.player(), "durationchange", n.updateShowing), n
  3765. }
  3766. return _(t, e), t.prototype.createEl = function() {
  3767. var t = e.prototype.createEl.call(this, "div", {
  3768. className: "vjs-live-control vjs-control"
  3769. });
  3770. return this.contentEl_ = U("div", {
  3771. className: "vjs-live-display",
  3772. innerHTML: '<span class="vjs-control-text">' + this.localize("Stream Type") + " </span>" + this
  3773. .localize("LIVE")
  3774. }, {
  3775. "aria-live": "off"
  3776. }), t.appendChild(this.contentEl_), t
  3777. }, t.prototype.dispose = function() {
  3778. this.contentEl_ = null, e.prototype.dispose.call(this)
  3779. }, t.prototype.updateShowing = function(e) {
  3780. this.player().duration() === 1 / 0 ? this.show() : this.hide()
  3781. }, t
  3782. }(Ye);
  3783. Ye.registerComponent("LiveDisplay", Zr);
  3784. var $r = function(e) {
  3785. function t(i, r) {
  3786. y(this, t);
  3787. var n = b(this, e.call(this, i, r));
  3788. return n.bar = n.getChild(n.options_.barName), n.vertical(!!n.options_.vertical), n.enable(), n
  3789. }
  3790. return _(t, e), t.prototype.enabled = function() {
  3791. return this.enabled_
  3792. }, t.prototype.enable = function() {
  3793. this.enabled() || (this.on("mousedown", this.handleMouseDown), this.on("touchstart", this.handleMouseDown),
  3794. this.on("focus", this.handleFocus), this.on("blur", this.handleBlur), this.on("click", this
  3795. .handleClick), this.on(this.player_, "controlsvisible", this.update), this.playerEvent && this.on(this
  3796. .player_, this.playerEvent, this.update), this.removeClass("disabled"), this.setAttribute("tabindex",
  3797. 0), this.enabled_ = !0)
  3798. }, t.prototype.disable = function() {
  3799. if (this.enabled()) {
  3800. var e = this.bar.el_.ownerDocument;
  3801. this.off("mousedown", this.handleMouseDown), this.off("touchstart", this.handleMouseDown), this.off(
  3802. "focus", this.handleFocus), this.off("blur", this.handleBlur), this.off("click", this.handleClick),
  3803. this.off(this.player_, "controlsvisible", this.update), this.off(e, "mousemove", this.handleMouseMove),
  3804. this.off(e, "mouseup", this.handleMouseUp), this.off(e, "touchmove", this.handleMouseMove), this.off(e,
  3805. "touchend", this.handleMouseUp), this.removeAttribute("tabindex"), this.addClass("disabled"), this
  3806. .playerEvent && this.off(this.player_, this.playerEvent, this.update), this.enabled_ = !1
  3807. }
  3808. }, t.prototype.createEl = function(t) {
  3809. var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  3810. r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
  3811. return i.className = i.className + " vjs-slider", i = A({
  3812. tabIndex: 0
  3813. }, i), r = A({
  3814. role: "slider",
  3815. "aria-valuenow": 0,
  3816. "aria-valuemin": 0,
  3817. "aria-valuemax": 100,
  3818. tabIndex: 0
  3819. }, r), e.prototype.createEl.call(this, t, i, r)
  3820. }, t.prototype.handleMouseDown = function(e) {
  3821. var t = this.bar.el_.ownerDocument;
  3822. "mousedown" === e.type && e.preventDefault(), "touchstart" !== e.type || dt || e.preventDefault(), K(), this
  3823. .addClass("vjs-sliding"), this.trigger("slideractive"), this.on(t, "mousemove", this.handleMouseMove),
  3824. this.on(t, "mouseup", this.handleMouseUp), this.on(t, "touchmove", this.handleMouseMove), this.on(t,
  3825. "touchend", this.handleMouseUp), this.handleMouseMove(e)
  3826. }, t.prototype.handleMouseMove = function(e) {}, t.prototype.handleMouseUp = function() {
  3827. var e = this.bar.el_.ownerDocument;
  3828. Y(), this.removeClass("vjs-sliding"), this.trigger("sliderinactive"), this.off(e, "mousemove", this
  3829. .handleMouseMove), this.off(e, "mouseup", this.handleMouseUp), this.off(e, "touchmove", this
  3830. .handleMouseMove), this.off(e, "touchend", this.handleMouseUp), this.update()
  3831. }, t.prototype.update = function() {
  3832. if (this.el_) {
  3833. var e = this.getPercent(),
  3834. t = this.bar;
  3835. if (t) {
  3836. ("number" != typeof e || e != e || e < 0 || e === 1 / 0) && (e = 0);
  3837. var i = (100 * e).toFixed(2) + "%",
  3838. r = t.el().style;
  3839. return this.vertical() ? r.height = i : r.width = i, e
  3840. }
  3841. }
  3842. }, t.prototype.calculateDistance = function(e) {
  3843. var t = Z(this.el_, e);
  3844. return this.vertical() ? t.y : t.x
  3845. }, t.prototype.handleFocus = function() {
  3846. this.on(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress)
  3847. }, t.prototype.handleKeyPress = function(e) {
  3848. 37 === e.which || 40 === e.which ? (e.preventDefault(), this.stepBack()) : 38 !== e.which && 39 !== e
  3849. .which || (e.preventDefault(), this.stepForward())
  3850. }, t.prototype.handleBlur = function() {
  3851. this.off(this.bar.el_.ownerDocument, "keydown", this.handleKeyPress)
  3852. }, t.prototype.handleClick = function(e) {
  3853. e.stopImmediatePropagation(), e.preventDefault()
  3854. }, t.prototype.vertical = function(e) {
  3855. if (void 0 === e) return this.vertical_ || !1;
  3856. this.vertical_ = !!e, this.vertical_ ? this.addClass("vjs-slider-vertical") : this.addClass(
  3857. "vjs-slider-horizontal")
  3858. }, t
  3859. }(Ye);
  3860. Ye.registerComponent("Slider", $r);
  3861. var en = function(e) {
  3862. function t(i, r) {
  3863. y(this, t);
  3864. var n = b(this, e.call(this, i, r));
  3865. return n.partEls_ = [], n.on(i, "progress", n.update), n
  3866. }
  3867. return _(t, e), t.prototype.createEl = function() {
  3868. return e.prototype.createEl.call(this, "div", {
  3869. className: "vjs-load-progress",
  3870. innerHTML: '<span class="vjs-control-text"><span>' + this.localize("Loaded") + "</span>: 0%</span>"
  3871. })
  3872. }, t.prototype.dispose = function() {
  3873. this.partEls_ = null, e.prototype.dispose.call(this)
  3874. }, t.prototype.update = function(e) {
  3875. var t = this.player_.buffered(),
  3876. i = this.player_.duration(),
  3877. r = this.player_.bufferedEnd(),
  3878. n = this.partEls_,
  3879. a = function(e, t) {
  3880. var i = e / t || 0;
  3881. return 100 * (i >= 1 ? 1 : i) + "%"
  3882. };
  3883. this.el_.style.width = a(r, i);
  3884. for (var s = 0; s < t.length; s++) {
  3885. var o = t.start(s),
  3886. u = t.end(s),
  3887. l = n[s];
  3888. l || (l = this.el_.appendChild(U()), n[s] = l), l.style.left = a(o, r), l.style.width = a(u - o, r)
  3889. }
  3890. for (var d = n.length; d > t.length; d--) this.el_.removeChild(n[d - 1]);
  3891. n.length = t.length
  3892. }, t
  3893. }(Ye);
  3894. Ye.registerComponent("LoadProgressBar", en);
  3895. var tn = function(e) {
  3896. function t() {
  3897. return y(this, t), b(this, e.apply(this, arguments))
  3898. }
  3899. return _(t, e), t.prototype.createEl = function() {
  3900. return e.prototype.createEl.call(this, "div", {
  3901. className: "vjs-time-tooltip"
  3902. })
  3903. }, t.prototype.update = function(e, t, i) {
  3904. var r = Q(this.el_),
  3905. n = Q(this.player_.el()),
  3906. a = e.width * t;
  3907. if (n && r) {
  3908. var s = e.left - n.left + a,
  3909. o = e.width - a + (n.right - e.right),
  3910. u = r.width / 2;
  3911. s < u ? u += u - s : o < u && (u = o), u < 0 ? u = 0 : u > r.width && (u = r.width), this.el_.style
  3912. .right = "-" + u + "px", N(this.el_, i)
  3913. }
  3914. }, t
  3915. }(Ye);
  3916. Ye.registerComponent("TimeTooltip", tn);
  3917. var rn = function(e) {
  3918. function t() {
  3919. return y(this, t), b(this, e.apply(this, arguments))
  3920. }
  3921. return _(t, e), t.prototype.createEl = function() {
  3922. return e.prototype.createEl.call(this, "div", {
  3923. className: "vjs-play-progress vjs-slider-bar",
  3924. innerHTML: '<span class="vjs-control-text"><span>' + this.localize("Progress") + "</span>: 0%</span>"
  3925. })
  3926. }, t.prototype.update = function(e, t) {
  3927. var i = this;
  3928. this.rafId_ && this.cancelAnimationFrame(this.rafId_), this.rafId_ = this.requestAnimationFrame(function() {
  3929. var r = Xr(i.player_.scrubbing() ? i.player_.getCache().currentTime : i.player_.currentTime(), i
  3930. .player_.duration()),
  3931. n = i.getChild("timeTooltip");
  3932. n && n.update(e, t, r)
  3933. })
  3934. }, t
  3935. }(Ye);
  3936. rn.prototype.options_ = {
  3937. children: []
  3938. }, rt || at || rn.prototype.options_.children.push("timeTooltip"), Ye.registerComponent("PlayProgressBar", rn);
  3939. var nn = function(e) {
  3940. function t(i, r) {
  3941. y(this, t);
  3942. var n = b(this, e.call(this, i, r));
  3943. return n.update = Ie(De(n, n.update), 25), n
  3944. }
  3945. return _(t, e), t.prototype.createEl = function() {
  3946. return e.prototype.createEl.call(this, "div", {
  3947. className: "vjs-mouse-display"
  3948. })
  3949. }, t.prototype.update = function(e, t) {
  3950. var i = this;
  3951. this.rafId_ && this.cancelAnimationFrame(this.rafId_), this.rafId_ = this.requestAnimationFrame(function() {
  3952. var r = i.player_.duration(),
  3953. n = Xr(t * r, r);
  3954. i.el_.style.left = e.width * t + "px", i.getChild("timeTooltip").update(e, t, n)
  3955. })
  3956. }, t
  3957. }(Ye);
  3958. nn.prototype.options_ = {
  3959. children: ["timeTooltip"]
  3960. }, Ye.registerComponent("MouseTimeDisplay", nn);
  3961. var an = function(e) {
  3962. function t(i, r) {
  3963. y(this, t);
  3964. var n = b(this, e.call(this, i, r));
  3965. return n.setEventHandlers_(), n
  3966. }
  3967. return _(t, e), t.prototype.setEventHandlers_ = function() {
  3968. var e = this;
  3969. this.update = Ie(De(this, this.update), 30), this.on(this.player_, "timeupdate", this.update), this.on(this
  3970. .player_, "ended", this.handleEnded), this.updateInterval = null, this.on(this.player_, ["playing"],
  3971. function() {
  3972. e.clearInterval(e.updateInterval), e.updateInterval = e.setInterval(function() {
  3973. e.requestAnimationFrame(function() {
  3974. e.update()
  3975. })
  3976. }, 30)
  3977. }), this.on(this.player_, ["ended", "pause", "waiting"], function() {
  3978. e.clearInterval(e.updateInterval)
  3979. }), this.on(this.player_, ["timeupdate", "ended"], this.update)
  3980. }, t.prototype.createEl = function() {
  3981. return e.prototype.createEl.call(this, "div", {
  3982. className: "vjs-progress-holder"
  3983. }, {
  3984. "aria-label": this.localize("Progress Bar")
  3985. })
  3986. }, t.prototype.update_ = function(e, t) {
  3987. var i = this.player_.duration();
  3988. this.el_.setAttribute("aria-valuenow", (100 * t).toFixed(2)), this.el_.setAttribute("aria-valuetext", this
  3989. .localize("progress bar timing: currentTime={1} duration={2}", [Xr(e, i), Xr(i, i)], "{1} of {2}")),
  3990. this.bar.update(Q(this.el_), t)
  3991. }, t.prototype.update = function(t) {
  3992. var i = e.prototype.update.call(this);
  3993. return this.update_(this.getCurrentTime_(), i), i
  3994. }, t.prototype.getCurrentTime_ = function() {
  3995. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime()
  3996. }, t.prototype.handleEnded = function(e) {
  3997. this.update_(this.player_.duration(), 1)
  3998. }, t.prototype.getPercent = function() {
  3999. var e = this.getCurrentTime_() / this.player_.duration();
  4000. return e >= 1 ? 1 : e || 0
  4001. }, t.prototype.handleMouseDown = function(t) {
  4002. ne(t) && (t.stopPropagation(), this.player_.scrubbing(!0), this.videoWasPlaying = !this.player_.paused(),
  4003. this.player_.pause(), e.prototype.handleMouseDown.call(this, t))
  4004. }, t.prototype.handleMouseMove = function(e) {
  4005. if (ne(e)) {
  4006. var t = this.calculateDistance(e) * this.player_.duration();
  4007. t === this.player_.duration() && (t -= .1), this.player_.currentTime(t)
  4008. }
  4009. }, t.prototype.enable = function() {
  4010. e.prototype.enable.call(this);
  4011. var t = this.getChild("mouseTimeDisplay");
  4012. t && t.show()
  4013. }, t.prototype.disable = function() {
  4014. e.prototype.disable.call(this);
  4015. var t = this.getChild("mouseTimeDisplay");
  4016. t && t.hide()
  4017. }, t.prototype.handleMouseUp = function(t) {
  4018. e.prototype.handleMouseUp.call(this, t), t && t.stopPropagation(), this.player_.scrubbing(!1), this.player_
  4019. .trigger({
  4020. type: "timeupdate",
  4021. target: this,
  4022. manuallyTriggered: !0
  4023. }), this.videoWasPlaying && Dt(this.player_.play())
  4024. }, t.prototype.stepForward = function() {
  4025. this.player_.currentTime(this.player_.currentTime() + 5)
  4026. }, t.prototype.stepBack = function() {
  4027. this.player_.currentTime(this.player_.currentTime() - 5)
  4028. }, t.prototype.handleAction = function(e) {
  4029. this.player_.paused() ? this.player_.play() : this.player_.pause()
  4030. }, t.prototype.handleKeyPress = function(t) {
  4031. 32 === t.which || 13 === t.which ? (t.preventDefault(), this.handleAction(t)) : e.prototype
  4032. .handleKeyPress && e.prototype.handleKeyPress.call(this, t)
  4033. }, t
  4034. }($r);
  4035. an.prototype.options_ = {
  4036. children: ["loadProgressBar", "playProgressBar"],
  4037. barName: "playProgressBar"
  4038. }, rt || at || an.prototype.options_.children.splice(1, 0, "mouseTimeDisplay"), an.prototype.playerEvent =
  4039. "timeupdate", Ye.registerComponent("SeekBar", an);
  4040. var sn = function(e) {
  4041. function t(i, r) {
  4042. y(this, t);
  4043. var n = b(this, e.call(this, i, r));
  4044. return n.handleMouseMove = Ie(De(n, n.handleMouseMove), 25), n.throttledHandleMouseSeek = Ie(De(n, n
  4045. .handleMouseSeek), 25), n.enable(), n
  4046. }
  4047. return _(t, e), t.prototype.createEl = function() {
  4048. return e.prototype.createEl.call(this, "div", {
  4049. className: "vjs-progress-control vjs-control"
  4050. })
  4051. }, t.prototype.handleMouseMove = function(e) {
  4052. var t = this.getChild("seekBar");
  4053. if (t) {
  4054. var i = t.getChild("mouseTimeDisplay"),
  4055. r = t.el(),
  4056. n = Q(r),
  4057. a = Z(r, e).x;
  4058. a > 1 ? a = 1 : a < 0 && (a = 0), i && i.update(n, a)
  4059. }
  4060. }, t.prototype.handleMouseSeek = function(e) {
  4061. var t = this.getChild("seekBar");
  4062. t && t.handleMouseMove(e)
  4063. }, t.prototype.enabled = function() {
  4064. return this.enabled_
  4065. }, t.prototype.disable = function() {
  4066. this.children().forEach(function(e) {
  4067. return e.disable && e.disable()
  4068. }), this.enabled() && (this.off(["mousedown", "touchstart"], this.handleMouseDown), this.off(this.el_,
  4069. "mousemove", this.handleMouseMove), this.handleMouseUp(), this.addClass("disabled"), this.enabled_ = !
  4070. 1)
  4071. }, t.prototype.enable = function() {
  4072. this.children().forEach(function(e) {
  4073. return e.enable && e.enable()
  4074. }), this.enabled() || (this.on(["mousedown", "touchstart"], this.handleMouseDown), this.on(this.el_,
  4075. "mousemove", this.handleMouseMove), this.removeClass("disabled"), this.enabled_ = !0)
  4076. }, t.prototype.handleMouseDown = function(e) {
  4077. var t = this.el_.ownerDocument,
  4078. i = this.getChild("seekBar");
  4079. i && i.handleMouseDown(e), this.on(t, "mousemove", this.throttledHandleMouseSeek), this.on(t, "touchmove",
  4080. this.throttledHandleMouseSeek), this.on(t, "mouseup", this.handleMouseUp), this.on(t, "touchend", this
  4081. .handleMouseUp)
  4082. }, t.prototype.handleMouseUp = function(e) {
  4083. var t = this.el_.ownerDocument,
  4084. i = this.getChild("seekBar");
  4085. i && i.handleMouseUp(e), this.off(t, "mousemove", this.throttledHandleMouseSeek), this.off(t, "touchmove",
  4086. this.throttledHandleMouseSeek), this.off(t, "mouseup", this.handleMouseUp), this.off(t, "touchend", this
  4087. .handleMouseUp)
  4088. }, t
  4089. }(Ye);
  4090. sn.prototype.options_ = {
  4091. children: ["seekBar"]
  4092. }, Ye.registerComponent("ProgressControl", sn);
  4093. var on = function(e) {
  4094. function t(i, r) {
  4095. y(this, t);
  4096. var n = b(this, e.call(this, i, r));
  4097. return n.on(i, "fullscreenchange", n.handleFullscreenChange), !1 === l[wt.fullscreenEnabled] && n.disable(), n
  4098. }
  4099. return _(t, e), t.prototype.buildCSSClass = function() {
  4100. return "vjs-fullscreen-control " + e.prototype.buildCSSClass.call(this)
  4101. }, t.prototype.handleFullscreenChange = function(e) {
  4102. this.player_.isFullscreen() ? this.controlText("Non-Fullscreen") : this.controlText("Fullscreen")
  4103. }, t.prototype.handleClick = function(e) {
  4104. this.player_.isFullscreen() ? this.player_.exitFullscreen() : this.player_.requestFullscreen()
  4105. }, t
  4106. }(jr);
  4107. on.prototype.controlText_ = "Fullscreen", Ye.registerComponent("FullscreenToggle", on);
  4108. var un = function(e, t) {
  4109. t.tech_ && !t.tech_.featuresVolumeControl && e.addClass("vjs-hidden"), e.on(t, "loadstart", function() {
  4110. t.tech_.featuresVolumeControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden")
  4111. })
  4112. },
  4113. ln = function(e) {
  4114. function t() {
  4115. return y(this, t), b(this, e.apply(this, arguments))
  4116. }
  4117. return _(t, e), t.prototype.createEl = function() {
  4118. return e.prototype.createEl.call(this, "div", {
  4119. className: "vjs-volume-level",
  4120. innerHTML: '<span class="vjs-control-text"></span>'
  4121. })
  4122. }, t
  4123. }(Ye);
  4124. Ye.registerComponent("VolumeLevel", ln);
  4125. var dn = function(e) {
  4126. function t(i, r) {
  4127. y(this, t);
  4128. var n = b(this, e.call(this, i, r));
  4129. return n.on("slideractive", n.updateLastVolume_), n.on(i, "volumechange", n.updateARIAAttributes), i.ready(
  4130. function() {
  4131. return n.updateARIAAttributes()
  4132. }), n
  4133. }
  4134. return _(t, e), t.prototype.createEl = function() {
  4135. return e.prototype.createEl.call(this, "div", {
  4136. className: "vjs-volume-bar vjs-slider-bar"
  4137. }, {
  4138. "aria-label": this.localize("Volume Level"),
  4139. "aria-live": "polite"
  4140. })
  4141. }, t.prototype.handleMouseDown = function(t) {
  4142. ne(t) && e.prototype.handleMouseDown.call(this, t)
  4143. }, t.prototype.handleMouseMove = function(e) {
  4144. ne(e) && (this.checkMuted(), this.player_.volume(this.calculateDistance(e)))
  4145. }, t.prototype.checkMuted = function() {
  4146. this.player_.muted() && this.player_.muted(!1)
  4147. }, t.prototype.getPercent = function() {
  4148. return this.player_.muted() ? 0 : this.player_.volume()
  4149. }, t.prototype.stepForward = function() {
  4150. this.checkMuted(), this.player_.volume(this.player_.volume() + .1)
  4151. }, t.prototype.stepBack = function() {
  4152. this.checkMuted(), this.player_.volume(this.player_.volume() - .1)
  4153. }, t.prototype.updateARIAAttributes = function(e) {
  4154. var t = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  4155. this.el_.setAttribute("aria-valuenow", t), this.el_.setAttribute("aria-valuetext", t + "%")
  4156. }, t.prototype.volumeAsPercentage_ = function() {
  4157. return Math.round(100 * this.player_.volume())
  4158. }, t.prototype.updateLastVolume_ = function() {
  4159. var e = this,
  4160. t = this.player_.volume();
  4161. this.one("sliderinactive", function() {
  4162. 0 === e.player_.volume() && e.player_.lastVolume_(t)
  4163. })
  4164. }, t
  4165. }($r);
  4166. dn.prototype.options_ = {
  4167. children: ["volumeLevel"],
  4168. barName: "volumeLevel"
  4169. }, dn.prototype.playerEvent = "volumechange", Ye.registerComponent("VolumeBar", dn);
  4170. var cn = function(e) {
  4171. function t(i) {
  4172. var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  4173. y(this, t), r.vertical = r.vertical || !1, (void 0 === r.volumeBar || R(r.volumeBar)) && (r.volumeBar = r
  4174. .volumeBar || {}, r.volumeBar.vertical = r.vertical);
  4175. var n = b(this, e.call(this, i, r));
  4176. return un(n, i), n.throttledHandleMouseMove = Ie(De(n, n.handleMouseMove), 25), n.on("mousedown", n
  4177. .handleMouseDown), n.on("touchstart", n.handleMouseDown), n.on(n.volumeBar, ["focus", "slideractive"],
  4178. function() {
  4179. n.volumeBar.addClass("vjs-slider-active"), n.addClass("vjs-slider-active"), n.trigger("slideractive")
  4180. }), n.on(n.volumeBar, ["blur", "sliderinactive"], function() {
  4181. n.volumeBar.removeClass("vjs-slider-active"), n.removeClass("vjs-slider-active"), n.trigger(
  4182. "sliderinactive")
  4183. }), n
  4184. }
  4185. return _(t, e), t.prototype.createEl = function() {
  4186. var t = "vjs-volume-horizontal";
  4187. return this.options_.vertical && (t = "vjs-volume-vertical"), e.prototype.createEl.call(this, "div", {
  4188. className: "vjs-volume-control vjs-control " + t
  4189. })
  4190. }, t.prototype.handleMouseDown = function(e) {
  4191. var t = this.el_.ownerDocument;
  4192. this.on(t, "mousemove", this.throttledHandleMouseMove), this.on(t, "touchmove", this
  4193. .throttledHandleMouseMove), this.on(t, "mouseup", this.handleMouseUp), this.on(t, "touchend", this
  4194. .handleMouseUp)
  4195. }, t.prototype.handleMouseUp = function(e) {
  4196. var t = this.el_.ownerDocument;
  4197. this.off(t, "mousemove", this.throttledHandleMouseMove), this.off(t, "touchmove", this
  4198. .throttledHandleMouseMove), this.off(t, "mouseup", this.handleMouseUp), this.off(t, "touchend", this
  4199. .handleMouseUp)
  4200. }, t.prototype.handleMouseMove = function(e) {
  4201. this.volumeBar.handleMouseMove(e)
  4202. }, t
  4203. }(Ye);
  4204. cn.prototype.options_ = {
  4205. children: ["volumeBar"]
  4206. }, Ye.registerComponent("VolumeControl", cn);
  4207. var hn = function(e, t) {
  4208. t.tech_ && !t.tech_.featuresMuteControl && e.addClass("vjs-hidden"), e.on(t, "loadstart", function() {
  4209. t.tech_.featuresMuteControl ? e.removeClass("vjs-hidden") : e.addClass("vjs-hidden")
  4210. })
  4211. },
  4212. fn = function(e) {
  4213. function t(i, r) {
  4214. y(this, t);
  4215. var n = b(this, e.call(this, i, r));
  4216. return hn(n, i), n.on(i, ["loadstart", "volumechange"], n.update), n
  4217. }
  4218. return _(t, e), t.prototype.buildCSSClass = function() {
  4219. return "vjs-mute-control " + e.prototype.buildCSSClass.call(this)
  4220. }, t.prototype.handleClick = function(e) {
  4221. var t = this.player_.volume(),
  4222. i = this.player_.lastVolume_();
  4223. if (0 === t) {
  4224. var r = i < .1 ? .1 : i;
  4225. this.player_.volume(r), this.player_.muted(!1)
  4226. } else this.player_.muted(!this.player_.muted())
  4227. }, t.prototype.update = function(e) {
  4228. this.updateIcon_(), this.updateControlText_()
  4229. }, t.prototype.updateIcon_ = function() {
  4230. var e = this.player_.volume(),
  4231. t = 3;
  4232. rt && this.player_.muted(this.player_.tech_.el_.muted), 0 === e || this.player_.muted() ? t = 0 : e < .33 ?
  4233. t = 1 : e < .67 && (t = 2);
  4234. for (var i = 0; i < 4; i++) H(this.el_, "vjs-vol-" + i);
  4235. j(this.el_, "vjs-vol-" + t)
  4236. }, t.prototype.updateControlText_ = function() {
  4237. var e = this.player_.muted() || 0 === this.player_.volume() ? "Unmute" : "Mute";
  4238. this.controlText() !== e && this.controlText(e)
  4239. }, t
  4240. }(jr);
  4241. fn.prototype.controlText_ = "Mute", Ye.registerComponent("MuteToggle", fn);
  4242. var pn = function(e) {
  4243. function t(i) {
  4244. var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  4245. y(this, t), void 0 !== r.inline ? r.inline = r.inline : r.inline = !0, (void 0 === r.volumeControl || R(r
  4246. .volumeControl)) && (r.volumeControl = r.volumeControl || {}, r.volumeControl.vertical = !r.inline);
  4247. var n = b(this, e.call(this, i, r));
  4248. return n.on(i, ["loadstart"], n.volumePanelState_), n.on(n.volumeControl, ["slideractive"], n.sliderActive_),
  4249. n.on(n.volumeControl, ["sliderinactive"], n.sliderInactive_), n
  4250. }
  4251. return _(t, e), t.prototype.sliderActive_ = function() {
  4252. this.addClass("vjs-slider-active")
  4253. }, t.prototype.sliderInactive_ = function() {
  4254. this.removeClass("vjs-slider-active")
  4255. }, t.prototype.volumePanelState_ = function() {
  4256. this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden") && this.addClass(
  4257. "vjs-hidden"), this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden") &&
  4258. this.addClass("vjs-mute-toggle-only")
  4259. }, t.prototype.createEl = function() {
  4260. var t = "vjs-volume-panel-horizontal";
  4261. return this.options_.inline || (t = "vjs-volume-panel-vertical"), e.prototype.createEl.call(this, "div", {
  4262. className: "vjs-volume-panel vjs-control " + t
  4263. })
  4264. }, t
  4265. }(Ye);
  4266. pn.prototype.options_ = {
  4267. children: ["muteToggle", "volumeControl"]
  4268. }, Ye.registerComponent("VolumePanel", pn);
  4269. var mn = function(e) {
  4270. function t(i, r) {
  4271. y(this, t);
  4272. var n = b(this, e.call(this, i, r));
  4273. return r && (n.menuButton_ = r.menuButton), n.focusedChild_ = -1, n.on("keydown", n.handleKeyPress), n
  4274. }
  4275. return _(t, e), t.prototype.addItem = function(e) {
  4276. this.addChild(e), e.on("click", De(this, function(t) {
  4277. this.menuButton_ && (this.menuButton_.unpressButton(), "CaptionSettingsMenuItem" !== e.name() &&
  4278. this.menuButton_.focus())
  4279. }))
  4280. }, t.prototype.createEl = function() {
  4281. var t = this.options_.contentElType || "ul";
  4282. this.contentEl_ = U(t, {
  4283. className: "vjs-menu-content"
  4284. }), this.contentEl_.setAttribute("role", "menu");
  4285. var i = e.prototype.createEl.call(this, "div", {
  4286. append: this.contentEl_,
  4287. className: "vjs-menu"
  4288. });
  4289. return i.appendChild(this.contentEl_), be(i, "click", function(e) {
  4290. e.preventDefault(), e.stopImmediatePropagation()
  4291. }), i
  4292. }, t.prototype.dispose = function() {
  4293. this.contentEl_ = null, e.prototype.dispose.call(this)
  4294. }, t.prototype.handleKeyPress = function(e) {
  4295. 37 === e.which || 40 === e.which ? (e.preventDefault(), this.stepForward()) : 38 !== e.which && 39 !== e
  4296. .which || (e.preventDefault(), this.stepBack())
  4297. }, t.prototype.stepForward = function() {
  4298. var e = 0;
  4299. void 0 !== this.focusedChild_ && (e = this.focusedChild_ + 1), this.focus(e)
  4300. }, t.prototype.stepBack = function() {
  4301. var e = 0;
  4302. void 0 !== this.focusedChild_ && (e = this.focusedChild_ - 1), this.focus(e)
  4303. }, t.prototype.focus = function() {
  4304. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,
  4305. t = this.children().slice();
  4306. t.length && t[0].className && /vjs-menu-title/.test(t[0].className) && t.shift(), t.length > 0 && (e < 0 ?
  4307. e = 0 : e >= t.length && (e = t.length - 1), this.focusedChild_ = e, t[e].el_.focus())
  4308. }, t
  4309. }(Ye);
  4310. Ye.registerComponent("Menu", mn);
  4311. var gn = function(e) {
  4312. function t(i) {
  4313. var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  4314. y(this, t);
  4315. var n = b(this, e.call(this, i, r));
  4316. n.menuButton_ = new jr(i, r), n.menuButton_.controlText(n.controlText_), n.menuButton_.el_.setAttribute(
  4317. "aria-haspopup", "true");
  4318. var a = jr.prototype.buildCSSClass();
  4319. return n.menuButton_.el_.className = n.buildCSSClass() + " " + a, n.menuButton_.removeClass("vjs-control"), n
  4320. .addChild(n.menuButton_), n.update(), n.enabled_ = !0, n.on(n.menuButton_, "tap", n.handleClick), n.on(n
  4321. .menuButton_, "click", n.handleClick), n.on(n.menuButton_, "focus", n.handleFocus), n.on(n.menuButton_,
  4322. "blur", n.handleBlur), n.on("keydown", n.handleSubmenuKeyPress), n
  4323. }
  4324. return _(t, e), t.prototype.update = function() {
  4325. var e = this.createMenu();
  4326. this.menu && (this.menu.dispose(), this.removeChild(this.menu)), this.menu = e, this.addChild(e), this
  4327. .buttonPressed_ = !1, this.menuButton_.el_.setAttribute("aria-expanded", "false"), this.items && this
  4328. .items.length <= this.hideThreshold_ ? this.hide() : this.show()
  4329. }, t.prototype.createMenu = function() {
  4330. var e = new mn(this.player_, {
  4331. menuButton: this
  4332. });
  4333. if (this.hideThreshold_ = 0, this.options_.title) {
  4334. var t = U("li", {
  4335. className: "vjs-menu-title",
  4336. innerHTML: ze(this.options_.title),
  4337. tabIndex: -1
  4338. });
  4339. this.hideThreshold_ += 1, e.children_.unshift(t), B(t, e.contentEl())
  4340. }
  4341. if (this.items = this.createItems(), this.items)
  4342. for (var i = 0; i < this.items.length; i++) e.addItem(this.items[i]);
  4343. return e
  4344. }, t.prototype.createItems = function() {}, t.prototype.createEl = function() {
  4345. return e.prototype.createEl.call(this, "div", {
  4346. className: this.buildWrapperCSSClass()
  4347. }, {})
  4348. }, t.prototype.buildWrapperCSSClass = function() {
  4349. var t = "vjs-menu-button";
  4350. return !0 === this.options_.inline ? t += "-inline" : t += "-popup", "vjs-menu-button " + t + " " + jr
  4351. .prototype.buildCSSClass() + " " + e.prototype.buildCSSClass.call(this)
  4352. }, t.prototype.buildCSSClass = function() {
  4353. var t = "vjs-menu-button";
  4354. return !0 === this.options_.inline ? t += "-inline" : t += "-popup", "vjs-menu-button " + t + " " + e
  4355. .prototype.buildCSSClass.call(this)
  4356. }, t.prototype.controlText = function(e) {
  4357. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.menuButton_.el();
  4358. return this.menuButton_.controlText(e, t)
  4359. }, t.prototype.handleClick = function(e) {
  4360. this.one(this.menu.contentEl(), "mouseleave", De(this, function(e) {
  4361. this.unpressButton(), this.el_.blur()
  4362. })), this.buttonPressed_ ? this.unpressButton() : this.pressButton()
  4363. }, t.prototype.focus = function() {
  4364. this.menuButton_.focus()
  4365. }, t.prototype.blur = function() {
  4366. this.menuButton_.blur()
  4367. }, t.prototype.handleFocus = function() {
  4368. be(l, "keydown", De(this, this.handleKeyPress))
  4369. }, t.prototype.handleBlur = function() {
  4370. we(l, "keydown", De(this, this.handleKeyPress))
  4371. }, t.prototype.handleKeyPress = function(e) {
  4372. 27 === e.which || 9 === e.which ? (this.buttonPressed_ && this.unpressButton(), 9 !== e.which && (e
  4373. .preventDefault(), this.menuButton_.el_.focus())) : 38 !== e.which && 40 !== e.which || this
  4374. .buttonPressed_ || (this.pressButton(), e.preventDefault())
  4375. }, t.prototype.handleSubmenuKeyPress = function(e) {
  4376. 27 !== e.which && 9 !== e.which || (this.buttonPressed_ && this.unpressButton(), 9 !== e.which && (e
  4377. .preventDefault(), this.menuButton_.el_.focus()))
  4378. }, t.prototype.pressButton = function() {
  4379. if (this.enabled_) {
  4380. if (this.buttonPressed_ = !0, this.menu.lockShowing(), this.menuButton_.el_.setAttribute("aria-expanded",
  4381. "true"), rt && x()) return;
  4382. this.menu.focus()
  4383. }
  4384. }, t.prototype.unpressButton = function() {
  4385. this.enabled_ && (this.buttonPressed_ = !1, this.menu.unlockShowing(), this.menuButton_.el_.setAttribute(
  4386. "aria-expanded", "false"))
  4387. }, t.prototype.disable = function() {
  4388. this.unpressButton(), this.enabled_ = !1, this.addClass("vjs-disabled"), this.menuButton_.disable()
  4389. }, t.prototype.enable = function() {
  4390. this.enabled_ = !0, this.removeClass("vjs-disabled"), this.menuButton_.enable()
  4391. }, t
  4392. }(Ye);
  4393. Ye.registerComponent("MenuButton", gn);
  4394. var vn = function(e) {
  4395. function t(i, r) {
  4396. y(this, t);
  4397. var n = r.tracks,
  4398. a = b(this, e.call(this, i, r));
  4399. if (a.items.length <= 1 && a.hide(), !n) return b(a);
  4400. var s = De(a, a.update);
  4401. return n.addEventListener("removetrack", s), n.addEventListener("addtrack", s), a.player_.on("ready", s), a
  4402. .player_.on("dispose", function() {
  4403. n.removeEventListener("removetrack", s), n.removeEventListener("addtrack", s)
  4404. }), a
  4405. }
  4406. return _(t, e), t
  4407. }(gn);
  4408. Ye.registerComponent("TrackButton", vn);
  4409. var yn = function(e) {
  4410. function t(i, r) {
  4411. y(this, t);
  4412. var n = b(this, e.call(this, i, r));
  4413. return n.selectable = r.selectable, n.isSelected_ = r.selected || !1, n.multiSelectable = r.multiSelectable, n
  4414. .selected(n.isSelected_), n.selectable ? n.multiSelectable ? n.el_.setAttribute("role",
  4415. "menuitemcheckbox") : n.el_.setAttribute("role", "menuitemradio") : n.el_.setAttribute("role", "menuitem"),
  4416. n
  4417. }
  4418. return _(t, e), t.prototype.createEl = function(t, i, r) {
  4419. return this.nonIconControl = !0, e.prototype.createEl.call(this, "li", A({
  4420. className: "vjs-menu-item",
  4421. innerHTML: '<span class="vjs-menu-item-text">' + this.localize(this.options_.label) + "</span>",
  4422. tabIndex: -1
  4423. }, i), r)
  4424. }, t.prototype.handleClick = function(e) {
  4425. this.selected(!0)
  4426. }, t.prototype.selected = function(e) {
  4427. this.selectable && (e ? (this.addClass("vjs-selected"), this.el_.setAttribute("aria-checked", "true"), this
  4428. .controlText(", selected"), this.isSelected_ = !0) : (this.removeClass("vjs-selected"), this.el_
  4429. .setAttribute("aria-checked", "false"), this.controlText(""), this.isSelected_ = !1))
  4430. }, t
  4431. }(Lr);
  4432. Ye.registerComponent("MenuItem", yn);
  4433. var _n = function(e) {
  4434. function t(i, r) {
  4435. y(this, t);
  4436. var a = r.track,
  4437. s = i.textTracks();
  4438. r.label = a.label || a.language || "Unknown", r.selected = "showing" === a.mode;
  4439. var o = b(this, e.call(this, i, r));
  4440. o.track = a;
  4441. var u = function() {
  4442. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  4443. o.handleTracksChange.apply(o, t)
  4444. },
  4445. d = function() {
  4446. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  4447. o.handleSelectedLanguageChange.apply(o, t)
  4448. };
  4449. if (i.on(["loadstart", "texttrackchange"], u), s.addEventListener("change", u), s.addEventListener(
  4450. "selectedlanguagechange", d), o.on("dispose", function() {
  4451. i.off(["loadstart", "texttrackchange"], u), s.removeEventListener("change", u), s.removeEventListener(
  4452. "selectedlanguagechange", d)
  4453. }), void 0 === s.onchange) {
  4454. var c = void 0;
  4455. o.on(["tap", "click"], function() {
  4456. if ("object" !== v(n.Event)) try {
  4457. c = new n.Event("change")
  4458. } catch (e) {}
  4459. c || (c = l.createEvent("Event")).initEvent("change", !0, !0), s.dispatchEvent(c)
  4460. })
  4461. }
  4462. return o.handleTracksChange(), o
  4463. }
  4464. return _(t, e), t.prototype.handleClick = function(t) {
  4465. var i = this.track.kind,
  4466. r = this.track.kinds,
  4467. n = this.player_.textTracks();
  4468. if (r || (r = [i]), e.prototype.handleClick.call(this, t), n)
  4469. for (var a = 0; a < n.length; a++) {
  4470. var s = n[a];
  4471. s === this.track && r.indexOf(s.kind) > -1 ? "showing" !== s.mode && (s.mode = "showing") :
  4472. "disabled" !== s.mode && (s.mode = "disabled")
  4473. }
  4474. }, t.prototype.handleTracksChange = function(e) {
  4475. var t = "showing" === this.track.mode;
  4476. t !== this.isSelected_ && this.selected(t)
  4477. }, t.prototype.handleSelectedLanguageChange = function(e) {
  4478. if ("showing" === this.track.mode) {
  4479. var t = this.player_.cache_.selectedLanguage;
  4480. if (t && t.enabled && t.language === this.track.language && t.kind !== this.track.kind) return;
  4481. this.player_.cache_.selectedLanguage = {
  4482. enabled: !0,
  4483. language: this.track.language,
  4484. kind: this.track.kind
  4485. }
  4486. }
  4487. }, t.prototype.dispose = function() {
  4488. this.track = null, e.prototype.dispose.call(this)
  4489. }, t
  4490. }(yn);
  4491. Ye.registerComponent("TextTrackMenuItem", _n);
  4492. var bn = function(e) {
  4493. function t(i, r) {
  4494. return y(this, t), r.track = {
  4495. player: i,
  4496. kind: r.kind,
  4497. kinds: r.kinds,
  4498. default: !1,
  4499. mode: "disabled"
  4500. }, r.kinds || (r.kinds = [r.kind]), r.label ? r.track.label = r.label : r.track.label = r.kinds.join(
  4501. " and ") + " off", r.selectable = !0, r.multiSelectable = !1, b(this, e.call(this, i, r))
  4502. }
  4503. return _(t, e), t.prototype.handleTracksChange = function(e) {
  4504. for (var t = this.player().textTracks(), i = !0, r = 0, n = t.length; r < n; r++) {
  4505. var a = t[r];
  4506. if (this.options_.kinds.indexOf(a.kind) > -1 && "showing" === a.mode) {
  4507. i = !1;
  4508. break
  4509. }
  4510. }
  4511. i !== this.isSelected_ && this.selected(i)
  4512. }, t.prototype.handleSelectedLanguageChange = function(e) {
  4513. for (var t = this.player().textTracks(), i = !0, r = 0, n = t.length; r < n; r++) {
  4514. var a = t[r];
  4515. if (["captions", "descriptions", "subtitles"].indexOf(a.kind) > -1 && "showing" === a.mode) {
  4516. i = !1;
  4517. break
  4518. }
  4519. }
  4520. i && (this.player_.cache_.selectedLanguage = {
  4521. enabled: !1
  4522. })
  4523. }, t
  4524. }(_n);
  4525. Ye.registerComponent("OffTextTrackMenuItem", bn);
  4526. var wn = function(e) {
  4527. function t(i) {
  4528. var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  4529. return y(this, t), r.tracks = i.textTracks(), b(this, e.call(this, i, r))
  4530. }
  4531. return _(t, e), t.prototype.createItems = function() {
  4532. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
  4533. t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : _n,
  4534. i = void 0;
  4535. this.label_ && (i = this.label_ + " off"), e.push(new bn(this.player_, {
  4536. kinds: this.kinds_,
  4537. kind: this.kind_,
  4538. label: i
  4539. })), this.hideThreshold_ += 1;
  4540. var r = this.player_.textTracks();
  4541. Array.isArray(this.kinds_) || (this.kinds_ = [this.kind_]);
  4542. for (var n = 0; n < r.length; n++) {
  4543. var a = r[n];
  4544. if (this.kinds_.indexOf(a.kind) > -1) {
  4545. var s = new t(this.player_, {
  4546. track: a,
  4547. selectable: !0,
  4548. multiSelectable: !1
  4549. });
  4550. s.addClass("vjs-" + a.kind + "-menu-item"), e.push(s)
  4551. }
  4552. }
  4553. return e
  4554. }, t
  4555. }(vn);
  4556. Ye.registerComponent("TextTrackButton", wn);
  4557. var En = function(e) {
  4558. function t(i, r) {
  4559. y(this, t);
  4560. var n = r.track,
  4561. a = r.cue,
  4562. s = i.currentTime();
  4563. r.selectable = !0, r.multiSelectable = !1, r.label = a.text, r.selected = a.startTime <= s && s < a.endTime;
  4564. var o = b(this, e.call(this, i, r));
  4565. return o.track = n, o.cue = a, n.addEventListener("cuechange", De(o, o.update)), o
  4566. }
  4567. return _(t, e), t.prototype.handleClick = function(t) {
  4568. e.prototype.handleClick.call(this), this.player_.currentTime(this.cue.startTime), this.update(this.cue
  4569. .startTime)
  4570. }, t.prototype.update = function(e) {
  4571. var t = this.cue,
  4572. i = this.player_.currentTime();
  4573. this.selected(t.startTime <= i && i < t.endTime)
  4574. }, t
  4575. }(yn);
  4576. Ye.registerComponent("ChaptersTrackMenuItem", En);
  4577. var Tn = function(e) {
  4578. function t(i, r, n) {
  4579. return y(this, t), b(this, e.call(this, i, r, n))
  4580. }
  4581. return _(t, e), t.prototype.buildCSSClass = function() {
  4582. return "vjs-chapters-button " + e.prototype.buildCSSClass.call(this)
  4583. }, t.prototype.buildWrapperCSSClass = function() {
  4584. return "vjs-chapters-button " + e.prototype.buildWrapperCSSClass.call(this)
  4585. }, t.prototype.update = function(t) {
  4586. this.track_ && (!t || "addtrack" !== t.type && "removetrack" !== t.type) || this.setTrack(this
  4587. .findChaptersTrack()), e.prototype.update.call(this)
  4588. }, t.prototype.setTrack = function(e) {
  4589. if (this.track_ !== e) {
  4590. if (this.updateHandler_ || (this.updateHandler_ = this.update.bind(this)), this.track_) {
  4591. var t = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  4592. t && t.removeEventListener("load", this.updateHandler_), this.track_ = null
  4593. }
  4594. if (this.track_ = e, this.track_) {
  4595. this.track_.mode = "hidden";
  4596. var i = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  4597. i && i.addEventListener("load", this.updateHandler_)
  4598. }
  4599. }
  4600. }, t.prototype.findChaptersTrack = function() {
  4601. for (var e = this.player_.textTracks() || [], t = e.length - 1; t >= 0; t--) {
  4602. var i = e[t];
  4603. if (i.kind === this.kind_) return i
  4604. }
  4605. }, t.prototype.getMenuCaption = function() {
  4606. return this.track_ && this.track_.label ? this.track_.label : this.localize(ze(this.kind_))
  4607. }, t.prototype.createMenu = function() {
  4608. return this.options_.title = this.getMenuCaption(), e.prototype.createMenu.call(this)
  4609. }, t.prototype.createItems = function() {
  4610. var e = [];
  4611. if (!this.track_) return e;
  4612. var t = this.track_.cues;
  4613. if (!t) return e;
  4614. for (var i = 0, r = t.length; i < r; i++) {
  4615. var n = t[i],
  4616. a = new En(this.player_, {
  4617. track: this.track_,
  4618. cue: n
  4619. });
  4620. e.push(a)
  4621. }
  4622. return e
  4623. }, t
  4624. }(wn);
  4625. Tn.prototype.kind_ = "chapters", Tn.prototype.controlText_ = "Chapters", Ye.registerComponent("ChaptersButton", Tn);
  4626. var Sn = function(e) {
  4627. function t(i, r, n) {
  4628. y(this, t);
  4629. var a = b(this, e.call(this, i, r, n)),
  4630. s = i.textTracks(),
  4631. o = De(a, a.handleTracksChange);
  4632. return s.addEventListener("change", o), a.on("dispose", function() {
  4633. s.removeEventListener("change", o)
  4634. }), a
  4635. }
  4636. return _(t, e), t.prototype.handleTracksChange = function(e) {
  4637. for (var t = this.player().textTracks(), i = !1, r = 0, n = t.length; r < n; r++) {
  4638. var a = t[r];
  4639. if (a.kind !== this.kind_ && "showing" === a.mode) {
  4640. i = !0;
  4641. break
  4642. }
  4643. }
  4644. i ? this.disable() : this.enable()
  4645. }, t.prototype.buildCSSClass = function() {
  4646. return "vjs-descriptions-button " + e.prototype.buildCSSClass.call(this)
  4647. }, t.prototype.buildWrapperCSSClass = function() {
  4648. return "vjs-descriptions-button " + e.prototype.buildWrapperCSSClass.call(this)
  4649. }, t
  4650. }(wn);
  4651. Sn.prototype.kind_ = "descriptions", Sn.prototype.controlText_ = "Descriptions", Ye.registerComponent(
  4652. "DescriptionsButton", Sn);
  4653. var An = function(e) {
  4654. function t(i, r, n) {
  4655. return y(this, t), b(this, e.call(this, i, r, n))
  4656. }
  4657. return _(t, e), t.prototype.buildCSSClass = function() {
  4658. return "vjs-subtitles-button " + e.prototype.buildCSSClass.call(this)
  4659. }, t.prototype.buildWrapperCSSClass = function() {
  4660. return "vjs-subtitles-button " + e.prototype.buildWrapperCSSClass.call(this)
  4661. }, t
  4662. }(wn);
  4663. An.prototype.kind_ = "subtitles", An.prototype.controlText_ = "Subtitles", Ye.registerComponent("SubtitlesButton",
  4664. An);
  4665. var kn = function(e) {
  4666. function t(i, r) {
  4667. y(this, t), r.track = {
  4668. player: i,
  4669. kind: r.kind,
  4670. label: r.kind + " settings",
  4671. selectable: !1,
  4672. default: !1,
  4673. mode: "disabled"
  4674. }, r.selectable = !1, r.name = "CaptionSettingsMenuItem";
  4675. var n = b(this, e.call(this, i, r));
  4676. return n.addClass("vjs-texttrack-settings"), n.controlText(", opens " + r.kind + " settings dialog"), n
  4677. }
  4678. return _(t, e), t.prototype.handleClick = function(e) {
  4679. this.player().getChild("textTrackSettings").open()
  4680. }, t
  4681. }(_n);
  4682. Ye.registerComponent("CaptionSettingsMenuItem", kn);
  4683. var Rn = function(e) {
  4684. function t(i, r, n) {
  4685. return y(this, t), b(this, e.call(this, i, r, n))
  4686. }
  4687. return _(t, e), t.prototype.buildCSSClass = function() {
  4688. return "vjs-captions-button " + e.prototype.buildCSSClass.call(this)
  4689. }, t.prototype.buildWrapperCSSClass = function() {
  4690. return "vjs-captions-button " + e.prototype.buildWrapperCSSClass.call(this)
  4691. }, t.prototype.createItems = function() {
  4692. var t = [];
  4693. return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild(
  4694. "textTrackSettings") || (t.push(new kn(this.player_, {
  4695. kind: this.kind_
  4696. })), this.hideThreshold_ += 1), e.prototype.createItems.call(this, t)
  4697. }, t
  4698. }(wn);
  4699. Rn.prototype.kind_ = "captions", Rn.prototype.controlText_ = "Captions", Ye.registerComponent("CaptionsButton", Rn);
  4700. var Mn = function(e) {
  4701. function t() {
  4702. return y(this, t), b(this, e.apply(this, arguments))
  4703. }
  4704. return _(t, e), t.prototype.createEl = function(t, i, r) {
  4705. var n = '<span class="vjs-menu-item-text">' + this.localize(this.options_.label);
  4706. return "captions" === this.options_.track.kind && (n +=
  4707. '\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> ' +
  4708. this.localize("Captions") + "</span>\n "), n += "</span>", e.prototype.createEl.call(this, t, A({
  4709. innerHTML: n
  4710. }, i), r)
  4711. }, t
  4712. }(_n);
  4713. Ye.registerComponent("SubsCapsMenuItem", Mn);
  4714. var On = function(e) {
  4715. function t(i) {
  4716. var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  4717. y(this, t);
  4718. var n = b(this, e.call(this, i, r));
  4719. return n.label_ = "subtitles", ["en", "en-us", "en-ca", "fr-ca"].indexOf(n.player_.language_) > -1 && (n
  4720. .label_ = "captions"), n.menuButton_.controlText(ze(n.label_)), n
  4721. }
  4722. return _(t, e), t.prototype.buildCSSClass = function() {
  4723. return "vjs-subs-caps-button " + e.prototype.buildCSSClass.call(this)
  4724. }, t.prototype.buildWrapperCSSClass = function() {
  4725. return "vjs-subs-caps-button " + e.prototype.buildWrapperCSSClass.call(this)
  4726. }, t.prototype.createItems = function() {
  4727. var t = [];
  4728. return this.player().tech_ && this.player().tech_.featuresNativeTextTracks || !this.player().getChild(
  4729. "textTrackSettings") || (t.push(new kn(this.player_, {
  4730. kind: this.label_
  4731. })), this.hideThreshold_ += 1), t = e.prototype.createItems.call(this, t, Mn)
  4732. }, t
  4733. }(wn);
  4734. On.prototype.kinds_ = ["captions", "subtitles"], On.prototype.controlText_ = "Subtitles", Ye.registerComponent(
  4735. "SubsCapsButton", On);
  4736. var Cn = function(e) {
  4737. function t(i, r) {
  4738. y(this, t);
  4739. var n = r.track,
  4740. a = i.audioTracks();
  4741. r.label = n.label || n.language || "Unknown", r.selected = n.enabled;
  4742. var s = b(this, e.call(this, i, r));
  4743. s.track = n, s.addClass("vjs-" + n.kind + "-menu-item");
  4744. var o = function() {
  4745. for (var e = arguments.length, t = Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  4746. s.handleTracksChange.apply(s, t)
  4747. };
  4748. return a.addEventListener("change", o), s.on("dispose", function() {
  4749. a.removeEventListener("change", o)
  4750. }), s
  4751. }
  4752. return _(t, e), t.prototype.createEl = function(t, i, r) {
  4753. var n = '<span class="vjs-menu-item-text">' + this.localize(this.options_.label);
  4754. return "main-desc" === this.options_.track.kind && (n +=
  4755. '\n <span aria-hidden="true" class="vjs-icon-placeholder"></span>\n <span class="vjs-control-text"> ' +
  4756. this.localize("Descriptions") + "</span>\n "), n += "</span>", e.prototype.createEl.call(this, t,
  4757. A({
  4758. innerHTML: n
  4759. }, i), r)
  4760. }, t.prototype.handleClick = function(t) {
  4761. var i = this.player_.audioTracks();
  4762. e.prototype.handleClick.call(this, t);
  4763. for (var r = 0; r < i.length; r++) {
  4764. var n = i[r];
  4765. n.enabled = n === this.track
  4766. }
  4767. }, t.prototype.handleTracksChange = function(e) {
  4768. this.selected(this.track.enabled)
  4769. }, t
  4770. }(yn);
  4771. Ye.registerComponent("AudioTrackMenuItem", Cn);
  4772. var Dn = function(e) {
  4773. function t(i) {
  4774. var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  4775. return y(this, t), r.tracks = i.audioTracks(), b(this, e.call(this, i, r))
  4776. }
  4777. return _(t, e), t.prototype.buildCSSClass = function() {
  4778. return "vjs-audio-button " + e.prototype.buildCSSClass.call(this)
  4779. }, t.prototype.buildWrapperCSSClass = function() {
  4780. return "vjs-audio-button " + e.prototype.buildWrapperCSSClass.call(this)
  4781. }, t.prototype.createItems = function() {
  4782. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
  4783. this.hideThreshold_ = 1;
  4784. for (var t = this.player_.audioTracks(), i = 0; i < t.length; i++) {
  4785. var r = t[i];
  4786. e.push(new Cn(this.player_, {
  4787. track: r,
  4788. selectable: !0,
  4789. multiSelectable: !1
  4790. }))
  4791. }
  4792. return e
  4793. }, t
  4794. }(vn);
  4795. Dn.prototype.controlText_ = "Audio Track", Ye.registerComponent("AudioTrackButton", Dn);
  4796. var In = function(e) {
  4797. function t(i, r) {
  4798. y(this, t);
  4799. var n = r.rate,
  4800. a = parseFloat(n, 10);
  4801. r.label = n, r.selected = 1 === a, r.selectable = !0, r.multiSelectable = !1;
  4802. var s = b(this, e.call(this, i, r));
  4803. return s.label = n, s.rate = a, s.on(i, "ratechange", s.update), s
  4804. }
  4805. return _(t, e), t.prototype.handleClick = function(t) {
  4806. e.prototype.handleClick.call(this), this.player().playbackRate(this.rate)
  4807. }, t.prototype.update = function(e) {
  4808. this.selected(this.player().playbackRate() === this.rate)
  4809. }, t
  4810. }(yn);
  4811. In.prototype.contentElType = "button", Ye.registerComponent("PlaybackRateMenuItem", In);
  4812. var Ln = function(e) {
  4813. function t(i, r) {
  4814. y(this, t);
  4815. var n = b(this, e.call(this, i, r));
  4816. return n.updateVisibility(), n.updateLabel(), n.on(i, "loadstart", n.updateVisibility), n.on(i, "ratechange",
  4817. n.updateLabel), n
  4818. }
  4819. return _(t, e), t.prototype.createEl = function() {
  4820. var t = e.prototype.createEl.call(this);
  4821. return this.labelEl_ = U("div", {
  4822. className: "vjs-playback-rate-value",
  4823. innerHTML: "1x"
  4824. }), t.appendChild(this.labelEl_), t
  4825. }, t.prototype.dispose = function() {
  4826. this.labelEl_ = null, e.prototype.dispose.call(this)
  4827. }, t.prototype.buildCSSClass = function() {
  4828. return "vjs-playback-rate " + e.prototype.buildCSSClass.call(this)
  4829. }, t.prototype.buildWrapperCSSClass = function() {
  4830. return "vjs-playback-rate " + e.prototype.buildWrapperCSSClass.call(this)
  4831. }, t.prototype.createMenu = function() {
  4832. var e = new mn(this.player()),
  4833. t = this.playbackRates();
  4834. if (t)
  4835. for (var i = t.length - 1; i >= 0; i--) e.addChild(new In(this.player(), {
  4836. rate: t[i] + "x"
  4837. }));
  4838. return e
  4839. }, t.prototype.updateARIAAttributes = function() {
  4840. this.el().setAttribute("aria-valuenow", this.player().playbackRate())
  4841. }, t.prototype.handleClick = function(e) {
  4842. for (var t = this.player().playbackRate(), i = this.playbackRates(), r = i[0], n = 0; n < i.length; n++)
  4843. if (i[n] > t) {
  4844. r = i[n];
  4845. break
  4846. } this.player().playbackRate(r)
  4847. }, t.prototype.playbackRates = function() {
  4848. return this.options_.playbackRates || this.options_.playerOptions && this.options_.playerOptions
  4849. .playbackRates
  4850. }, t.prototype.playbackRateSupported = function() {
  4851. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this
  4852. .playbackRates().length > 0
  4853. }, t.prototype.updateVisibility = function(e) {
  4854. this.playbackRateSupported() ? this.removeClass("vjs-hidden") : this.addClass("vjs-hidden")
  4855. }, t.prototype.updateLabel = function(e) {
  4856. this.playbackRateSupported() && (this.labelEl_.innerHTML = this.player().playbackRate() + "x")
  4857. }, t
  4858. }(gn);
  4859. Ln.prototype.controlText_ = "Playback Rate", Ye.registerComponent("PlaybackRateMenuButton", Ln);
  4860. var xn = function(e) {
  4861. function t() {
  4862. return y(this, t), b(this, e.apply(this, arguments))
  4863. }
  4864. return _(t, e), t.prototype.buildCSSClass = function() {
  4865. return "vjs-spacer " + e.prototype.buildCSSClass.call(this)
  4866. }, t.prototype.createEl = function() {
  4867. return e.prototype.createEl.call(this, "div", {
  4868. className: this.buildCSSClass()
  4869. })
  4870. }, t
  4871. }(Ye);
  4872. Ye.registerComponent("Spacer", xn);
  4873. var Pn = function(e) {
  4874. function t() {
  4875. return y(this, t), b(this, e.apply(this, arguments))
  4876. }
  4877. return _(t, e), t.prototype.buildCSSClass = function() {
  4878. return "vjs-custom-control-spacer " + e.prototype.buildCSSClass.call(this)
  4879. }, t.prototype.createEl = function() {
  4880. var t = e.prototype.createEl.call(this, {
  4881. className: this.buildCSSClass()
  4882. });
  4883. return t.innerHTML = " ", t
  4884. }, t
  4885. }(xn);
  4886. Ye.registerComponent("CustomControlSpacer", Pn);
  4887. var Un = function(e) {
  4888. function t() {
  4889. return y(this, t), b(this, e.apply(this, arguments))
  4890. }
  4891. return _(t, e), t.prototype.createEl = function() {
  4892. return e.prototype.createEl.call(this, "div", {
  4893. className: "vjs-control-bar",
  4894. dir: "ltr"
  4895. })
  4896. }, t
  4897. }(Ye);
  4898. Un.prototype.options_ = {
  4899. children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay",
  4900. "progressControl", "liveDisplay", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton",
  4901. "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"
  4902. ]
  4903. }, Ye.registerComponent("ControlBar", Un);
  4904. var Nn = function(e) {
  4905. function t(i, r) {
  4906. y(this, t);
  4907. var n = b(this, e.call(this, i, r));
  4908. return n.on(i, "error", n.open), n
  4909. }
  4910. return _(t, e), t.prototype.buildCSSClass = function() {
  4911. return "vjs-error-display " + e.prototype.buildCSSClass.call(this)
  4912. }, t.prototype.content = function() {
  4913. var e = this.player().error();
  4914. return e ? this.localize(e.message) : ""
  4915. }, t
  4916. }(Ut);
  4917. Nn.prototype.options_ = Ke(Ut.prototype.options_, {
  4918. pauseOnOpen: !1,
  4919. fillAlways: !0,
  4920. temporary: !1,
  4921. uncloseable: !0
  4922. }), Ye.registerComponent("ErrorDisplay", Nn);
  4923. var Bn = ["#000", "Black"],
  4924. Fn = ["#00F", "Blue"],
  4925. jn = ["#0FF", "Cyan"],
  4926. Hn = ["#0F0", "Green"],
  4927. Gn = ["#F0F", "Magenta"],
  4928. Vn = ["#F00", "Red"],
  4929. Wn = ["#FFF", "White"],
  4930. qn = ["#FF0", "Yellow"],
  4931. Xn = ["1", "Opaque"],
  4932. zn = ["0.5", "Semi-Transparent"],
  4933. Kn = ["0", "Transparent"],
  4934. Yn = {
  4935. backgroundColor: {
  4936. selector: ".vjs-bg-color > select",
  4937. id: "captions-background-color-%s",
  4938. label: "Color",
  4939. options: [Bn, Wn, Vn, Hn, Fn, qn, Gn, jn]
  4940. },
  4941. backgroundOpacity: {
  4942. selector: ".vjs-bg-opacity > select",
  4943. id: "captions-background-opacity-%s",
  4944. label: "Transparency",
  4945. options: [Xn, zn, Kn]
  4946. },
  4947. color: {
  4948. selector: ".vjs-fg-color > select",
  4949. id: "captions-foreground-color-%s",
  4950. label: "Color",
  4951. options: [Wn, Bn, Vn, Hn, Fn, qn, Gn, jn]
  4952. },
  4953. edgeStyle: {
  4954. selector: ".vjs-edge-style > select",
  4955. id: "%s",
  4956. label: "Text Edge Style",
  4957. options: [
  4958. ["none", "None"],
  4959. ["raised", "Raised"],
  4960. ["depressed", "Depressed"],
  4961. ["uniform", "Uniform"],
  4962. ["dropshadow", "Dropshadow"]
  4963. ]
  4964. },
  4965. fontFamily: {
  4966. selector: ".vjs-font-family > select",
  4967. id: "captions-font-family-%s",
  4968. label: "Font Family",
  4969. options: [
  4970. ["proportionalSansSerif", "Proportional Sans-Serif"],
  4971. ["monospaceSansSerif", "Monospace Sans-Serif"],
  4972. ["proportionalSerif", "Proportional Serif"],
  4973. ["monospaceSerif", "Monospace Serif"],
  4974. ["casual", "Casual"],
  4975. ["script", "Script"],
  4976. ["small-caps", "Small Caps"]
  4977. ]
  4978. },
  4979. fontPercent: {
  4980. selector: ".vjs-font-percent > select",
  4981. id: "captions-font-size-%s",
  4982. label: "Font Size",
  4983. options: [
  4984. ["0.50", "50%"],
  4985. ["0.75", "75%"],
  4986. ["1.00", "100%"],
  4987. ["1.25", "125%"],
  4988. ["1.50", "150%"],
  4989. ["1.75", "175%"],
  4990. ["2.00", "200%"],
  4991. ["3.00", "300%"],
  4992. ["4.00", "400%"]
  4993. ],
  4994. default: 2,
  4995. parser: function(e) {
  4996. return "1.00" === e ? null : Number(e)
  4997. }
  4998. },
  4999. textOpacity: {
  5000. selector: ".vjs-text-opacity > select",
  5001. id: "captions-foreground-opacity-%s",
  5002. label: "Transparency",
  5003. options: [Xn, zn]
  5004. },
  5005. windowColor: {
  5006. selector: ".vjs-window-color > select",
  5007. id: "captions-window-color-%s",
  5008. label: "Color"
  5009. },
  5010. windowOpacity: {
  5011. selector: ".vjs-window-opacity > select",
  5012. id: "captions-window-opacity-%s",
  5013. label: "Transparency",
  5014. options: [Kn, zn, Xn]
  5015. }
  5016. };
  5017. function Qn(e, t) {
  5018. if (t && (e = t(e)), e && "none" !== e) return e
  5019. }
  5020. Yn.windowColor.options = Yn.backgroundColor.options;
  5021. var Jn = function(e) {
  5022. function t(i, r) {
  5023. y(this, t), r.temporary = !1;
  5024. var n = b(this, e.call(this, i, r));
  5025. return n.updateDisplay = De(n, n.updateDisplay), n.fill(), n.hasBeenOpened_ = n.hasBeenFilled_ = !0, n
  5026. .endDialog = U("p", {
  5027. className: "vjs-control-text",
  5028. textContent: n.localize("End of dialog window.")
  5029. }), n.el().appendChild(n.endDialog), n.setDefaults(), void 0 === r.persistTextTrackSettings && (n.options_
  5030. .persistTextTrackSettings = n.options_.playerOptions.persistTextTrackSettings), n.on(n.$(
  5031. ".vjs-done-button"), "click", function() {
  5032. n.saveSettings(), n.close()
  5033. }), n.on(n.$(".vjs-default-button"), "click", function() {
  5034. n.setDefaults(), n.updateDisplay()
  5035. }), S(Yn, function(e) {
  5036. n.on(n.$(e.selector), "change", n.updateDisplay)
  5037. }), n.options_.persistTextTrackSettings && n.restoreSettings(), n
  5038. }
  5039. return _(t, e), t.prototype.dispose = function() {
  5040. this.endDialog = null, e.prototype.dispose.call(this)
  5041. }, t.prototype.createElSelect_ = function(e) {
  5042. var t = this,
  5043. i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "",
  5044. r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "label",
  5045. n = Yn[e],
  5046. a = n.id.replace("%s", this.id_),
  5047. s = [i, a].join(" ").trim();
  5048. return ["<" + r + ' id="' + a + '" class="' + ("label" === r ? "vjs-label" : "") + '">', this.localize(n
  5049. .label), "</" + r + ">", '<select aria-labelledby="' + s + '">'].concat(n.options.map(function(e) {
  5050. var i = a + "-" + e[1].replace(/\W+/g, "");
  5051. return ['<option id="' + i + '" value="' + e[0] + '" ', 'aria-labelledby="' + s + " " + i + '">', t
  5052. .localize(e[1]), "</option>"
  5053. ].join("")
  5054. })).concat("</select>").join("")
  5055. }, t.prototype.createElFgColor_ = function() {
  5056. var e = "captions-text-legend-" + this.id_;
  5057. return ['<fieldset class="vjs-fg-color vjs-track-setting">', '<legend id="' + e + '">', this.localize(
  5058. "Text"), "</legend>", this.createElSelect_("color", e), '<span class="vjs-text-opacity vjs-opacity">',
  5059. this.createElSelect_("textOpacity", e), "</span>", "</fieldset>"
  5060. ].join("")
  5061. }, t.prototype.createElBgColor_ = function() {
  5062. var e = "captions-background-" + this.id_;
  5063. return ['<fieldset class="vjs-bg-color vjs-track-setting">', '<legend id="' + e + '">', this.localize(
  5064. "Background"), "</legend>", this.createElSelect_("backgroundColor", e),
  5065. '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", e), "</span>",
  5066. "</fieldset>"
  5067. ].join("")
  5068. }, t.prototype.createElWinColor_ = function() {
  5069. var e = "captions-window-" + this.id_;
  5070. return ['<fieldset class="vjs-window-color vjs-track-setting">', '<legend id="' + e + '">', this.localize(
  5071. "Window"), "</legend>", this.createElSelect_("windowColor", e),
  5072. '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", e), "</span>",
  5073. "</fieldset>"
  5074. ].join("")
  5075. }, t.prototype.createElColors_ = function() {
  5076. return U("div", {
  5077. className: "vjs-track-settings-colors",
  5078. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  5079. })
  5080. }, t.prototype.createElFont_ = function() {
  5081. return U("div", {
  5082. className: "vjs-track-settings-font",
  5083. innerHTML: ['<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_(
  5084. "fontPercent", "", "legend"), "</fieldset>",
  5085. '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "",
  5086. "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this
  5087. .createElSelect_("fontFamily", "", "legend"), "</fieldset>"
  5088. ].join("")
  5089. })
  5090. }, t.prototype.createElControls_ = function() {
  5091. var e = this.localize("restore all settings to the default values");
  5092. return U("div", {
  5093. className: "vjs-track-settings-controls",
  5094. innerHTML: ['<button class="vjs-default-button" title="' + e + '">', this.localize("Reset"),
  5095. '<span class="vjs-control-text"> ' + e + "</span>", "</button>",
  5096. '<button class="vjs-done-button">' + this.localize("Done") + "</button>"
  5097. ].join("")
  5098. })
  5099. }, t.prototype.content = function() {
  5100. return [this.createElColors_(), this.createElFont_(), this.createElControls_()]
  5101. }, t.prototype.label = function() {
  5102. return this.localize("Caption Settings Dialog")
  5103. }, t.prototype.description = function() {
  5104. return this.localize("Beginning of dialog window. Escape will cancel and close the window.")
  5105. }, t.prototype.buildCSSClass = function() {
  5106. return e.prototype.buildCSSClass.call(this) + " vjs-text-track-settings"
  5107. }, t.prototype.getValues = function() {
  5108. var e = this;
  5109. return function(e, t) {
  5110. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
  5111. return T(e).reduce(function(i, r) {
  5112. return t(i, e[r], r)
  5113. }, i)
  5114. }(Yn, function(t, i, r) {
  5115. var n, a, s = (n = e.$(i.selector), a = i.parser, Qn(n.options[n.options.selectedIndex].value, a));
  5116. return void 0 !== s && (t[r] = s), t
  5117. }, {})
  5118. }, t.prototype.setValues = function(e) {
  5119. var t = this;
  5120. S(Yn, function(i, r) {
  5121. ! function(e, t, i) {
  5122. if (t)
  5123. for (var r = 0; r < e.options.length; r++)
  5124. if (Qn(e.options[r].value, i) === t) {
  5125. e.selectedIndex = r;
  5126. break
  5127. }
  5128. }(t.$(i.selector), e[r], i.parser)
  5129. })
  5130. }, t.prototype.setDefaults = function() {
  5131. var e = this;
  5132. S(Yn, function(t) {
  5133. var i = t.hasOwnProperty("default") ? t.default : 0;
  5134. e.$(t.selector).selectedIndex = i
  5135. })
  5136. }, t.prototype.restoreSettings = function() {
  5137. var e = void 0;
  5138. try {
  5139. e = JSON.parse(n.localStorage.getItem("vjs-text-track-settings"))
  5140. } catch (e) {
  5141. p.warn(e)
  5142. }
  5143. e && this.setValues(e)
  5144. }, t.prototype.saveSettings = function() {
  5145. if (this.options_.persistTextTrackSettings) {
  5146. var e = this.getValues();
  5147. try {
  5148. Object.keys(e).length ? n.localStorage.setItem("vjs-text-track-settings", JSON.stringify(e)) : n
  5149. .localStorage.removeItem("vjs-text-track-settings")
  5150. } catch (e) {
  5151. p.warn(e)
  5152. }
  5153. }
  5154. }, t.prototype.updateDisplay = function() {
  5155. var e = this.player_.getChild("textTrackDisplay");
  5156. e && e.updateDisplay()
  5157. }, t.prototype.conditionalBlur_ = function() {
  5158. this.previouslyActiveEl_ = null, this.off(l, "keydown", this.handleKeyDown);
  5159. var e = this.player_.controlBar,
  5160. t = e && e.subsCapsButton,
  5161. i = e && e.captionsButton;
  5162. t ? t.focus() : i && i.focus()
  5163. }, t
  5164. }(Ut);
  5165. Ye.registerComponent("TextTrackSettings", Jn);
  5166. var Zn = function(e) {
  5167. function t(i, r) {
  5168. y(this, t);
  5169. var a = r.ResizeObserver || n.ResizeObserver;
  5170. null === r.ResizeObserver && (a = !1);
  5171. var s = Ke({
  5172. createEl: !a,
  5173. reportTouchActivity: !1
  5174. }, r),
  5175. o = b(this, e.call(this, i, s));
  5176. return o.ResizeObserver = r.ResizeObserver || n.ResizeObserver, o.loadListener_ = null, o.resizeObserver_ =
  5177. null, o.debouncedHandler_ = Le(function() {
  5178. o.resizeHandler()
  5179. }, 100, !1, o), a ? (o.resizeObserver_ = new o.ResizeObserver(o.debouncedHandler_), o.resizeObserver_
  5180. .observe(i.el())) : (o.loadListener_ = function() {
  5181. o.el_ && o.el_.contentWindow && be(o.el_.contentWindow, "resize", o.debouncedHandler_)
  5182. }, o.one("load", o.loadListener_)), o
  5183. }
  5184. return _(t, e), t.prototype.createEl = function() {
  5185. return e.prototype.createEl.call(this, "iframe", {
  5186. className: "vjs-resize-manager"
  5187. })
  5188. }, t.prototype.resizeHandler = function() {
  5189. this.player_ && this.player_.trigger && this.player_.trigger("playerresize")
  5190. }, t.prototype.dispose = function() {
  5191. this.debouncedHandler_ && this.debouncedHandler_.cancel(), this.resizeObserver_ && (this.player_.el() &&
  5192. this.resizeObserver_.unobserve(this.player_.el()), this.resizeObserver_.disconnect()), this.el_ && this
  5193. .el_.contentWindow && we(this.el_.contentWindow, "resize", this.debouncedHandler_), this.loadListener_ &&
  5194. this.off("load", this.loadListener_), this.ResizeObserver = null, this.resizeObserver = null, this
  5195. .debouncedHandler_ = null, this.loadListener_ = null
  5196. }, t
  5197. }(Ye);
  5198. Ye.registerComponent("ResizeManager", Zn);
  5199. var $n = function(e) {
  5200. var t = e.el();
  5201. if (t.hasAttribute("src")) return e.triggerSourceset(t.src), !0;
  5202. var i = e.$$("source"),
  5203. r = [],
  5204. n = "";
  5205. if (!i.length) return !1;
  5206. for (var a = 0; a < i.length; a++) {
  5207. var s = i[a].src;
  5208. s && -1 === r.indexOf(s) && r.push(s)
  5209. }
  5210. return !!r.length && (1 === r.length && (n = r[0]), e.triggerSourceset(n), !0)
  5211. },
  5212. ea = Object.defineProperty({}, "innerHTML", {
  5213. get: function() {
  5214. return this.cloneNode(!0).innerHTML
  5215. },
  5216. set: function(e) {
  5217. var t = l.createElement(this.nodeName.toLowerCase());
  5218. t.innerHTML = e;
  5219. for (var i = l.createDocumentFragment(); t.childNodes.length;) i.appendChild(t.childNodes[0]);
  5220. return this.innerText = "", n.Element.prototype.appendChild.call(this, i), this.innerHTML
  5221. }
  5222. }),
  5223. ta = function(e, t) {
  5224. for (var i = {}, r = 0; r < e.length && !((i = Object.getOwnPropertyDescriptor(e[r], t)) && i.set && i
  5225. .get); r++);
  5226. return i.enumerable = !0, i.configurable = !0, i
  5227. },
  5228. ia = function(e) {
  5229. var t = e.el();
  5230. if (!t.resetSourceWatch_) {
  5231. var i = {},
  5232. r = function(e) {
  5233. return ta([e.el(), n.HTMLMediaElement.prototype, n.Element.prototype, ea], "innerHTML")
  5234. }(e),
  5235. a = function(i) {
  5236. return function() {
  5237. for (var r = arguments.length, n = Array(r), a = 0; a < r; a++) n[a] = arguments[a];
  5238. var s = i.apply(t, n);
  5239. return $n(e), s
  5240. }
  5241. };
  5242. ["append", "appendChild", "insertAdjacentHTML"].forEach(function(e) {
  5243. t[e] && (i[e] = t[e], t[e] = a(i[e]))
  5244. }), Object.defineProperty(t, "innerHTML", Ke(r, {
  5245. set: a(r.set)
  5246. })), t.resetSourceWatch_ = function() {
  5247. t.resetSourceWatch_ = null, Object.keys(i).forEach(function(e) {
  5248. t[e] = i[e]
  5249. }), Object.defineProperty(t, "innerHTML", r)
  5250. }, e.one("sourceset", t.resetSourceWatch_)
  5251. }
  5252. },
  5253. ra = Object.defineProperty({}, "src", {
  5254. get: function() {
  5255. return this.hasAttribute("src") ? Zt(n.Element.prototype.getAttribute.call(this, "src")) : ""
  5256. },
  5257. set: function(e) {
  5258. return n.Element.prototype.setAttribute.call(this, "src", e), e
  5259. }
  5260. }),
  5261. na = function(e) {
  5262. if (e.featuresSourceset) {
  5263. var t = e.el();
  5264. if (!t.resetSourceset_) {
  5265. var i = function(e) {
  5266. return ta([e.el(), n.HTMLMediaElement.prototype, ra], "src")
  5267. }(e),
  5268. r = t.setAttribute,
  5269. a = t.load;
  5270. Object.defineProperty(t, "src", Ke(i, {
  5271. set: function(r) {
  5272. var n = i.set.call(t, r);
  5273. return e.triggerSourceset(t.src), n
  5274. }
  5275. })), t.setAttribute = function(i, n) {
  5276. var a = r.call(t, i, n);
  5277. return /src/i.test(i) && e.triggerSourceset(t.src), a
  5278. }, t.load = function() {
  5279. var i = a.call(t);
  5280. return $n(e) || (e.triggerSourceset(""), ia(e)), i
  5281. }, t.currentSrc ? e.triggerSourceset(t.currentSrc) : $n(e) || ia(e), t.resetSourceset_ = function() {
  5282. t.resetSourceset_ = null, t.load = a, t.setAttribute = r, Object.defineProperty(t, "src", i), t
  5283. .resetSourceWatch_ && t.resetSourceWatch_()
  5284. }
  5285. }
  5286. }
  5287. },
  5288. aa = w([
  5289. "Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."
  5290. ], [
  5291. "Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\n This may prevent text tracks from loading."
  5292. ]),
  5293. sa = function(e) {
  5294. function t(i, r) {
  5295. y(this, t);
  5296. var n = b(this, e.call(this, i, r)),
  5297. a = i.source,
  5298. s = !1;
  5299. if (a && (n.el_.currentSrc !== a.src || i.tag && 3 === i.tag.initNetworkState_) ? n.setSource(a) : n
  5300. .handleLateInit_(n.el_), i.enableSourceset && n.setupSourcesetHandling_(), n.el_.hasChildNodes()) {
  5301. for (var o = n.el_.childNodes, u = o.length, l = []; u--;) {
  5302. var d = o[u];
  5303. "track" === d.nodeName.toLowerCase() && (n.featuresNativeTextTracks ? (n.remoteTextTrackEls()
  5304. .addTrackElement_(d), n.remoteTextTracks().addTrack(d.track), n.textTracks().addTrack(d.track), s ||
  5305. n.el_.hasAttribute("crossorigin") || !ei(d.src) || (s = !0)) : l.push(d))
  5306. }
  5307. for (var c = 0; c < l.length; c++) n.el_.removeChild(l[c])
  5308. }
  5309. return n.proxyNativeTracks_(), n.featuresNativeTextTracks && s && p.warn(g(aa)), n
  5310. .restoreMetadataTracksInIOSNativePlayer_(), (mt || tt || ot) && !0 === i.nativeControlsForTouch && n
  5311. .setControls(!0), n.proxyWebkitFullscreen_(), n.triggerReady(), n
  5312. }
  5313. return _(t, e), t.prototype.dispose = function() {
  5314. this.el_ && this.el_.resetSourceset_ && this.el_.resetSourceset_(), t.disposeMediaElement(this.el_), this
  5315. .options_ = null, e.prototype.dispose.call(this)
  5316. }, t.prototype.setupSourcesetHandling_ = function() {
  5317. na(this)
  5318. }, t.prototype.restoreMetadataTracksInIOSNativePlayer_ = function() {
  5319. var e = this.textTracks(),
  5320. t = void 0,
  5321. i = function() {
  5322. t = [];
  5323. for (var i = 0; i < e.length; i++) {
  5324. var r = e[i];
  5325. "metadata" === r.kind && t.push({
  5326. track: r,
  5327. storedMode: r.mode
  5328. })
  5329. }
  5330. };
  5331. i(), e.addEventListener("change", i), this.on("dispose", function() {
  5332. return e.removeEventListener("change", i)
  5333. });
  5334. var r = function i() {
  5335. for (var r = 0; r < t.length; r++) {
  5336. var n = t[r];
  5337. "disabled" === n.track.mode && n.track.mode !== n.storedMode && (n.track.mode = n.storedMode)
  5338. }
  5339. e.removeEventListener("change", i)
  5340. };
  5341. this.on("webkitbeginfullscreen", function() {
  5342. e.removeEventListener("change", i), e.removeEventListener("change", r), e.addEventListener("change",
  5343. r)
  5344. }), this.on("webkitendfullscreen", function() {
  5345. e.removeEventListener("change", i), e.addEventListener("change", i), e.removeEventListener("change",
  5346. r)
  5347. })
  5348. }, t.prototype.overrideNative_ = function(e, t) {
  5349. var i = this;
  5350. if (t === this["featuresNative" + e + "Tracks"]) {
  5351. var r = e.toLowerCase();
  5352. this[r + "TracksListeners_"] && Object.keys(this[r + "TracksListeners_"]).forEach(function(e) {
  5353. i.el()[r + "Tracks"].removeEventListener(e, i[r + "TracksListeners_"][e])
  5354. }), this["featuresNative" + e + "Tracks"] = !t, this[r + "TracksListeners_"] = null, this
  5355. .proxyNativeTracksForType_(r)
  5356. }
  5357. }, t.prototype.overrideNativeAudioTracks = function(e) {
  5358. this.overrideNative_("Audio", e)
  5359. }, t.prototype.overrideNativeVideoTracks = function(e) {
  5360. this.overrideNative_("Video", e)
  5361. }, t.prototype.proxyNativeTracksForType_ = function(e) {
  5362. var t = this,
  5363. i = Pi[e],
  5364. r = this.el()[i.getterName],
  5365. n = this[i.getterName]();
  5366. if (this["featuresNative" + i.capitalName + "Tracks"] && r && r.addEventListener) {
  5367. var a = {
  5368. change: function(e) {
  5369. n.trigger({
  5370. type: "change",
  5371. target: n,
  5372. currentTarget: n,
  5373. srcElement: n
  5374. })
  5375. },
  5376. addtrack: function(e) {
  5377. n.addTrack(e.track)
  5378. },
  5379. removetrack: function(e) {
  5380. n.removeTrack(e.track)
  5381. }
  5382. },
  5383. s = function() {
  5384. for (var e = [], t = 0; t < n.length; t++) {
  5385. for (var i = !1, a = 0; a < r.length; a++)
  5386. if (r[a] === n[t]) {
  5387. i = !0;
  5388. break
  5389. } i || e.push(n[t])
  5390. }
  5391. for (; e.length;) n.removeTrack(e.shift())
  5392. };
  5393. this[i.getterName + "Listeners_"] = a, Object.keys(a).forEach(function(e) {
  5394. var i = a[e];
  5395. r.addEventListener(e, i), t.on("dispose", function(t) {
  5396. return r.removeEventListener(e, i)
  5397. })
  5398. }), this.on("loadstart", s), this.on("dispose", function(e) {
  5399. return t.off("loadstart", s)
  5400. })
  5401. }
  5402. }, t.prototype.proxyNativeTracks_ = function() {
  5403. var e = this;
  5404. Pi.names.forEach(function(t) {
  5405. e.proxyNativeTracksForType_(t)
  5406. })
  5407. }, t.prototype.createEl = function() {
  5408. var e = this.options_.tag;
  5409. if (!e || !this.options_.playerElIngest && !this.movingMediaElementInDOM) {
  5410. if (e) {
  5411. var i = e.cloneNode(!0);
  5412. e.parentNode && e.parentNode.insertBefore(i, e), t.disposeMediaElement(e), e = i
  5413. } else {
  5414. e = l.createElement("video");
  5415. var r = Ke({}, this.options_.tag && W(this.options_.tag));
  5416. mt && !0 === this.options_.nativeControlsForTouch || delete r.controls, V(e, A(r, {
  5417. id: this.options_.techId,
  5418. class: "vjs-tech"
  5419. }))
  5420. }
  5421. e.playerId = this.options_.playerId
  5422. }
  5423. void 0 !== this.options_.preload && X(e, "preload", this.options_.preload);
  5424. for (var n = ["loop", "muted", "playsinline", "autoplay", "stretch", "fluent"], a = 0; a < n.length; a++) {
  5425. var s = n[a],
  5426. o = this.options_[s];
  5427. void 0 !== o && (o ? X(e, s, s) : z(e, s), e[s] = o)
  5428. }
  5429. return e
  5430. }, t.prototype.handleLateInit_ = function(e) {
  5431. if (0 !== e.networkState && 3 !== e.networkState) {
  5432. if (0 === e.readyState) {
  5433. var t = !1,
  5434. i = function() {
  5435. t = !0
  5436. };
  5437. this.on("loadstart", i);
  5438. var r = function() {
  5439. t || this.trigger("loadstart")
  5440. };
  5441. return this.on("loadedmetadata", r), void this.ready(function() {
  5442. this.off("loadstart", i), this.off("loadedmetadata", r), t || this.trigger("loadstart")
  5443. })
  5444. }
  5445. var n = ["loadstart"];
  5446. n.push("loadedmetadata"), e.readyState >= 2 && n.push("loadeddata"), e.readyState >= 3 && n.push(
  5447. "canplay"), e.readyState >= 4 && n.push("canplaythrough"), this.ready(function() {
  5448. n.forEach(function(e) {
  5449. this.trigger(e)
  5450. }, this)
  5451. })
  5452. }
  5453. }, t.prototype.setCurrentTime = function(e) {
  5454. try {
  5455. this.el_.currentTime = e
  5456. } catch (e) {
  5457. p(e, "Video is not ready. (Video.js)")
  5458. }
  5459. }, t.prototype.duration = function() {
  5460. var e = this;
  5461. if (this.el_.duration === 1 / 0 && at && dt && 0 === this.el_.currentTime) {
  5462. return this.on("timeupdate", function t() {
  5463. e.el_.currentTime > 0 && (e.el_.duration === 1 / 0 && e.trigger("durationchange"), e.off(
  5464. "timeupdate", t))
  5465. }), NaN
  5466. }
  5467. return this.el_.duration || NaN
  5468. }, t.prototype.width = function() {
  5469. return this.el_.offsetWidth
  5470. }, t.prototype.height = function() {
  5471. return this.el_.offsetHeight
  5472. }, t.prototype.proxyWebkitFullscreen_ = function() {
  5473. var e = this;
  5474. if ("webkitDisplayingFullscreen" in this.el_) {
  5475. var t = function() {
  5476. this.trigger("fullscreenchange", {
  5477. isFullscreen: !1
  5478. })
  5479. },
  5480. i = function() {
  5481. "webkitPresentationMode" in this.el_ && "picture-in-picture" !== this.el_.webkitPresentationMode && (
  5482. this.one("webkitendfullscreen", t), this.trigger("fullscreenchange", {
  5483. isFullscreen: !0
  5484. }))
  5485. };
  5486. this.on("webkitbeginfullscreen", i), this.on("dispose", function() {
  5487. e.off("webkitbeginfullscreen", i), e.off("webkitendfullscreen", t)
  5488. })
  5489. }
  5490. }, t.prototype.supportsFullScreen = function() {
  5491. if ("function" == typeof this.el_.webkitEnterFullScreen) {
  5492. var e = n.navigator && n.navigator.userAgent || "";
  5493. if (/Android/.test(e) || !/Chrome|Mac OS X 10.5/.test(e)) return !0
  5494. }
  5495. return !1
  5496. }, t.prototype.enterFullScreen = function() {
  5497. var e = this.el_;
  5498. e.paused && e.networkState <= e.HAVE_METADATA ? (this.el_.play(), this.setTimeout(function() {
  5499. e.pause(), e.webkitEnterFullScreen()
  5500. }, 0)) : e.webkitEnterFullScreen()
  5501. }, t.prototype.exitFullScreen = function() {
  5502. this.el_.webkitExitFullScreen()
  5503. }, t.prototype.src = function(e) {
  5504. if (void 0 === e) return this.el_.src;
  5505. this.setSrc(e)
  5506. }, t.prototype.reset = function() {
  5507. t.resetMediaElement(this.el_)
  5508. }, t.prototype.currentSrc = function() {
  5509. return this.currentSource_ ? this.currentSource_.src : this.el_.currentSrc
  5510. }, t.prototype.setControls = function(e) {
  5511. this.el_.controls = !!e
  5512. }, t.prototype.addTextTrack = function(t, i, r) {
  5513. return this.featuresNativeTextTracks ? this.el_.addTextTrack(t, i, r) : e.prototype.addTextTrack.call(this,
  5514. t, i, r)
  5515. }, t.prototype.createRemoteTextTrack = function(t) {
  5516. if (!this.featuresNativeTextTracks) return e.prototype.createRemoteTextTrack.call(this, t);
  5517. var i = l.createElement("track");
  5518. return t.kind && (i.kind = t.kind), t.label && (i.label = t.label), (t.language || t.srclang) && (i
  5519. .srclang = t.language || t.srclang), t.default && (i.default = t.default), t.id && (i.id = t.id), t
  5520. .src && (i.src = t.src), i
  5521. }, t.prototype.addRemoteTextTrack = function(t, i) {
  5522. var r = e.prototype.addRemoteTextTrack.call(this, t, i);
  5523. return this.featuresNativeTextTracks && this.el().appendChild(r), r
  5524. }, t.prototype.removeRemoteTextTrack = function(t) {
  5525. if (e.prototype.removeRemoteTextTrack.call(this, t), this.featuresNativeTextTracks)
  5526. for (var i = this.$$("track"), r = i.length; r--;) t !== i[r] && t !== i[r].track || this.el()
  5527. .removeChild(i[r])
  5528. }, t.prototype.getVideoPlaybackQuality = function() {
  5529. if ("function" == typeof this.el().getVideoPlaybackQuality) return this.el().getVideoPlaybackQuality();
  5530. var e = {};
  5531. return void 0 !== this.el().webkitDroppedFrameCount && void 0 !== this.el().webkitDecodedFrameCount && (e
  5532. .droppedVideoFrames = this.el().webkitDroppedFrameCount, e.totalVideoFrames = this.el()
  5533. .webkitDecodedFrameCount), n.performance && "function" == typeof n.performance.now ? e.creationTime = n
  5534. .performance.now() : n.performance && n.performance.timing && "number" == typeof n.performance.timing
  5535. .navigationStart && (e.creationTime = n.Date.now() - n.performance.timing.navigationStart), e
  5536. }, t
  5537. }(_r);
  5538. if (I()) {
  5539. sa.TEST_VID = l.createElement("video");
  5540. var oa = l.createElement("track");
  5541. oa.kind = "captions", oa.srclang = "en", oa.label = "English", sa.TEST_VID.appendChild(oa)
  5542. }
  5543. sa.isSupported = function() {
  5544. try {
  5545. sa.TEST_VID.volume = .5
  5546. } catch (e) {
  5547. return !1
  5548. }
  5549. return !(!sa.TEST_VID || !sa.TEST_VID.canPlayType)
  5550. }, sa.canPlayType = function(e) {
  5551. return sa.TEST_VID.canPlayType(e)
  5552. }, sa.canPlaySource = function(e, t) {
  5553. return sa.canPlayType(e.type)
  5554. }, sa.canControlVolume = function() {
  5555. try {
  5556. var e = sa.TEST_VID.volume;
  5557. return sa.TEST_VID.volume = e / 2 + .1, e !== sa.TEST_VID.volume
  5558. } catch (e) {
  5559. return !1
  5560. }
  5561. }, sa.canMuteVolume = function() {
  5562. try {
  5563. var e = sa.TEST_VID.muted;
  5564. return sa.TEST_VID.muted = !e, sa.TEST_VID.muted ? X(sa.TEST_VID, "muted", "muted") : z(sa.TEST_VID, "muted"),
  5565. e !== sa.TEST_VID.muted
  5566. } catch (e) {
  5567. return !1
  5568. }
  5569. }, sa.canControlPlaybackRate = function() {
  5570. if (at && dt && ct < 58) return !1;
  5571. try {
  5572. var e = sa.TEST_VID.playbackRate;
  5573. return sa.TEST_VID.playbackRate = e / 2 + .1, e !== sa.TEST_VID.playbackRate
  5574. } catch (e) {
  5575. return !1
  5576. }
  5577. }, sa.canOverrideAttributes = function() {
  5578. try {
  5579. var e = function() {};
  5580. Object.defineProperty(l.createElement("video"), "src", {
  5581. get: e,
  5582. set: e
  5583. }), Object.defineProperty(l.createElement("audio"), "src", {
  5584. get: e,
  5585. set: e
  5586. }), Object.defineProperty(l.createElement("video"), "innerHTML", {
  5587. get: e,
  5588. set: e
  5589. }), Object.defineProperty(l.createElement("audio"), "innerHTML", {
  5590. get: e,
  5591. set: e
  5592. })
  5593. } catch (e) {
  5594. return !1
  5595. }
  5596. return !0
  5597. }, sa.supportsNativeTextTracks = function() {
  5598. return pt || rt && dt
  5599. }, sa.supportsNativeVideoTracks = function() {
  5600. return !(!sa.TEST_VID || !sa.TEST_VID.videoTracks)
  5601. }, sa.supportsNativeAudioTracks = function() {
  5602. return !(!sa.TEST_VID || !sa.TEST_VID.audioTracks)
  5603. }, sa.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata",
  5604. "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate",
  5605. "progress", "play", "pause", "ratechange", "resize", "volumechange"
  5606. ], sa.prototype.featuresVolumeControl = sa.canControlVolume(), sa.prototype.featuresMuteControl = sa
  5607. .canMuteVolume(), sa.prototype.featuresPlaybackRate = sa.canControlPlaybackRate(), sa.prototype
  5608. .featuresSourceset = sa.canOverrideAttributes(), sa.prototype.movingMediaElementInDOM = !rt, sa.prototype
  5609. .featuresFullscreenResize = !0, sa.prototype.featuresProgressEvents = !0, sa.prototype
  5610. .featuresTimeupdateEvents = !0, sa.prototype.featuresNativeTextTracks = sa.supportsNativeTextTracks(), sa
  5611. .prototype.featuresNativeVideoTracks = sa.supportsNativeVideoTracks(), sa.prototype.featuresNativeAudioTracks = sa
  5612. .supportsNativeAudioTracks();
  5613. var ua = sa.TEST_VID && sa.TEST_VID.constructor.prototype.canPlayType,
  5614. la = /^application\/(?:x-|vnd\.apple\.)mpegurl/i;
  5615. sa.patchCanPlayType = function() {
  5616. st >= 4 && !ut && !dt && (sa.TEST_VID.constructor.prototype.canPlayType = function(e) {
  5617. return e && la.test(e) ? "maybe" : ua.call(this, e)
  5618. })
  5619. }, sa.unpatchCanPlayType = function() {
  5620. var e = sa.TEST_VID.constructor.prototype.canPlayType;
  5621. return sa.TEST_VID.constructor.prototype.canPlayType = ua, e
  5622. }, sa.patchCanPlayType(), sa.disposeMediaElement = function(e) {
  5623. if (e) {
  5624. for (e.parentNode && e.parentNode.removeChild(e); e.hasChildNodes();) e.removeChild(e.firstChild);
  5625. e.removeAttribute("src"), "function" == typeof e.load && function() {
  5626. try {
  5627. e.load()
  5628. } catch (e) {}
  5629. }()
  5630. }
  5631. }, sa.resetMediaElement = function(e) {
  5632. if (e) {
  5633. for (var t = e.querySelectorAll("source"), i = t.length; i--;) e.removeChild(t[i]);
  5634. e.removeAttribute("src"), "function" == typeof e.load && function() {
  5635. try {
  5636. e.load()
  5637. } catch (e) {}
  5638. }()
  5639. }
  5640. }, ["muted", "defaultMuted", "autoplay", "stretch", "fluent", "controls", "loop", "playsinline"].forEach(function(
  5641. e) {
  5642. sa.prototype[e] = function() {
  5643. return this.el_[e] || this.el_.hasAttribute(e)
  5644. }
  5645. }), ["muted", "defaultMuted", "autoplay", "loop", "playsinline"].forEach(function(e) {
  5646. sa.prototype["set" + ze(e)] = function(t) {
  5647. this.el_[e] = t, t ? this.el_.setAttribute(e, e) : this.el_.removeAttribute(e)
  5648. }
  5649. }), ["paused", "currentTime", "buffered", "volume", "poster", "preload", "error", "seeking", "seekable", "ended",
  5650. "playbackRate", "defaultPlaybackRate", "played", "networkState", "readyState", "videoWidth", "videoHeight"
  5651. ].forEach(function(e) {
  5652. sa.prototype[e] = function() {
  5653. return this.el_[e]
  5654. }
  5655. }), ["volume", "src", "poster", "preload", "playbackRate", "defaultPlaybackRate"].forEach(function(e) {
  5656. sa.prototype["set" + ze(e)] = function(t) {
  5657. this.el_[e] = t
  5658. }
  5659. }), ["pause", "load", "play"].forEach(function(e) {
  5660. sa.prototype[e] = function() {
  5661. return this.el_[e]()
  5662. }
  5663. }), _r.withSourceHandlers(sa), sa.nativeSourceHandler = {}, sa.nativeSourceHandler.canPlayType = function(e) {
  5664. try {
  5665. return sa.TEST_VID.canPlayType(e)
  5666. } catch (e) {
  5667. return ""
  5668. }
  5669. }, sa.nativeSourceHandler.canHandleSource = function(e, t) {
  5670. if (e.type) return sa.nativeSourceHandler.canPlayType(e.type);
  5671. if (e.src) {
  5672. var i = $t(e.src);
  5673. return sa.nativeSourceHandler.canPlayType("video/" + i)
  5674. }
  5675. return ""
  5676. }, sa.nativeSourceHandler.handleSource = function(e, t, i) {
  5677. t.setSrc(e.src)
  5678. }, sa.nativeSourceHandler.dispose = function() {}, sa.registerSourceHandler(sa.nativeSourceHandler), _r
  5679. .registerTech("Html5", sa);
  5680. var da = w([
  5681. "\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "
  5682. ], [
  5683. "\n Using the tech directly can be dangerous. I hope you know what you're doing.\n See https://github.com/videojs/video.js/issues/2617 for more info.\n "
  5684. ]),
  5685. ca = ["progress", "abort", "suspend", "emptied", "stalled", "loadedmetadata", "loadeddata", "timeupdate",
  5686. "resize", "volumechange", "texttrackchange"
  5687. ],
  5688. ha = {
  5689. canplay: "CanPlay",
  5690. canplaythrough: "CanPlayThrough",
  5691. playing: "Playing",
  5692. seeked: "Seeked"
  5693. },
  5694. fa = function(t) {
  5695. function i(r, n, a) {
  5696. if (y(this, i), r.id = r.id || n.id || "vjs_video_" + le(), (n = A(i.getTagSettings(r), n)).initChildren = !1,
  5697. n.createEl = !1, n.evented = !1, n.reportTouchActivity = !1, !n.language)
  5698. if ("function" == typeof r.closest) {
  5699. var s = r.closest("[lang]");
  5700. s && s.getAttribute && (n.language = s.getAttribute("lang"))
  5701. } else
  5702. for (var o = r; o && 1 === o.nodeType;) {
  5703. if (W(o).hasOwnProperty("lang")) {
  5704. n.language = o.getAttribute("lang");
  5705. break
  5706. }
  5707. o = o.parentNode
  5708. }
  5709. var u = b(this, t.call(this, null, n, a));
  5710. if (u.isPosterFromTech_ = !1, u.queuedCallbacks_ = [], u.isReady_ = !1, u.hasStarted_ = !1, u.userActive_ = !
  5711. 1, !u.options_ || !u.options_.techOrder || !u.options_.techOrder.length) throw new Error(
  5712. "No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?"
  5713. );
  5714. if (u.tag = r, u.tagAttributes = r && W(r), u.language(u.options_.language), n.languages) {
  5715. var l = {};
  5716. Object.getOwnPropertyNames(n.languages).forEach(function(e) {
  5717. l[e.toLowerCase()] = n.languages[e]
  5718. }), u.languages_ = l
  5719. } else u.languages_ = i.prototype.options_.languages;
  5720. u.cache_ = {}, u.poster_ = n.poster || "", u.controls_ = !!n.controls, u.cache_.lastVolume = 1, r.controls = !
  5721. 1, r.removeAttribute("controls"), r.hasAttribute("autoplay") ? u.options_.autoplay = !0 : u.autoplay(u
  5722. .options_.autoplay), u.scrubbing_ = !1, u.el_ = u.createEl(), u.cache_.lastPlaybackRate = u
  5723. .defaultPlaybackRate(), We(u, {
  5724. eventBusKey: "el_"
  5725. });
  5726. var d = Ke(u.options_);
  5727. if (n.plugins) {
  5728. var c = n.plugins;
  5729. Object.keys(c).forEach(function(e) {
  5730. if ("function" != typeof this[e]) throw new Error('plugin "' + e + '" does not exist');
  5731. this[e](c[e])
  5732. }, u)
  5733. }
  5734. u.options_.playerOptions = d, u.middleware_ = [], u.initChildren(), u.isAudio("audio" === r.nodeName
  5735. .toLowerCase()), u.controls() ? u.addClass("vjs-controls-enabled") : u.addClass("vjs-controls-disabled"),
  5736. u.el_.setAttribute("role", "region"), u.isAudio() ? u.el_.setAttribute("aria-label", u.localize(
  5737. "Audio Player")) : u.el_.setAttribute("aria-label", u.localize("Video Player")), u.isAudio() && u
  5738. .addClass("vjs-audio"), u.flexNotSupported_() && u.addClass("vjs-no-flex"), rt || u.addClass(
  5739. "vjs-workinghover"), i.players[u.id_] = u;
  5740. var h = e.split(".")[0];
  5741. return u.addClass("vjs-v" + h), u.userActive(!0), u.reportUserActivity(), u.one("play", u
  5742. .listenForUserActivity_), u.on("fullscreenchange", u.handleFullscreenChange_), u.on("stageclick", u
  5743. .handleStageClick_), u.changingSrc_ = !1, u.playWaitingForReady_ = !1, u.playOnLoadstart_ = null, u
  5744. }
  5745. return _(i, t), i.prototype.dispose = function() {
  5746. this.trigger("dispose"), this.off("dispose"), this.styleEl_ && this.styleEl_.parentNode && (this.styleEl_
  5747. .parentNode.removeChild(this.styleEl_), this.styleEl_ = null), i.players[this.id_] = null, this.tag &&
  5748. this.tag.player && (this.tag.player = null), this.el_ && this.el_.player && (this.el_.player = null), this
  5749. .tech_ && (this.tech_.dispose(), this.isPosterFromTech_ = !1, this.poster_ = ""), this.playerElIngest_ &&
  5750. (this.playerElIngest_ = null), this.tag && (this.tag = null), wr[this.id()] = null, t.prototype.dispose
  5751. .call(this)
  5752. }, i.prototype.createEl = function() {
  5753. var e = this.tag,
  5754. i = void 0,
  5755. r = this.playerElIngest_ = e.parentNode && e.parentNode.hasAttribute && e.parentNode.hasAttribute(
  5756. "data-vjs-player"),
  5757. a = "video-js" === this.tag.tagName.toLowerCase();
  5758. r ? i = this.el_ = e.parentNode : a || (i = this.el_ = t.prototype.createEl.call(this, "div"));
  5759. var s = W(e);
  5760. if (a) {
  5761. for (i = this.el_ = e, e = this.tag = l.createElement("video"); i.children.length;) e.appendChild(i
  5762. .firstChild);
  5763. F(i, "video-js") || j(i, "video-js"), i.appendChild(e), r = this.playerElIngest_ = i, Object.keys(i)
  5764. .forEach(function(t) {
  5765. e[t] = i[t]
  5766. })
  5767. }
  5768. if (e.setAttribute("tabindex", "-1"), s.tabindex = "-1", ht && (e.setAttribute("role", "application"), s
  5769. .role = "application"), e.removeAttribute("width"), e.removeAttribute("height"), "width" in s &&
  5770. delete s.width, "height" in s && delete s.height, Object.getOwnPropertyNames(s).forEach(function(t) {
  5771. a && "class" === t || i.setAttribute(t, s[t]), a && e.setAttribute(t, s[t])
  5772. }), e.playerId = e.id, e.id += "_html5_api", e.className = "vjs-tech", e.player = i.player = this, this
  5773. .addClass("vjs-paused"), !0 !== n.VIDEOJS_NO_DYNAMIC_STYLE) {
  5774. this.styleEl_ = Oe("vjs-styles-dimensions");
  5775. var o = ae(".vjs-styles-defaults"),
  5776. u = ae("head");
  5777. u.insertBefore(this.styleEl_, o ? o.nextSibling : u.firstChild)
  5778. }
  5779. this.width(this.options_.width), this.height(this.options_.height), this.fluid(this.options_.fluid), this
  5780. .aspectRatio(this.options_.aspectRatio);
  5781. for (var d = e.getElementsByTagName("a"), c = 0; c < d.length; c++) {
  5782. var h = d.item(c);
  5783. j(h, "vjs-hidden"), h.setAttribute("hidden", "hidden")
  5784. }
  5785. return e.initNetworkState_ = e.networkState, e.parentNode && !r && e.parentNode.insertBefore(i, e), B(e, i),
  5786. this.children_.unshift(e), this.el_.setAttribute("lang", this.language_), this.el_ = i, i
  5787. }, i.prototype.width = function(e) {
  5788. return this.dimension("width", e)
  5789. }, i.prototype.height = function(e) {
  5790. return this.dimension("height", e)
  5791. }, i.prototype.dimension = function(e, t) {
  5792. var i = e + "_";
  5793. if (void 0 === t) return this[i] || 0;
  5794. if ("" === t) return this[i] = void 0, void this.updateStyleEl_();
  5795. var r = parseFloat(t);
  5796. isNaN(r) ? p.error('Improper value "' + t + '" supplied for for ' + e) : (this[i] = r, this
  5797. .updateStyleEl_())
  5798. }, i.prototype.fluid = function(e) {
  5799. if (void 0 === e) return !!this.fluid_;
  5800. this.fluid_ = !!e, e ? this.addClass("vjs-fluid") : this.removeClass("vjs-fluid"), this.updateStyleEl_()
  5801. }, i.prototype.aspectRatio = function(e) {
  5802. if (void 0 === e) return this.aspectRatio_;
  5803. if (!/^\d+\:\d+$/.test(e)) throw new Error(
  5804. "Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  5805. this.aspectRatio_ = e, this.fluid(!0), this.updateStyleEl_()
  5806. }, i.prototype.updateStyleEl_ = function() {
  5807. if (!0 !== n.VIDEOJS_NO_DYNAMIC_STYLE) {
  5808. var e = void 0,
  5809. t = void 0,
  5810. i = void 0,
  5811. r = (void 0 !== this.aspectRatio_ && "auto" !== this.aspectRatio_ ? this.aspectRatio_ : this
  5812. .videoWidth() > 0 ? this.videoWidth() + ":" + this.videoHeight() : "16:9").split(":"),
  5813. a = r[1] / r[0];
  5814. e = void 0 !== this.width_ ? this.width_ : void 0 !== this.height_ ? this.height_ / a : this
  5815. .videoWidth() || 300, t = void 0 !== this.height_ ? this.height_ : e * a, i = /^[^a-zA-Z]/.test(this
  5816. .id()) ? "dimensions-" + this.id() : this.id() + "-dimensions", this.addClass(i), Ce(this.styleEl_,
  5817. "\n ." + i + " {\n width: " + e + "px;\n height: " + t +
  5818. "px;\n }\n\n ." + i + ".vjs-fluid {\n padding-top: " + 100 * a + "%;\n }\n ")
  5819. } else {
  5820. var s = "number" == typeof this.width_ ? this.width_ : this.options_.width,
  5821. o = "number" == typeof this.height_ ? this.height_ : this.options_.height,
  5822. u = this.tech_ && this.tech_.el();
  5823. u && (s >= 0 && (u.width = s), o >= 0 && (u.height = o))
  5824. }
  5825. }, i.prototype.loadTech_ = function(e, t) {
  5826. var i = this;
  5827. this.tech_ && this.unloadTech_();
  5828. var r = ze(e),
  5829. n = e.charAt(0).toLowerCase() + e.slice(1);
  5830. "Html5" !== r && this.tag && (_r.getTech("Html5").disposeMediaElement(this.tag), this.tag.player = null,
  5831. this.tag = null), this.techName_ = r, this.isReady_ = !1;
  5832. var a = {
  5833. source: t,
  5834. autoplay: "string" != typeof this.autoplay() && this.autoplay(),
  5835. nativeControlsForTouch: this.options_.nativeControlsForTouch,
  5836. playerId: this.id(),
  5837. techId: this.id() + "_" + n + "_api",
  5838. playsinline: this.options_.playsinline,
  5839. stretch: this.options_.stretch,
  5840. fluent: this.options_.fluent,
  5841. preload: this.options_.preload,
  5842. loop: this.options_.loop,
  5843. muted: this.options_.muted,
  5844. poster: this.poster(),
  5845. language: this.language(),
  5846. playerElIngest: this.playerElIngest_ || !1,
  5847. "vtt.js": this.options_["vtt.js"],
  5848. canOverridePoster: !!this.options_.techCanOverridePoster,
  5849. enableSourceset: this.options_.enableSourceset
  5850. };
  5851. Ni.names.forEach(function(e) {
  5852. var t = Ni[e];
  5853. a[t.getterName] = i[t.privateName]
  5854. }), A(a, this.options_[r]), A(a, this.options_[n]), A(a, this.options_[e.toLowerCase()]), this.tag && (a
  5855. .tag = this.tag), t && t.src === this.cache_.src && this.cache_.currentTime > 0 && (a.startTime = this
  5856. .cache_.currentTime);
  5857. var s = _r.getTech(e);
  5858. if (!s) throw new Error("No Tech named '" + r + "' exists! '" + r +
  5859. "' should be registered using videojs.registerTech()'");
  5860. this.tech_ = new s(a), this.tech_.ready(De(this, this.handleTechReady_), !0), xt(this.textTracksJson_ || [],
  5861. this.tech_), ca.forEach(function(e) {
  5862. i.on(i.tech_, e, i["handleTech" + ze(e) + "_"])
  5863. }), Object.keys(ha).forEach(function(e) {
  5864. i.on(i.tech_, e, function(t) {
  5865. 0 === i.tech_.playbackRate() && i.tech_.seeking() ? i.queuedCallbacks_.push({
  5866. callback: i["handleTech" + ha[e] + "_"].bind(i),
  5867. event: t
  5868. }) : i["handleTech" + ha[e] + "_"](t)
  5869. })
  5870. }), this.on(this.tech_, "loadstart", this.handleTechLoadStart_), this.on(this.tech_, "sourceset", this
  5871. .handleTechSourceset_), this.on(this.tech_, "waiting", this.handleTechWaiting_), this.on(this.tech_,
  5872. "ended", this.handleTechEnded_), this.on(this.tech_, "seeking", this.handleTechSeeking_), this.on(this
  5873. .tech_, "play", this.handleTechPlay_), this.on(this.tech_, "firstplay", this.handleTechFirstPlay_), this
  5874. .on(this.tech_, "pause", this.handleTechPause_), this.on(this.tech_, "durationchange", this
  5875. .handleTechDurationChange_), this.on(this.tech_, "fullscreenchange", this.handleTechFullscreenChange_),
  5876. this.on(this.tech_, "fullscreentoggle", this.handleTechFullscreenToggle_), this.on(this.tech_, "error",
  5877. this.handleTechError_), this.on(this.tech_, "loadedmetadata", this.updateStyleEl_), this.on(this.tech_,
  5878. "posterchange", this.handleTechPosterChange_), this.on(this.tech_, "textdata", this
  5879. .handleTechTextData_), this.on(this.tech_, "ratechange", this.handleTechRateChange_), this
  5880. .usingNativeControls(this.techGet_("controls")), this.controls() && !this.usingNativeControls() && this
  5881. .addTechControlsListeners_(), this.tech_.el().parentNode === this.el() || "Html5" === r && this.tag || B(
  5882. this.tech_.el(), this.el()), this.tag && (this.tag.player = null, this.tag = null)
  5883. }, i.prototype.unloadTech_ = function() {
  5884. var e = this;
  5885. Ni.names.forEach(function(t) {
  5886. var i = Ni[t];
  5887. e[i.privateName] = e[i.getterName]()
  5888. }), this.textTracksJson_ = Lt(this.tech_), this.isReady_ = !1, this.tech_.dispose(), this.tech_ = !1, this
  5889. .isPosterFromTech_ && (this.poster_ = "", this.trigger("posterchange")), this.isPosterFromTech_ = !1
  5890. }, i.prototype.tech = function(e) {
  5891. return void 0 === e && p.warn(g(da)), this.tech_
  5892. }, i.prototype.addTechControlsListeners_ = function() {
  5893. this.removeTechControlsListeners_(), this.on(this.tech_, "mousedown", this.handleTechClick_), this.on(this
  5894. .tech_, "dblclick", this.handleTechDoubleClick_), this.on(this.tech_, "touchstart", this
  5895. .handleTechTouchStart_), this.on(this.tech_, "touchmove", this.handleTechTouchMove_), this.on(this
  5896. .tech_, "touchend", this.handleTechTouchEnd_), this.on(this.tech_, "tap", this.handleTechTap_)
  5897. }, i.prototype.removeTechControlsListeners_ = function() {
  5898. this.off(this.tech_, "tap", this.handleTechTap_), this.off(this.tech_, "touchstart", this
  5899. .handleTechTouchStart_), this.off(this.tech_, "touchmove", this.handleTechTouchMove_), this.off(this
  5900. .tech_, "touchend", this.handleTechTouchEnd_), this.off(this.tech_, "mousedown", this.handleTechClick_),
  5901. this.off(this.tech_, "dblclick", this.handleTechDoubleClick_)
  5902. }, i.prototype.handleTechReady_ = function() {
  5903. this.triggerReady(), this.cache_.volume && this.techCall_("setVolume", this.cache_.volume), this
  5904. .handleTechPosterChange_(), this.handleTechDurationChange_()
  5905. }, i.prototype.handleTechLoadStart_ = function() {
  5906. this.removeClass("vjs-ended"), this.removeClass("vjs-seeking"), this.error(null), this.paused() ? (this
  5907. .hasStarted(!1), this.trigger("loadstart")) : (this.trigger("loadstart"), this.trigger("firstplay")),
  5908. this.manualAutoplay_(this.autoplay())
  5909. }, i.prototype.manualAutoplay_ = function(e) {
  5910. var t = this;
  5911. if (this.tech_ && "string" == typeof e) {
  5912. var i = function() {
  5913. var e = t.muted();
  5914. t.muted(!0);
  5915. var i = t.play();
  5916. if (i && i.then && i.catch) return i.catch(function(i) {
  5917. t.muted(e)
  5918. })
  5919. },
  5920. r = void 0;
  5921. if ("any" === e ? (r = this.play()) && r.then && r.catch && r.catch(function() {
  5922. return i()
  5923. }) : r = "muted" === e ? i() : this.play(), r && r.then && r.catch) return r.then(function() {
  5924. t.trigger({
  5925. type: "autoplay-success",
  5926. autoplay: e
  5927. })
  5928. }).catch(function(i) {
  5929. t.trigger({
  5930. type: "autoplay-failure",
  5931. autoplay: e
  5932. })
  5933. })
  5934. }
  5935. }, i.prototype.updateSourceCaches_ = function() {
  5936. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
  5937. t = e,
  5938. i = "";
  5939. if ("string" != typeof t && (t = e.src, i = e.type), !/^blob:/.test(t)) {
  5940. this.cache_.source = this.cache_.source || {}, this.cache_.sources = this.cache_.sources || [], t && !i &&
  5941. (i = function(e, t) {
  5942. if (!t) return "";
  5943. if (e.cache_.source.src === t && e.cache_.source.type) return e.cache_.source.type;
  5944. var i = e.cache_.sources.filter(function(e) {
  5945. return e.src === t
  5946. });
  5947. if (i.length) return i[0].type;
  5948. for (var r = e.$$("source"), n = 0; n < r.length; n++) {
  5949. var a = r[n];
  5950. if (a.type && a.src && a.src === t) return a.type
  5951. }
  5952. return Cr(t)
  5953. }(this, t)), this.cache_.source = Ke({}, e, {
  5954. src: t,
  5955. type: i
  5956. });
  5957. for (var r = this.cache_.sources.filter(function(e) {
  5958. return e.src && e.src === t
  5959. }), n = [], a = this.$$("source"), s = [], o = 0; o < a.length; o++) {
  5960. var u = W(a[o]);
  5961. n.push(u), u.src && u.src === t && s.push(u.src)
  5962. }
  5963. s.length && !r.length ? this.cache_.sources = n : r.length || (this.cache_.sources = [this.cache_
  5964. .source]), this.cache_.src = t
  5965. }
  5966. }, i.prototype.handleTechSourceset_ = function(e) {
  5967. var t = this;
  5968. if (!this.changingSrc_ && (this.updateSourceCaches_(e.src), !e.src)) {
  5969. this.tech_.one(["sourceset", "loadstart"], function e(i) {
  5970. "sourceset" !== i.type && t.updateSourceCaches_(t.techGet_("currentSrc")), t.tech_.off(["sourceset",
  5971. "loadstart"
  5972. ], e)
  5973. })
  5974. }
  5975. this.trigger({
  5976. src: e.src,
  5977. type: "sourceset"
  5978. })
  5979. }, i.prototype.hasStarted = function(e) {
  5980. if (void 0 === e) return this.hasStarted_;
  5981. e !== this.hasStarted_ && (this.hasStarted_ = e, this.hasStarted_ ? (this.addClass("vjs-has-started"), this
  5982. .trigger("firstplay")) : this.removeClass("vjs-has-started"))
  5983. }, i.prototype.handleTechPlay_ = function() {
  5984. this.removeClass("vjs-ended"), this.removeClass("vjs-paused"), this.addClass("vjs-playing"), this
  5985. .hasStarted(!0), this.trigger("play")
  5986. }, i.prototype.handleTechRateChange_ = function() {
  5987. this.tech_.playbackRate() > 0 && 0 === this.cache_.lastPlaybackRate && (this.queuedCallbacks_.forEach(
  5988. function(e) {
  5989. return e.callback(e.event)
  5990. }), this.queuedCallbacks_ = []), this.cache_.lastPlaybackRate = this.tech_.playbackRate(), this.trigger(
  5991. "ratechange")
  5992. }, i.prototype.handleTechWaiting_ = function() {
  5993. var e = this;
  5994. this.addClass("vjs-waiting"), this.trigger("waiting"), this.one("timeupdate", function() {
  5995. return e.removeClass("vjs-waiting")
  5996. })
  5997. }, i.prototype.handleTechCanPlay_ = function() {
  5998. this.removeClass("vjs-waiting"), this.trigger("canplay")
  5999. }, i.prototype.handleTechCanPlayThrough_ = function() {
  6000. this.removeClass("vjs-waiting"), this.trigger("canplaythrough")
  6001. }, i.prototype.handleTechPlaying_ = function() {
  6002. this.removeClass("vjs-waiting"), this.trigger("playing")
  6003. }, i.prototype.handleTechSeeking_ = function() {
  6004. this.addClass("vjs-seeking"), this.trigger("seeking")
  6005. }, i.prototype.handleTechSeeked_ = function() {
  6006. this.removeClass("vjs-seeking"), this.trigger("seeked")
  6007. }, i.prototype.handleTechFirstPlay_ = function() {
  6008. this.options_.starttime && (p.warn(
  6009. "Passing the `starttime` option to the player will be deprecated in 6.0"), this.currentTime(this
  6010. .options_.starttime)), this.addClass("vjs-has-started"), this.trigger("firstplay")
  6011. }, i.prototype.handleTechPause_ = function() {
  6012. this.removeClass("vjs-playing"), this.addClass("vjs-paused"), this.trigger("pause")
  6013. }, i.prototype.handleTechEnded_ = function() {
  6014. this.addClass("vjs-ended"), this.options_.loop ? (this.currentTime(0), this.play()) : this.paused() || this
  6015. .pause(), this.trigger("ended")
  6016. }, i.prototype.handleTechDurationChange_ = function() {
  6017. this.duration(this.techGet_("duration"))
  6018. }, i.prototype.handleTechClick_ = function(e) {
  6019. ne(e) && this.controls_ && this.paused()
  6020. }, i.prototype.handleTechDoubleClick_ = function(e) {
  6021. this.controls_ && (Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), function(t) {
  6022. return t.contains(e.target)
  6023. }) || (this.isFullscreen() ? this.exitFullscreen() : this.requestFullscreen()))
  6024. }, i.prototype.handleTechTap_ = function() {
  6025. this.userActive(!this.userActive())
  6026. }, i.prototype.handleTechTouchStart_ = function() {
  6027. this.userWasActive = this.userActive()
  6028. }, i.prototype.handleTechTouchMove_ = function() {
  6029. this.userWasActive && this.reportUserActivity()
  6030. }, i.prototype.handleTechTouchEnd_ = function(e) {
  6031. e.preventDefault()
  6032. }, i.prototype.handleFullscreenChange_ = function() {
  6033. this.isFullscreen() ? this.addClass("vjs-fullscreen") : this.removeClass("vjs-fullscreen")
  6034. }, i.prototype.handleStageClick_ = function() {
  6035. this.reportUserActivity()
  6036. }, i.prototype.handleTechFullscreenChange_ = function(e, t) {
  6037. t && this.isFullscreen(t.isFullscreen), this.trigger("fullscreenchange")
  6038. }, i.prototype.handleTechFullscreenToggle_ = function(e, t) {
  6039. this.isFullscreen() ? this.exitFullscreen() : this.requestFullscreen()
  6040. }, i.prototype.handleTechError_ = function() {
  6041. var e = this.tech_.error();
  6042. this.error(e)
  6043. }, i.prototype.handleTechTextData_ = function() {
  6044. var e = null;
  6045. arguments.length > 1 && (e = arguments[1]), this.trigger("textdata", e)
  6046. }, i.prototype.getCache = function() {
  6047. return this.cache_
  6048. }, i.prototype.techCall_ = function(e, t) {
  6049. this.ready(function() {
  6050. if (e in kr) return function(e, t, i, r) {
  6051. return t[i](e.reduce(Mr(i), r))
  6052. }(this.middleware_, this.tech_, e, t);
  6053. if (e in Rr) return Sr(this.middleware_, this.tech_, e, t);
  6054. try {
  6055. this.tech_ && this.tech_[e](t)
  6056. } catch (e) {
  6057. throw p(e), e
  6058. }
  6059. }, !0)
  6060. }, i.prototype.techGet_ = function(e) {
  6061. if (this.tech_ && this.tech_.isReady_) {
  6062. if (e in Ar) return function(e, t, i) {
  6063. return e.reduceRight(Mr(i), t[i]())
  6064. }(this.middleware_, this.tech_, e);
  6065. if (e in Rr) return Sr(this.middleware_, this.tech_, e);
  6066. try {
  6067. return this.tech_[e]()
  6068. } catch (t) {
  6069. if (void 0 === this.tech_[e]) throw p("Video.js: " + e + " method not defined for " + this.techName_ +
  6070. " playback technology.", t), t;
  6071. if ("TypeError" === t.name) throw p("Video.js: " + e + " unavailable on " + this.techName_ +
  6072. " playback technology element.", t), this.tech_.isReady_ = !1, t;
  6073. throw p(t), t
  6074. }
  6075. }
  6076. }, i.prototype.play = function() {
  6077. var e = this,
  6078. t = this.options_.Promise || n.Promise;
  6079. return t ? new t(function(t) {
  6080. e.play_(t)
  6081. }) : this.play_()
  6082. }, i.prototype.play_ = function() {
  6083. var e = this,
  6084. t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Dt;
  6085. if (this.playOnLoadstart_ && this.off("loadstart", this.playOnLoadstart_), this.isReady_) {
  6086. if (!this.changingSrc_ && (this.src() || this.currentSrc())) return void t(this.techGet_("play"));
  6087. this.playOnLoadstart_ = function() {
  6088. e.playOnLoadstart_ = null, t(e.play())
  6089. }, this.one("loadstart", this.playOnLoadstart_)
  6090. } else {
  6091. if (this.playWaitingForReady_) return;
  6092. this.playWaitingForReady_ = !0, this.ready(function() {
  6093. e.playWaitingForReady_ = !1, t(e.play())
  6094. })
  6095. }
  6096. }, i.prototype.pause = function() {
  6097. this.techCall_("pause")
  6098. }, i.prototype.paused = function() {
  6099. return !1 !== this.techGet_("paused")
  6100. }, i.prototype.played = function() {
  6101. return this.techGet_("played") || _t(0, 0)
  6102. }, i.prototype.scrubbing = function(e) {
  6103. if (void 0 === e) return this.scrubbing_;
  6104. this.scrubbing_ = !!e, e ? this.addClass("vjs-scrubbing") : this.removeClass("vjs-scrubbing")
  6105. }, i.prototype.currentTime = function(e) {
  6106. return void 0 !== e ? (e < 0 && (e = 0), void this.techCall_("setCurrentTime", e)) : (this.cache_
  6107. .currentTime = this.techGet_("currentTime") || 0, this.cache_.currentTime)
  6108. }, i.prototype.duration = function(e) {
  6109. if (void 0 === e) return void 0 !== this.cache_.duration ? this.cache_.duration : NaN;
  6110. (e = parseFloat(e)) < 0 && (e = 1 / 0), e !== this.cache_.duration && (this.cache_.duration = e, e === 1 /
  6111. 0 ? this.addClass("vjs-live") : this.removeClass("vjs-live"), this.trigger("durationchange"))
  6112. }, i.prototype.remainingTime = function() {
  6113. return this.duration() - this.currentTime()
  6114. }, i.prototype.remainingTimeDisplay = function() {
  6115. return Math.floor(this.duration()) - Math.floor(this.currentTime())
  6116. }, i.prototype.buffered = function() {
  6117. var e = this.techGet_("buffered");
  6118. return e && e.length || (e = _t(0, 0)), e
  6119. }, i.prototype.bufferedPercent = function() {
  6120. return bt(this.buffered(), this.duration())
  6121. }, i.prototype.bufferedEnd = function() {
  6122. var e = this.buffered(),
  6123. t = this.duration(),
  6124. i = e.end(e.length - 1);
  6125. return i > t && (i = t), i
  6126. }, i.prototype.volume = function(e) {
  6127. var t = void 0;
  6128. return void 0 !== e ? (t = Math.max(0, Math.min(1, parseFloat(e))), this.cache_.volume = t, this.techCall_(
  6129. "setVolume", t), void(t > 0 && this.lastVolume_(t))) : (t = parseFloat(this.techGet_("volume")), isNaN(
  6130. t) ? 1 : t)
  6131. }, i.prototype.muted = function(e) {
  6132. if (void 0 === e) return this.techGet_("muted") || !1;
  6133. this.techCall_("setMuted", e)
  6134. }, i.prototype.defaultMuted = function(e) {
  6135. return void 0 !== e ? this.techCall_("setDefaultMuted", e) : this.techGet_("defaultMuted") || !1
  6136. }, i.prototype.lastVolume_ = function(e) {
  6137. if (void 0 === e || 0 === e) return this.cache_.lastVolume;
  6138. this.cache_.lastVolume = e
  6139. }, i.prototype.supportsFullScreen = function() {
  6140. return this.techGet_("supportsFullScreen") || !1
  6141. }, i.prototype.isFullscreen = function(e) {
  6142. if (void 0 === e) return !!this.isFullscreen_;
  6143. this.isFullscreen_ = !!e
  6144. }, i.prototype.requestFullscreen = function() {
  6145. var e = wt;
  6146. this.isFullscreen(!0), e.requestFullscreen ? (be(l, e.fullscreenchange, De(this, function t(i) {
  6147. this.isFullscreen(l[e.fullscreenElement]), !1 === this.isFullscreen() && we(l, e.fullscreenchange,
  6148. t), this.trigger("fullscreenchange")
  6149. })), this.el_[e.requestFullscreen]()) : this.tech_.supportsFullScreen() ? this.techCall_(
  6150. "enterFullScreen") : (this.enterFullWindow(), this.trigger("fullscreenchange"))
  6151. }, i.prototype.exitFullscreen = function() {
  6152. var e = wt;
  6153. this.isFullscreen(!1), e.requestFullscreen ? l[e.exitFullscreen]() : this.tech_.supportsFullScreen() ? this
  6154. .techCall_("exitFullScreen") : (this.exitFullWindow(), this.trigger("fullscreenchange"))
  6155. }, i.prototype.enterFullWindow = function() {
  6156. this.isFullWindow = !0, this.docOrigOverflow = l.documentElement.style.overflow, be(l, "keydown", De(this,
  6157. this.fullWindowOnEscKey)), l.documentElement.style.overflow = "hidden", j(l.body, "vjs-full-window"),
  6158. this.trigger("enterFullWindow")
  6159. }, i.prototype.fullWindowOnEscKey = function(e) {
  6160. 27 === e.keyCode && (!0 === this.isFullscreen() ? this.exitFullscreen() : this.exitFullWindow())
  6161. }, i.prototype.exitFullWindow = function() {
  6162. this.isFullWindow = !1, we(l, "keydown", this.fullWindowOnEscKey), l.documentElement.style.overflow = this
  6163. .docOrigOverflow, H(l.body, "vjs-full-window"), this.trigger("exitFullWindow")
  6164. }, i.prototype.canPlayType = function(e) {
  6165. for (var t = void 0, i = 0, r = this.options_.techOrder; i < r.length; i++) {
  6166. var n = r[i],
  6167. a = _r.getTech(n);
  6168. if (a || (a = Ye.getComponent(n)), a) {
  6169. if (a.isSupported() && (t = a.canPlayType(e))) return t
  6170. } else p.error('The "' + n + '" tech is undefined. Skipped browser support check for that tech.')
  6171. }
  6172. return ""
  6173. }, i.prototype.selectSource = function(e) {
  6174. var t, i = this,
  6175. r = this.options_.techOrder.map(function(e) {
  6176. return [e, _r.getTech(e)]
  6177. }).filter(function(e) {
  6178. var t = e[0],
  6179. i = e[1];
  6180. return i ? i.isSupported() : (p.error('The "' + t +
  6181. '" tech is undefined. Skipped browser support check for that tech.'), !1)
  6182. }),
  6183. n = function(e, t, i) {
  6184. var r = void 0;
  6185. return e.some(function(e) {
  6186. return t.some(function(t) {
  6187. if (r = i(e, t)) return !0
  6188. })
  6189. }), r
  6190. },
  6191. a = function(e, t) {
  6192. var r = e[0];
  6193. if (e[1].canPlaySource(t, i.options_[r.toLowerCase()])) return {
  6194. source: t,
  6195. tech: r
  6196. }
  6197. };
  6198. return (this.options_.sourceOrder ? n(e, r, (t = a, function(e, i) {
  6199. return t(i, e)
  6200. })) : n(r, e, a)) || !1
  6201. }, i.prototype.src = function(e) {
  6202. var t = this;
  6203. if (void 0 === e) return this.cache_.src || "";
  6204. var i = function e(t) {
  6205. if (Array.isArray(t)) {
  6206. var i = [];
  6207. t.forEach(function(t) {
  6208. t = e(t), Array.isArray(t) ? i = i.concat(t) : k(t) && i.push(t)
  6209. }), t = i
  6210. } else t = "string" == typeof t && t.trim() ? [Dr({
  6211. src: t
  6212. })] : k(t) && "string" == typeof t.src && t.src && t.src.trim() ? [Dr(t)] : [];
  6213. return t
  6214. }(e);
  6215. i.length ? (this.changingSrc_ = !0, this.cache_.sources = i, this.updateSourceCaches_(i[0]), Tr(this, i[0],
  6216. function(e, r) {
  6217. var n, a;
  6218. if (t.middleware_ = r, t.cache_.sources = i, t.updateSourceCaches_(e), t.src_(e)) return i.length >
  6219. 1 ? t.src(i.slice(1)) : (t.changingSrc_ = !1, t.setTimeout(function() {
  6220. this.error({
  6221. code: 4,
  6222. message: this.localize(this.options_.notSupportedMessage)
  6223. })
  6224. }, 0), void t.triggerReady());
  6225. n = r, a = t.tech_, n.forEach(function(e) {
  6226. return e.setTech && e.setTech(a)
  6227. })
  6228. })) : this.setTimeout(function() {
  6229. this.error({
  6230. code: 4,
  6231. message: this.localize(this.options_.notSupportedMessage)
  6232. })
  6233. }, 0)
  6234. }, i.prototype.src_ = function(e) {
  6235. var t, i, r = this,
  6236. n = this.selectSource([e]);
  6237. return !n || (t = n.tech, i = this.techName_, ze(t) !== ze(i) ? (this.changingSrc_ = !0, this.loadTech_(n
  6238. .tech, n.source), this.tech_.ready(function() {
  6239. r.changingSrc_ = !1
  6240. }), !1) : (this.ready(function() {
  6241. this.tech_.constructor.prototype.hasOwnProperty("setSource") ? this.techCall_("setSource", e) :
  6242. this.techCall_("src", e.src), this.changingSrc_ = !1
  6243. }, !0), !1))
  6244. }, i.prototype.load = function() {
  6245. this.techCall_("load")
  6246. }, i.prototype.reset = function() {
  6247. this.tech_ && this.tech_.clearTracks("text"), this.loadTech_(this.options_.techOrder[0], null), this
  6248. .techCall_("reset")
  6249. }, i.prototype.currentSources = function() {
  6250. var e = this.currentSource(),
  6251. t = [];
  6252. return 0 !== Object.keys(e).length && t.push(e), this.cache_.sources || t
  6253. }, i.prototype.currentSource = function() {
  6254. return this.cache_.source || {}
  6255. }, i.prototype.currentSrc = function() {
  6256. return this.currentSource() && this.currentSource().src || ""
  6257. }, i.prototype.currentType = function() {
  6258. return this.currentSource() && this.currentSource().type || ""
  6259. }, i.prototype.preload = function(e) {
  6260. return void 0 !== e ? (this.techCall_("setPreload", e), void(this.options_.preload = e)) : this.techGet_(
  6261. "preload")
  6262. }, i.prototype.autoplay = function(e) {
  6263. if (void 0 === e) return this.options_.autoplay || !1;
  6264. var t = void 0;
  6265. "string" == typeof e && /(any|play|muted)/.test(e) ? (this.options_.autoplay = e, this.manualAutoplay_(e),
  6266. t = !1) : this.options_.autoplay = !!e, t = t || this.options_.autoplay, this.tech_ && this.techCall_(
  6267. "setAutoplay", t)
  6268. }, i.prototype.playsinline = function(e) {
  6269. return void 0 !== e ? (this.techCall_("setPlaysinline", e), this.options_.playsinline = e, this) : this
  6270. .techGet_("playsinline")
  6271. }, i.prototype.loop = function(e) {
  6272. return void 0 !== e ? (this.techCall_("setLoop", e), void(this.options_.loop = e)) : this.techGet_("loop")
  6273. }, i.prototype.stretch = function(e) {
  6274. return void 0 !== e ? (this.techCall_("setStretch", e), this.options_.stretch = e, this) : this.techGet_(
  6275. "stretch", e)
  6276. }, i.prototype.fluent = function(e) {
  6277. return void 0 != e ? (this.techCall_("setFluent", e), this.options_.fluent = e, this) : this.techGet_(
  6278. "fluent", e)
  6279. }, i.prototype.poster = function(e) {
  6280. if (void 0 === e) return this.poster_;
  6281. e || (e = ""), e !== this.poster_ && (this.poster_ = e, this.techCall_("setPoster", e), this
  6282. .isPosterFromTech_ = !1, this.trigger("posterchange"))
  6283. }, i.prototype.handleTechPosterChange_ = function() {
  6284. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  6285. var e = this.tech_.poster() || "";
  6286. e !== this.poster_ && (this.poster_ = e, this.isPosterFromTech_ = !0, this.trigger("posterchange"))
  6287. }
  6288. }, i.prototype.controls = function(e) {
  6289. if (void 0 === e) return !!this.controls_;
  6290. e = !!e, this.controls_ !== e && (this.controls_ = e, this.usingNativeControls() && this.techCall_(
  6291. "setControls", e), this.controls_ ? (this.removeClass("vjs-controls-disabled"), this.addClass(
  6292. "vjs-controls-enabled"), this.trigger("controlsenabled"), this.usingNativeControls() || this
  6293. .addTechControlsListeners_()) : (this.removeClass("vjs-controls-enabled"), this.addClass(
  6294. "vjs-controls-disabled"), this.trigger("controlsdisabled"), this.usingNativeControls() || this
  6295. .removeTechControlsListeners_()))
  6296. }, i.prototype.usingNativeControls = function(e) {
  6297. if (void 0 === e) return !!this.usingNativeControls_;
  6298. e = !!e, this.usingNativeControls_ !== e && (this.usingNativeControls_ = e, this.usingNativeControls_ ? (
  6299. this.addClass("vjs-using-native-controls"), this.trigger("usingnativecontrols")) : (this.removeClass(
  6300. "vjs-using-native-controls"), this.trigger("usingcustomcontrols")))
  6301. }, i.prototype.error = function(e) {
  6302. return void 0 === e ? this.error_ || null : null === e ? (this.error_ = e, this.removeClass("vjs-error"),
  6303. void(this.errorDisplay && this.errorDisplay.close())) : (this.error_ = new Rt(e), this.addClass(
  6304. "vjs-error"), p.error("(CODE:" + this.error_.code + " " + Rt.errorTypes[this.error_.code] + ")", this
  6305. .error_.message, this.error_), void this.trigger("error"))
  6306. }, i.prototype.reportUserActivity = function(e) {
  6307. this.userActivity_ = !0
  6308. }, i.prototype.userActive = function(e) {
  6309. if (void 0 === e) return this.userActive_;
  6310. if ((e = !!e) !== this.userActive_) {
  6311. if (this.userActive_ = e, this.userActive_) return this.userActivity_ = !0, this.removeClass(
  6312. "vjs-user-inactive"), this.addClass("vjs-user-active"), void this.trigger("useractive");
  6313. this.tech_ && this.tech_.one("mousemove", function(e) {
  6314. e.stopPropagation(), e.preventDefault()
  6315. }), this.userActivity_ = !1, this.removeClass("vjs-user-active"), this.addClass("vjs-user-inactive"),
  6316. this.trigger("userinactive")
  6317. }
  6318. }, i.prototype.listenForUserActivity_ = function() {
  6319. var e = void 0,
  6320. t = void 0,
  6321. i = void 0,
  6322. r = De(this, this.reportUserActivity);
  6323. this.on("mousedown", function() {
  6324. r(), this.clearInterval(e), e = this.setInterval(r, 250)
  6325. }), this.on("mousemove", function(e) {
  6326. e.screenX === t && e.screenY === i || (t = e.screenX, i = e.screenY, r())
  6327. }), this.on("mouseup", function(t) {
  6328. r(), this.clearInterval(e)
  6329. }), this.on("keydown", r), this.on("keyup", r);
  6330. var n = void 0;
  6331. this.setInterval(function() {
  6332. if (this.userActivity_) {
  6333. this.userActivity_ = !1, this.userActive(!0), this.clearTimeout(n);
  6334. var e = this.options_.inactivityTimeout;
  6335. e <= 0 || (n = this.setTimeout(function() {
  6336. this.userActivity_ || this.userActive(!1)
  6337. }, e))
  6338. }
  6339. }, 250)
  6340. }, i.prototype.playbackRate = function(e) {
  6341. if (void 0 === e) return this.tech_ && this.tech_.featuresPlaybackRate ? this.cache_.lastPlaybackRate ||
  6342. this.techGet_("playbackRate") : 1;
  6343. this.techCall_("setPlaybackRate", e)
  6344. }, i.prototype.defaultPlaybackRate = function(e) {
  6345. return void 0 !== e ? this.techCall_("setDefaultPlaybackRate", e) : this.tech_ && this.tech_
  6346. .featuresPlaybackRate ? this.techGet_("defaultPlaybackRate") : 1
  6347. }, i.prototype.isAudio = function(e) {
  6348. if (void 0 === e) return !!this.isAudio_;
  6349. this.isAudio_ = !!e
  6350. }, i.prototype.addTextTrack = function(e, t, i) {
  6351. if (this.tech_) return this.tech_.addTextTrack(e, t, i)
  6352. }, i.prototype.addRemoteTextTrack = function(e, t) {
  6353. if (this.tech_) return this.tech_.addRemoteTextTrack(e, t)
  6354. }, i.prototype.removeRemoteTextTrack = function() {
  6355. var e = (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}).track,
  6356. t = void 0 === e ? arguments[0] : e;
  6357. if (this.tech_) return this.tech_.removeRemoteTextTrack(t)
  6358. }, i.prototype.getVideoPlaybackQuality = function() {
  6359. return this.techGet_("getVideoPlaybackQuality")
  6360. }, i.prototype.videoWidth = function() {
  6361. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0
  6362. }, i.prototype.videoHeight = function() {
  6363. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0
  6364. }, i.prototype.language = function(e) {
  6365. if (void 0 === e) return this.language_;
  6366. this.language_ = String(e).toLowerCase()
  6367. }, i.prototype.languages = function() {
  6368. return Ke(i.prototype.options_.languages, this.languages_)
  6369. }, i.prototype.toJSON = function() {
  6370. var e = Ke(this.options_),
  6371. t = e.tracks;
  6372. e.tracks = [];
  6373. for (var i = 0; i < t.length; i++) {
  6374. var r = t[i];
  6375. (r = Ke(r)).player = void 0, e.tracks[i] = r
  6376. }
  6377. return e
  6378. }, i.prototype.createModal = function(e, t) {
  6379. var i = this;
  6380. (t = t || {}).content = e || "";
  6381. var r = new Ut(this, t);
  6382. return this.addChild(r), r.on("dispose", function() {
  6383. i.removeChild(r)
  6384. }), r.open(), r
  6385. }, i.getTagSettings = function(e) {
  6386. var t = {
  6387. sources: [],
  6388. tracks: []
  6389. },
  6390. i = W(e),
  6391. r = i["data-setup"];
  6392. if (F(e, "vjs-fluid") && (i.fluid = !0), null !== r) {
  6393. var n = Ot(r || "{}"),
  6394. a = n[0],
  6395. s = n[1];
  6396. a && p.error(a), A(i, s)
  6397. }
  6398. if (A(t, i), e.hasChildNodes())
  6399. for (var o = e.childNodes, u = 0, l = o.length; u < l; u++) {
  6400. var d = o[u],
  6401. c = d.nodeName.toLowerCase();
  6402. "source" === c ? t.sources.push(W(d)) : "track" === c && t.tracks.push(W(d))
  6403. }
  6404. return t
  6405. }, i.prototype.flexNotSupported_ = function() {
  6406. var e = l.createElement("i");
  6407. return !("flexBasis" in e.style || "webkitFlexBasis" in e.style || "mozFlexBasis" in e.style ||
  6408. "msFlexBasis" in e.style || "msFlexOrder" in e.style)
  6409. }, i
  6410. }(Ye);
  6411. Ni.names.forEach(function(e) {
  6412. var t = Ni[e];
  6413. fa.prototype[t.getterName] = function() {
  6414. return this.tech_ ? this.tech_[t.getterName]() : (this[t.privateName] = this[t.privateName] || new t
  6415. .ListClass, this[t.privateName])
  6416. }
  6417. }), fa.players = {};
  6418. var pa = n.navigator;
  6419. fa.prototype.options_ = {
  6420. techOrder: _r.defaultTechOrder_,
  6421. html5: {},
  6422. flash: {},
  6423. inactivityTimeout: 2e3,
  6424. playbackRates: [],
  6425. children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "controlBar",
  6426. "errorDisplay", "textTrackSettings", "resizeManager"
  6427. ],
  6428. language: pa && (pa.languages && pa.languages[0] || pa.userLanguage || pa.language) || "en",
  6429. languages: {},
  6430. notSupportedMessage: "No compatible source was found for this media."
  6431. }, ["ended", "seeking", "seekable", "networkState", "readyState"].forEach(function(e) {
  6432. fa.prototype[e] = function() {
  6433. return this.techGet_(e)
  6434. }
  6435. }), ca.forEach(function(e) {
  6436. fa.prototype["handleTech" + ze(e) + "_"] = function() {
  6437. return this.trigger(e)
  6438. }
  6439. }), Ye.registerComponent("Player", fa);
  6440. var ma = {},
  6441. ga = function(e) {
  6442. return ma.hasOwnProperty(e)
  6443. },
  6444. va = function(e) {
  6445. return ga(e) ? ma[e] : void 0
  6446. },
  6447. ya = function(e, t) {
  6448. e.activePlugins_ = e.activePlugins_ || {}, e.activePlugins_[t] = !0
  6449. },
  6450. _a = function(e, t, i) {
  6451. var r = (i ? "before" : "") + "pluginsetup";
  6452. e.trigger(r, t), e.trigger(r + ":" + t.name, t)
  6453. },
  6454. ba = function(e, t) {
  6455. return t.prototype.name = e,
  6456. function() {
  6457. _a(this, {
  6458. name: e,
  6459. plugin: t,
  6460. instance: null
  6461. }, !0);
  6462. for (var i = arguments.length, r = Array(i), n = 0; n < i; n++) r[n] = arguments[n];
  6463. var a = new(Function.prototype.bind.apply(t, [null].concat([this].concat(r))));
  6464. return this[e] = function() {
  6465. return a
  6466. }, _a(this, a.getEventHash()), a
  6467. }
  6468. },
  6469. wa = function() {
  6470. function e(t) {
  6471. if (y(this, e), this.constructor === e) throw new Error(
  6472. "Plugin must be sub-classed; not directly instantiated.");
  6473. this.player = t, We(this), delete this.trigger, Xe(this, this.constructor.defaultState), ya(t, this.name),
  6474. this.dispose = De(this, this.dispose), t.on("dispose", this.dispose)
  6475. }
  6476. return e.prototype.version = function() {
  6477. return this.constructor.VERSION
  6478. }, e.prototype.getEventHash = function() {
  6479. var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
  6480. return e.name = this.name, e.plugin = this.constructor, e.instance = this, e
  6481. }, e.prototype.trigger = function(e) {
  6482. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  6483. return Ee(this.eventBusEl_, e, this.getEventHash(t))
  6484. }, e.prototype.handleStateChanged = function(e) {}, e.prototype.dispose = function() {
  6485. var e = this.name,
  6486. t = this.player;
  6487. this.trigger("dispose"), this.off(), t.off("dispose", this.dispose), t.activePlugins_[e] = !1, this.player =
  6488. this.state = null, t[e] = ba(e, ma[e])
  6489. }, e.isBasic = function(t) {
  6490. var i = "string" == typeof t ? va(t) : t;
  6491. return "function" == typeof i && !e.prototype.isPrototypeOf(i.prototype)
  6492. }, e.registerPlugin = function(t, i) {
  6493. if ("string" != typeof t) throw new Error('Illegal plugin name, "' + t + '", must be a string, was ' + (
  6494. void 0 === t ? "undefined" : v(t)) + ".");
  6495. if (ga(t)) p.warn('A plugin named "' + t +
  6496. '" already exists. You may want to avoid re-registering plugins!');
  6497. else if (fa.prototype.hasOwnProperty(t)) throw new Error('Illegal plugin name, "' + t +
  6498. '", cannot share a name with an existing player method!');
  6499. if ("function" != typeof i) throw new Error('Illegal plugin for "' + t + '", must be a function, was ' + (
  6500. void 0 === i ? "undefined" : v(i)) + ".");
  6501. return ma[t] = i, "plugin" !== t && (e.isBasic(i) ? fa.prototype[t] = function(e, t) {
  6502. var i = function() {
  6503. _a(this, {
  6504. name: e,
  6505. plugin: t,
  6506. instance: null
  6507. }, !0);
  6508. var i = t.apply(this, arguments);
  6509. return ya(this, e), _a(this, {
  6510. name: e,
  6511. plugin: t,
  6512. instance: i
  6513. }), i
  6514. };
  6515. return Object.keys(t).forEach(function(e) {
  6516. i[e] = t[e]
  6517. }), i
  6518. }(t, i) : fa.prototype[t] = ba(t, i)), i
  6519. }, e.deregisterPlugin = function(e) {
  6520. if ("plugin" === e) throw new Error("Cannot de-register base plugin.");
  6521. ga(e) && (delete ma[e], delete fa.prototype[e])
  6522. }, e.getPlugins = function() {
  6523. var e = void 0;
  6524. return (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Object.keys(ma)).forEach(function(
  6525. t) {
  6526. var i = va(t);
  6527. i && ((e = e || {})[t] = i)
  6528. }), e
  6529. }, e.getPluginVersion = function(e) {
  6530. var t = va(e);
  6531. return t && t.VERSION || ""
  6532. }, e
  6533. }();
  6534. wa.getPlugin = va, wa.BASE_PLUGIN_NAME = "plugin", wa.registerPlugin("plugin", wa), fa.prototype.usingPlugin =
  6535. function(e) {
  6536. return !!this.activePlugins_ && !0 === this.activePlugins_[e]
  6537. }, fa.prototype.hasPlugin = function(e) {
  6538. return !!ga(e)
  6539. };
  6540. var Ea = function(e) {
  6541. return 0 === e.indexOf("#") ? e.slice(1) : e
  6542. };
  6543. function Ta(e, t, i) {
  6544. var r = Ta.getPlayer(e);
  6545. if (r) return t && p.warn('Player "' + e + '" is already initialised. Options will not be applied.'), i && r
  6546. .ready(i), r;
  6547. var n = "string" == typeof e ? ae("#" + Ea(e)) : e;
  6548. if (!L(n)) throw new TypeError("The element or ID supplied is not valid. (videojs)");
  6549. l.body.contains(n) || p.warn("The element supplied is not included in the DOM"), t = t || {}, Ta.hooks(
  6550. "beforesetup").forEach(function(e) {
  6551. var i = e(n, Ke(t));
  6552. k(i) && !Array.isArray(i) ? t = Ke(t, i) : p.error("please return an object in beforesetup hooks")
  6553. });
  6554. var a = Ye.getComponent("Player");
  6555. return r = new a(n, t, i), Ta.hooks("setup").forEach(function(e) {
  6556. return e(r)
  6557. }), r
  6558. }
  6559. if (Ta.hooks_ = {}, Ta.hooks = function(e, t) {
  6560. return Ta.hooks_[e] = Ta.hooks_[e] || [], t && (Ta.hooks_[e] = Ta.hooks_[e].concat(t)), Ta.hooks_[e]
  6561. }, Ta.hook = function(e, t) {
  6562. Ta.hooks(e, t)
  6563. }, Ta.hookOnce = function(e, t) {
  6564. Ta.hooks(e, [].concat(t).map(function(t) {
  6565. return function i() {
  6566. return Ta.removeHook(e, i), t.apply(void 0, arguments)
  6567. }
  6568. }))
  6569. }, Ta.removeHook = function(e, t) {
  6570. var i = Ta.hooks(e).indexOf(t);
  6571. return !(i <= -1) && (Ta.hooks_[e] = Ta.hooks_[e].slice(), Ta.hooks_[e].splice(i, 1), !0)
  6572. }, !0 !== n.VIDEOJS_NO_DYNAMIC_STYLE && I()) {
  6573. var Sa = ae(".vjs-styles-defaults");
  6574. if (!Sa) {
  6575. Sa = Oe("vjs-styles-defaults");
  6576. var Aa = ae("head");
  6577. Aa && Aa.insertBefore(Sa, Aa.firstChild), Ce(Sa,
  6578. "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid {\n padding-top: 56.25%\n }\n "
  6579. )
  6580. }
  6581. }
  6582. Me(1, Ta), Ta.VERSION = e, Ta.options = fa.prototype.options_, Ta.getPlayers = function() {
  6583. return fa.players
  6584. }, Ta.getPlayer = function(e) {
  6585. var t = fa.players,
  6586. i = void 0;
  6587. if ("string" == typeof e) {
  6588. var r = Ea(e),
  6589. n = t[r];
  6590. if (n) return n;
  6591. i = ae("#" + r)
  6592. } else i = e;
  6593. if (L(i)) {
  6594. var a = i,
  6595. s = a.player,
  6596. o = a.playerId;
  6597. if (s || t[o]) return s || t[o]
  6598. }
  6599. }, Ta.getAllPlayers = function() {
  6600. return Object.keys(fa.players).map(function(e) {
  6601. return fa.players[e]
  6602. }).filter(Boolean)
  6603. }, Ta.players = fa.players, Ta.getComponent = Ye.getComponent, Ta.registerComponent = function(e, t) {
  6604. _r.isTech(t) && p.warn("The " + e +
  6605. " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"
  6606. ), Ye.registerComponent.call(Ye, e, t)
  6607. }, Ta.getTech = _r.getTech, Ta.registerTech = _r.registerTech, Ta.use = function(e, t) {
  6608. br[e] = br[e] || [], br[e].push(t)
  6609. }, Object.defineProperty(Ta, "middleware", {
  6610. value: {},
  6611. writeable: !1,
  6612. enumerable: !0
  6613. }), Object.defineProperty(Ta.middleware, "TERMINATOR", {
  6614. value: Er,
  6615. writeable: !1,
  6616. enumerable: !0
  6617. }), Ta.browser = gt, Ta.TOUCH_ENABLED = mt, Ta.extend = function(e) {
  6618. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  6619. i = function() {
  6620. e.apply(this, arguments)
  6621. },
  6622. r = {};
  6623. for (var n in "object" === (void 0 === t ? "undefined" : v(t)) ? (t.constructor !== Object.prototype
  6624. .constructor && (i = t.constructor), r = t) : "function" == typeof t && (i = t),
  6625. function(e, t) {
  6626. if ("function" != typeof t && null !== t) throw new TypeError(
  6627. "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t)));
  6628. e.prototype = Object.create(t && t.prototype, {
  6629. constructor: {
  6630. value: e,
  6631. enumerable: !1,
  6632. writable: !0,
  6633. configurable: !0
  6634. }
  6635. }), t && (e.super_ = t)
  6636. }(i, e), r) r.hasOwnProperty(n) && (i.prototype[n] = r[n]);
  6637. return i
  6638. }, Ta.mergeOptions = Ke, Ta.bind = De, Ta.registerPlugin = wa.registerPlugin, Ta.deregisterPlugin = wa
  6639. .deregisterPlugin, Ta.plugin = function(e, t) {
  6640. return p.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"), wa.registerPlugin(e, t)
  6641. }, Ta.getPlugins = wa.getPlugins, Ta.getPlugin = wa.getPlugin, Ta.getPluginVersion = wa.getPluginVersion, Ta
  6642. .addLanguage = function(e, t) {
  6643. var i;
  6644. return e = ("" + e).toLowerCase(), Ta.options.languages = Ke(Ta.options.languages, ((i = {})[e] = t, i)), Ta
  6645. .options.languages[e]
  6646. }, Ta.log = p, Ta.createTimeRange = Ta.createTimeRanges = _t, Ta.formatTime = Xr, Ta.setFormatTime = function(e) {
  6647. qr = e
  6648. }, Ta.resetFormatTime = function() {
  6649. qr = Wr
  6650. }, Ta.parseUrl = Jt, Ta.isCrossOrigin = ei, Ta.EventTarget = xe, Ta.on = be, Ta.one = Te, Ta.off = we, Ta
  6651. .trigger = Ee, Ta.xhr = Ti, Ta.TextTrack = Oi, Ta.AudioTrack = Ci, Ta.VideoTrack = Di, ["isEl", "isTextNode",
  6652. "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl",
  6653. "appendContent", "insertContent"
  6654. ].forEach(function(e) {
  6655. Ta[e] = function() {
  6656. return p.warn("videojs." + e + "() is deprecated; use videojs.dom." + e + "() instead"), oe[e].apply(null,
  6657. arguments)
  6658. }
  6659. }), Ta.computedStyle = M, Ta.dom = oe, Ta.url = ti;
  6660. var ka = i(function(e, t) {
  6661. var i, r, n, a, s;
  6662. i = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/, r =
  6663. /^([^\/?#]*)(.*)$/, n = /(?:\/|^)\.(?=\/)/g, a = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g, s = {
  6664. buildAbsoluteURL: function(e, t, i) {
  6665. if (i = i || {}, e = e.trim(), !(t = t.trim())) {
  6666. if (!i.alwaysNormalize) return e;
  6667. var n = s.parseURL(e);
  6668. if (!n) throw new Error("Error trying to parse base URL.");
  6669. return n.path = s.normalizePath(n.path), s.buildURLFromParts(n)
  6670. }
  6671. var a = s.parseURL(t);
  6672. if (!a) throw new Error("Error trying to parse relative URL.");
  6673. if (a.scheme) return i.alwaysNormalize ? (a.path = s.normalizePath(a.path), s.buildURLFromParts(a)) :
  6674. t;
  6675. var o = s.parseURL(e);
  6676. if (!o) throw new Error("Error trying to parse base URL.");
  6677. if (!o.netLoc && o.path && "/" !== o.path[0]) {
  6678. var u = r.exec(o.path);
  6679. o.netLoc = u[1], o.path = u[2]
  6680. }
  6681. o.netLoc && !o.path && (o.path = "/");
  6682. var l = {
  6683. scheme: o.scheme,
  6684. netLoc: a.netLoc,
  6685. path: null,
  6686. params: a.params,
  6687. query: a.query,
  6688. fragment: a.fragment
  6689. };
  6690. if (!a.netLoc && (l.netLoc = o.netLoc, "/" !== a.path[0]))
  6691. if (a.path) {
  6692. var d = o.path,
  6693. c = d.substring(0, d.lastIndexOf("/") + 1) + a.path;
  6694. l.path = s.normalizePath(c)
  6695. } else l.path = o.path, a.params || (l.params = o.params, a.query || (l.query = o.query));
  6696. return null === l.path && (l.path = i.alwaysNormalize ? s.normalizePath(a.path) : a.path), s
  6697. .buildURLFromParts(l)
  6698. },
  6699. parseURL: function(e) {
  6700. var t = i.exec(e);
  6701. return t ? {
  6702. scheme: t[1] || "",
  6703. netLoc: t[2] || "",
  6704. path: t[3] || "",
  6705. params: t[4] || "",
  6706. query: t[5] || "",
  6707. fragment: t[6] || ""
  6708. } : null
  6709. },
  6710. normalizePath: function(e) {
  6711. for (e = e.split("").reverse().join("").replace(n, ""); e.length !== (e = e.replace(a, "")).length;);
  6712. return e.split("").reverse().join("")
  6713. },
  6714. buildURLFromParts: function(e) {
  6715. return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment
  6716. }
  6717. }, e.exports = s
  6718. }),
  6719. Ra = function(e, t) {
  6720. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  6721. },
  6722. Ma = Object.assign || function(e) {
  6723. for (var t = 1; t < arguments.length; t++) {
  6724. var i = arguments[t];
  6725. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  6726. }
  6727. return e
  6728. },
  6729. Oa = function(e, t) {
  6730. if ("function" != typeof t && null !== t) throw new TypeError(
  6731. "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t)));
  6732. e.prototype = Object.create(t && t.prototype, {
  6733. constructor: {
  6734. value: e,
  6735. enumerable: !1,
  6736. writable: !0,
  6737. configurable: !0
  6738. }
  6739. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  6740. },
  6741. Ca = function(e, t) {
  6742. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  6743. return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t
  6744. },
  6745. Da = function() {
  6746. function e() {
  6747. Ra(this, e), this.listeners = {}
  6748. }
  6749. return e.prototype.on = function(e, t) {
  6750. this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
  6751. }, e.prototype.off = function(e, t) {
  6752. if (!this.listeners[e]) return !1;
  6753. var i = this.listeners[e].indexOf(t);
  6754. return this.listeners[e].splice(i, 1), i > -1
  6755. }, e.prototype.trigger = function(e) {
  6756. var t = this.listeners[e],
  6757. i = void 0,
  6758. r = void 0,
  6759. n = void 0;
  6760. if (t)
  6761. if (2 === arguments.length)
  6762. for (r = t.length, i = 0; i < r; ++i) t[i].call(this, arguments[1]);
  6763. else
  6764. for (n = Array.prototype.slice.call(arguments, 1), r = t.length, i = 0; i < r; ++i) t[i].apply(this, n)
  6765. }, e.prototype.dispose = function() {
  6766. this.listeners = {}
  6767. }, e.prototype.pipe = function(e) {
  6768. this.on("data", function(t) {
  6769. e.push(t)
  6770. })
  6771. }, e
  6772. }(),
  6773. Ia = function(e) {
  6774. function t() {
  6775. Ra(this, t);
  6776. var i = Ca(this, e.call(this));
  6777. return i.buffer = "", i
  6778. }
  6779. return Oa(t, e), t.prototype.push = function(e) {
  6780. var t = void 0;
  6781. for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf("\n")) this.trigger(
  6782. "data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1)
  6783. }, t
  6784. }(Da),
  6785. La = function(e) {
  6786. for (var t = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), i = {}, r = t.length, n =
  6787. void 0; r--;) "" !== t[r] && ((n = /([^=]*)=(.*)/.exec(t[r]).slice(1))[0] = n[0].replace(/^\s+|\s+$/g, ""), n[
  6788. 1] = n[1].replace(/^\s+|\s+$/g, ""), n[1] = n[1].replace(/^['"](.*)['"]$/g, "$1"), i[n[0]] = n[1]);
  6789. return i
  6790. },
  6791. xa = function(e) {
  6792. function t() {
  6793. Ra(this, t);
  6794. var i = Ca(this, e.call(this));
  6795. return i.customParsers = [], i
  6796. }
  6797. return Oa(t, e), t.prototype.push = function(e) {
  6798. var t = void 0,
  6799. i = void 0;
  6800. if (0 !== (e = e.replace(/^[\u0000\s]+|[\u0000\s]+$/g, "")).length)
  6801. if ("#" === e[0]) {
  6802. for (var r = 0; r < this.customParsers.length; r++)
  6803. if (this.customParsers[r].call(this, e)) return;
  6804. if (0 === e.indexOf("#EXT"))
  6805. if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) this.trigger("data", {
  6806. type: "tag",
  6807. tagType: "m3u"
  6808. });
  6809. else {
  6810. if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = {
  6811. type: "tag",
  6812. tagType: "inf"
  6813. }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]), void this.trigger("data",
  6814. i);
  6815. if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = {
  6816. type: "tag",
  6817. tagType: "targetduration"
  6818. }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i);
  6819. if (t = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return i = {
  6820. type: "tag",
  6821. tagType: "totalduration"
  6822. }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i);
  6823. if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = {
  6824. type: "tag",
  6825. tagType: "version"
  6826. }, t[1] && (i.version = parseInt(t[1], 10)), void this.trigger("data", i);
  6827. if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
  6828. type: "tag",
  6829. tagType: "media-sequence"
  6830. }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i);
  6831. if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
  6832. type: "tag",
  6833. tagType: "discontinuity-sequence"
  6834. }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i);
  6835. if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = {
  6836. type: "tag",
  6837. tagType: "playlist-type"
  6838. }, t[1] && (i.playlistType = t[1]), void this.trigger("data", i);
  6839. if (t = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return i = {
  6840. type: "tag",
  6841. tagType: "byterange"
  6842. }, t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[2], 10)), void this
  6843. .trigger("data", i);
  6844. if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = {
  6845. type: "tag",
  6846. tagType: "allow-cache"
  6847. }, t[1] && (i.allowed = !/NO/.test(t[1])), void this.trigger("data", i);
  6848. if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) {
  6849. if (i = {
  6850. type: "tag",
  6851. tagType: "map"
  6852. }, t[1]) {
  6853. var n = La(t[1]);
  6854. if (n.URI && (i.uri = n.URI), n.BYTERANGE) {
  6855. var a = n.BYTERANGE.split("@"),
  6856. s = a[0],
  6857. o = a[1];
  6858. i.byterange = {}, s && (i.byterange.length = parseInt(s, 10)), o && (i.byterange.offset =
  6859. parseInt(o, 10))
  6860. }
  6861. }
  6862. this.trigger("data", i)
  6863. } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) {
  6864. if (i = {
  6865. type: "tag",
  6866. tagType: "stream-inf"
  6867. }, t[1]) {
  6868. if (i.attributes = La(t[1]), i.attributes.RESOLUTION) {
  6869. var u = i.attributes.RESOLUTION.split("x"),
  6870. l = {};
  6871. u[0] && (l.width = parseInt(u[0], 10)), u[1] && (l.height = parseInt(u[1], 10)), i.attributes
  6872. .RESOLUTION = l
  6873. }
  6874. i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes.BANDWIDTH, 10)), i
  6875. .attributes["PROGRAM-ID"] && (i.attributes["PROGRAM-ID"] = parseInt(i.attributes[
  6876. "PROGRAM-ID"], 10))
  6877. }
  6878. this.trigger("data", i)
  6879. } else {
  6880. if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = {
  6881. type: "tag",
  6882. tagType: "media"
  6883. }, t[1] && (i.attributes = La(t[1])), void this.trigger("data", i);
  6884. if (t = /^#EXT-X-ENDLIST/.exec(e)) this.trigger("data", {
  6885. type: "tag",
  6886. tagType: "endlist"
  6887. });
  6888. else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) this.trigger("data", {
  6889. type: "tag",
  6890. tagType: "discontinuity"
  6891. });
  6892. else {
  6893. if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = {
  6894. type: "tag",
  6895. tagType: "program-date-time"
  6896. }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])), void this.trigger(
  6897. "data", i);
  6898. if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = {
  6899. type: "tag",
  6900. tagType: "key"
  6901. }, t[1] && (i.attributes = La(t[1]), i.attributes.IV && ("0x" === i.attributes.IV.substring(
  6902. 0, 2).toLowerCase() && (i.attributes.IV = i.attributes.IV.substring(2)), i.attributes
  6903. .IV = i.attributes.IV.match(/.{8}/g), i.attributes.IV[0] = parseInt(i.attributes.IV[0],
  6904. 16), i.attributes.IV[1] = parseInt(i.attributes.IV[1], 16), i.attributes.IV[2] =
  6905. parseInt(i.attributes.IV[2], 16), i.attributes.IV[3] = parseInt(i.attributes.IV[3], 16),
  6906. i.attributes.IV = new Uint32Array(i.attributes.IV))), void this.trigger("data", i);
  6907. if (t = /^#EXT-X-START:?(.*)$/.exec(e)) return i = {
  6908. type: "tag",
  6909. tagType: "start"
  6910. }, t[1] && (i.attributes = La(t[1]), i.attributes["TIME-OFFSET"] = parseFloat(i.attributes[
  6911. "TIME-OFFSET"]), i.attributes.PRECISE = /YES/.test(i.attributes.PRECISE)), void this
  6912. .trigger("data", i);
  6913. if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = {
  6914. type: "tag",
  6915. tagType: "cue-out-cont"
  6916. }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i);
  6917. if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = {
  6918. type: "tag",
  6919. tagType: "cue-out"
  6920. }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i);
  6921. if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = {
  6922. type: "tag",
  6923. tagType: "cue-in"
  6924. }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i);
  6925. this.trigger("data", {
  6926. type: "tag",
  6927. data: e.slice(4)
  6928. })
  6929. }
  6930. }
  6931. }
  6932. else this.trigger("data", {
  6933. type: "comment",
  6934. text: e.slice(1)
  6935. })
  6936. } else this.trigger("data", {
  6937. type: "uri",
  6938. uri: e
  6939. })
  6940. }, t.prototype.addParser = function(e) {
  6941. var t = this,
  6942. i = e.expression,
  6943. r = e.customType,
  6944. n = e.dataParser,
  6945. a = e.segment;
  6946. "function" != typeof n && (n = function(e) {
  6947. return e
  6948. }), this.customParsers.push(function(e) {
  6949. if (i.exec(e)) return t.trigger("data", {
  6950. type: "custom",
  6951. data: n(e),
  6952. customType: r,
  6953. segment: a
  6954. }), !0
  6955. })
  6956. }, t
  6957. }(Da),
  6958. Pa = function(e) {
  6959. function t() {
  6960. Ra(this, t);
  6961. var i = Ca(this, e.call(this));
  6962. i.lineStream = new Ia, i.parseStream = new xa, i.lineStream.pipe(i.parseStream);
  6963. var r = i,
  6964. n = [],
  6965. a = {},
  6966. s = void 0,
  6967. o = void 0,
  6968. u = {
  6969. AUDIO: {},
  6970. VIDEO: {},
  6971. "CLOSED-CAPTIONS": {},
  6972. SUBTITLES: {}
  6973. },
  6974. l = 0;
  6975. return i.manifest = {
  6976. allowCache: !0,
  6977. discontinuityStarts: [],
  6978. segments: []
  6979. }, i.parseStream.on("data", function(e) {
  6980. var t = void 0,
  6981. i = void 0;
  6982. ({
  6983. tag: function() {
  6984. (({
  6985. "allow-cache": function() {
  6986. this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger("info", {
  6987. message: "defaulting allowCache to YES"
  6988. }), this.manifest.allowCache = !0)
  6989. },
  6990. byterange: function() {
  6991. var t = {};
  6992. "length" in e && (a.byterange = t, t.length = e.length, "offset" in e || (this
  6993. .trigger("info", {
  6994. message: "defaulting offset to zero"
  6995. }), e.offset = 0)), "offset" in e && (a.byterange = t, t.offset = e.offset)
  6996. },
  6997. endlist: function() {
  6998. this.manifest.endList = !0
  6999. },
  7000. inf: function() {
  7001. "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this.trigger(
  7002. "info", {
  7003. message: "defaulting media sequence to zero"
  7004. })), "discontinuitySequence" in this.manifest || (this.manifest
  7005. .discontinuitySequence = 0, this.trigger("info", {
  7006. message: "defaulting discontinuity sequence to zero"
  7007. })), e.duration > 0 && (a.duration = e.duration), 0 === e.duration && (a
  7008. .duration = .01, this.trigger("info", {
  7009. message: "updating zero segment duration to a small value"
  7010. })), this.manifest.segments = n
  7011. },
  7012. key: function() {
  7013. e.attributes ? "NONE" !== e.attributes.METHOD ? e.attributes.URI ? (e.attributes
  7014. .METHOD || this.trigger("warn", {
  7015. message: "defaulting key method to AES-128"
  7016. }), o = {
  7017. method: e.attributes.METHOD || "AES-128",
  7018. uri: e.attributes.URI
  7019. }, void 0 !== e.attributes.IV && (o.iv = e.attributes.IV)) : this.trigger(
  7020. "warn", {
  7021. message: "ignoring key declaration without URI"
  7022. }) : o = null : this.trigger("warn", {
  7023. message: "ignoring key declaration without attribute list"
  7024. })
  7025. },
  7026. "media-sequence": function() {
  7027. isFinite(e.number) ? this.manifest.mediaSequence = e.number : this.trigger("warn", {
  7028. message: "ignoring invalid media sequence: " + e.number
  7029. })
  7030. },
  7031. "discontinuity-sequence": function() {
  7032. isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, l = e.number) :
  7033. this.trigger("warn", {
  7034. message: "ignoring invalid discontinuity sequence: " + e.number
  7035. })
  7036. },
  7037. "playlist-type": function() {
  7038. /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e.playlistType : this
  7039. .trigger("warn", {
  7040. message: "ignoring unknown playlist type: " + e.playlist
  7041. })
  7042. },
  7043. map: function() {
  7044. s = {}, e.uri && (s.uri = e.uri), e.byterange && (s.byterange = e.byterange)
  7045. },
  7046. "stream-inf": function() {
  7047. this.manifest.playlists = n, this.manifest.mediaGroups = this.manifest.mediaGroups ||
  7048. u, e.attributes ? (a.attributes || (a.attributes = {}), Ma(a.attributes, e
  7049. .attributes)) : this.trigger("warn", {
  7050. message: "ignoring empty stream-inf attributes"
  7051. })
  7052. },
  7053. media: function() {
  7054. if (this.manifest.mediaGroups = this.manifest.mediaGroups || u, e.attributes && e
  7055. .attributes.TYPE && e.attributes["GROUP-ID"] && e.attributes.NAME) {
  7056. var r = this.manifest.mediaGroups[e.attributes.TYPE];
  7057. r[e.attributes["GROUP-ID"]] = r[e.attributes["GROUP-ID"]] || {}, t = r[e.attributes[
  7058. "GROUP-ID"]], (i = {
  7059. default: /yes/i.test(e.attributes.DEFAULT)
  7060. }).default ? i.autoselect = !0 : i.autoselect = /yes/i.test(e.attributes
  7061. .AUTOSELECT), e.attributes.LANGUAGE && (i.language = e.attributes.LANGUAGE), e
  7062. .attributes.URI && (i.uri = e.attributes.URI), e.attributes["INSTREAM-ID"] && (i
  7063. .instreamId = e.attributes["INSTREAM-ID"]), e.attributes.CHARACTERISTICS && (i
  7064. .characteristics = e.attributes.CHARACTERISTICS), e.attributes.FORCED && (i
  7065. .forced = /yes/i.test(e.attributes.FORCED)), t[e.attributes.NAME] = i
  7066. } else this.trigger("warn", {
  7067. message: "ignoring incomplete or missing media group"
  7068. })
  7069. },
  7070. discontinuity: function() {
  7071. l += 1, a.discontinuity = !0, this.manifest.discontinuityStarts.push(n.length)
  7072. },
  7073. "program-date-time": function() {
  7074. void 0 === this.manifest.dateTimeString && (this.manifest.dateTimeString = e
  7075. .dateTimeString, this.manifest.dateTimeObject = e.dateTimeObject), a
  7076. .dateTimeString = e.dateTimeString, a.dateTimeObject = e.dateTimeObject
  7077. },
  7078. targetduration: function() {
  7079. !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
  7080. message: "ignoring invalid target duration: " + e.duration
  7081. }) : this.manifest.targetDuration = e.duration
  7082. },
  7083. totalduration: function() {
  7084. !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
  7085. message: "ignoring invalid total duration: " + e.duration
  7086. }) : this.manifest.totalDuration = e.duration
  7087. },
  7088. start: function() {
  7089. e.attributes && !isNaN(e.attributes["TIME-OFFSET"]) ? this.manifest.start = {
  7090. timeOffset: e.attributes["TIME-OFFSET"],
  7091. precise: e.attributes.PRECISE
  7092. } : this.trigger("warn", {
  7093. message: "ignoring start declaration without appropriate attribute list"
  7094. })
  7095. },
  7096. "cue-out": function() {
  7097. a.cueOut = e.data
  7098. },
  7099. "cue-out-cont": function() {
  7100. a.cueOutCont = e.data
  7101. },
  7102. "cue-in": function() {
  7103. a.cueIn = e.data
  7104. }
  7105. })[e.tagType] || function() {}).call(r)
  7106. },
  7107. uri: function() {
  7108. a.uri = e.uri, n.push(a), !this.manifest.targetDuration || "duration" in a || (this.trigger(
  7109. "warn", {
  7110. message: "defaulting segment duration to the target duration"
  7111. }), a.duration = this.manifest.targetDuration), o && (a.key = o), a.timeline = l, s && (a
  7112. .map = s), a = {}
  7113. },
  7114. comment: function() {},
  7115. custom: function() {
  7116. e.segment ? (a.custom = a.custom || {}, a.custom[e.customType] = e.data) : (this.manifest
  7117. .custom = this.manifest.custom || {}, this.manifest.custom[e.customType] = e.data)
  7118. }
  7119. })[e.type].call(r)
  7120. }), i
  7121. }
  7122. return Oa(t, e), t.prototype.push = function(e) {
  7123. this.lineStream.push(e)
  7124. }, t.prototype.end = function() {
  7125. this.lineStream.push("\n")
  7126. }, t.prototype.addParser = function(e) {
  7127. this.parseStream.addParser(e)
  7128. }, t
  7129. }(Da),
  7130. Ua = function(e) {
  7131. var t, i = e.attributes,
  7132. r = e.segments,
  7133. n = {
  7134. attributes: (t = {
  7135. NAME: i.id,
  7136. AUDIO: "audio",
  7137. SUBTITLES: "subs",
  7138. RESOLUTION: {
  7139. width: i.width,
  7140. height: i.height
  7141. },
  7142. CODECS: i.codecs,
  7143. BANDWIDTH: i.bandwidth
  7144. }, t["PROGRAM-ID"] = 1, t),
  7145. uri: "",
  7146. endList: "static" === (i.type || "static"),
  7147. timeline: i.periodIndex,
  7148. resolvedUri: "",
  7149. targetDuration: i.duration,
  7150. segments: r,
  7151. mediaSequence: r.length ? r[0].number : 1
  7152. };
  7153. return i.contentProtection && (n.contentProtection = i.contentProtection), n
  7154. },
  7155. Na = "function" == typeof Symbol && "symbol" === v(Symbol.iterator) ? function(e) {
  7156. return void 0 === e ? "undefined" : v(e)
  7157. } : function(e) {
  7158. return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" :
  7159. void 0 === e ? "undefined" : v(e)
  7160. },
  7161. Ba = function(e) {
  7162. return !!e && "object" === (void 0 === e ? "undefined" : Na(e))
  7163. },
  7164. Fa = function e() {
  7165. for (var t = arguments.length, i = Array(t), r = 0; r < t; r++) i[r] = arguments[r];
  7166. return i.reduce(function(t, i) {
  7167. return Object.keys(i).forEach(function(r) {
  7168. Array.isArray(t[r]) && Array.isArray(i[r]) ? t[r] = t[r].concat(i[r]) : Ba(t[r]) && Ba(i[r]) ? t[
  7169. r] = e(t[r], i[r]) : t[r] = i[r]
  7170. }), t
  7171. }, {})
  7172. },
  7173. ja = function(e, t) {
  7174. return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = ka.buildAbsoluteURL(n.location.href, e)), ka
  7175. .buildAbsoluteURL(e, t))
  7176. },
  7177. Ha = function(e) {
  7178. var t = e.baseUrl,
  7179. i = void 0 === t ? "" : t,
  7180. r = e.source,
  7181. n = void 0 === r ? "" : r,
  7182. a = e.range,
  7183. s = void 0 === a ? "" : a,
  7184. o = {
  7185. uri: n,
  7186. resolvedUri: ja(i || "", n)
  7187. };
  7188. if (s) {
  7189. var u = s.split("-"),
  7190. l = parseInt(u[0], 10),
  7191. d = parseInt(u[1], 10);
  7192. o.byterange = {
  7193. length: d - l,
  7194. offset: l
  7195. }
  7196. }
  7197. return o
  7198. },
  7199. Ga = function(e, t, i) {
  7200. var r = e.NOW,
  7201. n = e.clientOffset,
  7202. a = e.availabilityStartTime,
  7203. s = e.timescale,
  7204. o = void 0 === s ? 1 : s,
  7205. u = e.start,
  7206. l = void 0 === u ? 0 : u,
  7207. d = e.minimumUpdatePeriod,
  7208. c = (r + n) / 1e3 + (void 0 === d ? 0 : d) - (a + l);
  7209. return Math.ceil((c * o - t) / i)
  7210. },
  7211. Va = function(e, t) {
  7212. for (var i = e.type, r = void 0 === i ? "static" : i, n = e.minimumUpdatePeriod, a = void 0 === n ? 0 : n, s = e
  7213. .media, o = void 0 === s ? "" : s, u = e.sourceDuration, l = e.timescale, d = void 0 === l ? 1 : l, c = e
  7214. .startNumber, h = void 0 === c ? 1 : c, f = e.periodIndex, p = [], m = -1, g = 0; g < t.length; g++) {
  7215. var v = t[g],
  7216. y = v.d,
  7217. _ = v.r || 0,
  7218. b = v.t || 0;
  7219. m < 0 && (m = b), b && b > m && (m = b);
  7220. var w = void 0;
  7221. if (_ < 0) {
  7222. var E = g + 1;
  7223. w = E === t.length ? "dynamic" === r && a > 0 && o.indexOf("$Number$") > 0 ? Ga(e, m, y) : (u * d - m) / y :
  7224. (t[E].t - m) / y
  7225. } else w = _ + 1;
  7226. for (var T = h + p.length + w, S = h + p.length; S < T;) p.push({
  7227. number: S,
  7228. duration: y / d,
  7229. time: m,
  7230. timeline: f
  7231. }), m += y, S++
  7232. }
  7233. return p
  7234. },
  7235. Wa = function(e) {
  7236. return e.reduce(function(e, t) {
  7237. return e.concat(t)
  7238. }, [])
  7239. },
  7240. qa = function(e) {
  7241. if (!e.length) return [];
  7242. for (var t = [], i = 0; i < e.length; i++) t.push(e[i]);
  7243. return t
  7244. },
  7245. Xa = {
  7246. static: function(e) {
  7247. var t = e.duration,
  7248. i = e.timescale,
  7249. r = void 0 === i ? 1 : i,
  7250. n = e.sourceDuration;
  7251. return {
  7252. start: 0,
  7253. end: Math.ceil(n / (t / r))
  7254. }
  7255. },
  7256. dynamic: function(e) {
  7257. var t = e.NOW,
  7258. i = e.clientOffset,
  7259. r = e.availabilityStartTime,
  7260. n = e.timescale,
  7261. a = void 0 === n ? 1 : n,
  7262. s = e.duration,
  7263. o = e.start,
  7264. u = void 0 === o ? 0 : o,
  7265. l = e.minimumUpdatePeriod,
  7266. d = void 0 === l ? 0 : l,
  7267. c = e.timeShiftBufferDepth,
  7268. h = void 0 === c ? 1 / 0 : c,
  7269. f = (t + i) / 1e3,
  7270. p = r + u,
  7271. m = f + d - p,
  7272. g = Math.ceil(m * a / s),
  7273. v = Math.floor((f - p - h) * a / s),
  7274. y = Math.floor((f - p) * a / s);
  7275. return {
  7276. start: Math.max(0, v),
  7277. end: Math.min(g, y)
  7278. }
  7279. }
  7280. },
  7281. za = function(e) {
  7282. var t = e.type,
  7283. i = void 0 === t ? "static" : t,
  7284. r = e.duration,
  7285. n = e.timescale,
  7286. a = void 0 === n ? 1 : n,
  7287. s = e.sourceDuration,
  7288. o = Xa[i](e),
  7289. u = function(e, t) {
  7290. for (var i = [], r = e; r < t; r++) i.push(r);
  7291. return i
  7292. }(o.start, o.end).map(function(e) {
  7293. return function(t, i) {
  7294. var r = e.duration,
  7295. n = e.timescale,
  7296. a = void 0 === n ? 1 : n,
  7297. s = e.periodIndex,
  7298. o = e.startNumber;
  7299. return {
  7300. number: (void 0 === o ? 1 : o) + t,
  7301. duration: r / a,
  7302. timeline: s,
  7303. time: i * r
  7304. }
  7305. }
  7306. }(e));
  7307. if ("static" === i) {
  7308. var l = u.length - 1;
  7309. u[l].duration = s - r / a * l
  7310. }
  7311. return u
  7312. },
  7313. Ka = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,
  7314. Ya = function(e, t) {
  7315. return e.replace(Ka, function(e) {
  7316. return function(t, i, r, n) {
  7317. if ("$$" === t) return "$";
  7318. if (void 0 === e[i]) return t;
  7319. var a = "" + e[i];
  7320. return "RepresentationID" === i ? a : (n = r ? parseInt(n, 10) : 1, a.length >= n ? a : "" +
  7321. new Array(n - a.length + 1).join("0") + a)
  7322. }
  7323. }(t))
  7324. },
  7325. Qa = function(e, t) {
  7326. var i = {
  7327. RepresentationID: e.id,
  7328. Bandwidth: e.bandwidth || 0
  7329. },
  7330. r = e.initialization,
  7331. n = void 0 === r ? {
  7332. sourceURL: "",
  7333. range: ""
  7334. } : r,
  7335. a = Ha({
  7336. baseUrl: e.baseUrl,
  7337. source: Ya(n.sourceURL, i),
  7338. range: n.range
  7339. });
  7340. return function(e, t) {
  7341. return e.duration || t ? e.duration ? za(e) : Va(e, t) : [{
  7342. number: e.startNumber || 1,
  7343. duration: e.sourceDuration,
  7344. time: 0,
  7345. timeline: e.periodIndex
  7346. }]
  7347. }(e, t).map(function(t) {
  7348. i.Number = t.number, i.Time = t.time;
  7349. var r = Ya(e.media || "", i);
  7350. return {
  7351. uri: r,
  7352. timeline: t.timeline,
  7353. duration: t.duration,
  7354. resolvedUri: ja(e.baseUrl || "", r),
  7355. map: a,
  7356. number: t.number
  7357. }
  7358. })
  7359. },
  7360. Ja = "INVALID_NUMBER_OF_PERIOD",
  7361. Za = "DASH_EMPTY_MANIFEST",
  7362. $a = "DASH_INVALID_XML",
  7363. es = "NO_BASE_URL",
  7364. ts = "SEGMENT_TIME_UNSPECIFIED",
  7365. is = "UNSUPPORTED_UTC_TIMING_SCHEME",
  7366. rs = function(e, t) {
  7367. var i = e.duration,
  7368. r = e.segmentUrls,
  7369. n = void 0 === r ? [] : r;
  7370. if (!i && !t || i && t) throw new Error(ts);
  7371. var a = n.map(function(t) {
  7372. return function(e, t) {
  7373. var i = e.baseUrl,
  7374. r = e.initialization,
  7375. n = void 0 === r ? {} : r,
  7376. a = Ha({
  7377. baseUrl: i,
  7378. source: n.sourceURL,
  7379. range: n.range
  7380. }),
  7381. s = Ha({
  7382. baseUrl: i,
  7383. source: t.media,
  7384. range: t.mediaRange
  7385. });
  7386. return s.map = a, s
  7387. }(e, t)
  7388. }),
  7389. s = void 0;
  7390. return i && (s = za(e)), t && (s = Va(e, t)), s.map(function(e, t) {
  7391. if (a[t]) {
  7392. var i = a[t];
  7393. return i.timeline = e.timeline, i.duration = e.duration, i.number = e.number, i
  7394. }
  7395. }).filter(function(e) {
  7396. return e
  7397. })
  7398. },
  7399. ns = function(e) {
  7400. var t = e.baseUrl,
  7401. i = e.initialization,
  7402. r = void 0 === i ? {} : i,
  7403. n = e.sourceDuration,
  7404. a = e.timescale,
  7405. s = void 0 === a ? 1 : a,
  7406. o = e.indexRange,
  7407. u = void 0 === o ? "" : o,
  7408. l = e.duration;
  7409. if (!t) throw new Error(es);
  7410. var d = Ha({
  7411. baseUrl: t,
  7412. source: r.sourceURL,
  7413. range: r.range
  7414. }),
  7415. c = Ha({
  7416. baseUrl: t,
  7417. source: t,
  7418. range: u
  7419. });
  7420. if (c.map = d, l) {
  7421. var h = za(e);
  7422. h.length && (c.duration = h[0].duration, c.timeline = h[0].timeline)
  7423. } else n && (c.duration = n / s, c.timeline = 0);
  7424. return c.number = 0, [c]
  7425. },
  7426. as = function(e) {
  7427. var t = e.attributes,
  7428. i = e.segmentInfo,
  7429. r = void 0,
  7430. n = void 0;
  7431. if (i.template ? (n = Qa, r = Fa(t, i.template)) : i.base ? (n = ns, r = Fa(t, i.base)) : i.list && (n = rs, r =
  7432. Fa(t, i.list)), !n) return {
  7433. attributes: t
  7434. };
  7435. var a = n(r, i.timeline);
  7436. if (r.duration) {
  7437. var s = r,
  7438. o = s.duration,
  7439. u = s.timescale,
  7440. l = void 0 === u ? 1 : u;
  7441. r.duration = o / l
  7442. } else a.length ? r.duration = a.reduce(function(e, t) {
  7443. return Math.max(e, Math.ceil(t.duration))
  7444. }, 0) : r.duration = 0;
  7445. return {
  7446. attributes: r,
  7447. segments: a
  7448. }
  7449. },
  7450. ss = function(e, t) {
  7451. return qa(e.childNodes).filter(function(e) {
  7452. return e.tagName === t
  7453. })
  7454. },
  7455. os = function(e) {
  7456. return e.textContent.trim()
  7457. },
  7458. us = function(e) {
  7459. var t = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);
  7460. if (!t) return 0;
  7461. var i = t.slice(1),
  7462. r = i[0],
  7463. n = i[1],
  7464. a = i[2],
  7465. s = i[3],
  7466. o = i[4],
  7467. u = i[5];
  7468. return 31536e3 * parseFloat(r || 0) + 2592e3 * parseFloat(n || 0) + 86400 * parseFloat(a || 0) + 3600 *
  7469. parseFloat(s || 0) + 60 * parseFloat(o || 0) + parseFloat(u || 0)
  7470. },
  7471. ls = {
  7472. mediaPresentationDuration: function(e) {
  7473. return us(e)
  7474. },
  7475. availabilityStartTime: function(e) {
  7476. return /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t = e) && (t += "Z"), Date.parse(t) / 1e3;
  7477. var t
  7478. },
  7479. minimumUpdatePeriod: function(e) {
  7480. return us(e)
  7481. },
  7482. timeShiftBufferDepth: function(e) {
  7483. return us(e)
  7484. },
  7485. start: function(e) {
  7486. return us(e)
  7487. },
  7488. width: function(e) {
  7489. return parseInt(e, 10)
  7490. },
  7491. height: function(e) {
  7492. return parseInt(e, 10)
  7493. },
  7494. bandwidth: function(e) {
  7495. return parseInt(e, 10)
  7496. },
  7497. startNumber: function(e) {
  7498. return parseInt(e, 10)
  7499. },
  7500. timescale: function(e) {
  7501. return parseInt(e, 10)
  7502. },
  7503. duration: function(e) {
  7504. var t = parseInt(e, 10);
  7505. return isNaN(t) ? us(e) : t
  7506. },
  7507. d: function(e) {
  7508. return parseInt(e, 10)
  7509. },
  7510. t: function(e) {
  7511. return parseInt(e, 10)
  7512. },
  7513. r: function(e) {
  7514. return parseInt(e, 10)
  7515. },
  7516. DEFAULT: function(e) {
  7517. return e
  7518. }
  7519. },
  7520. ds = function(e) {
  7521. return e && e.attributes ? qa(e.attributes).reduce(function(e, t) {
  7522. var i = ls[t.name] || ls.DEFAULT;
  7523. return e[t.name] = i(t.value), e
  7524. }, {}) : {}
  7525. };
  7526. var cs, hs, fs, ps, ms, gs, vs, ys, _s, bs, ws, Es, Ts, Ss, As, ks, Rs, Ms, Os, Cs, Ds, Is, Ls, xs, Ps, Us, Ns, Bs,
  7527. Fs, js, Hs, Gs, Vs, Ws, qs, Xs, zs, Ks, Ys, Qs, Js, Zs, $s = {
  7528. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  7529. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  7530. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  7531. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  7532. },
  7533. eo = function(e, t) {
  7534. return t.length ? Wa(e.map(function(e) {
  7535. return t.map(function(t) {
  7536. return ja(e, os(t))
  7537. })
  7538. })) : e
  7539. },
  7540. to = function(e) {
  7541. var t = ss(e, "SegmentTemplate")[0],
  7542. i = ss(e, "SegmentList")[0],
  7543. r = i && ss(i, "SegmentURL").map(function(e) {
  7544. return Fa({
  7545. tag: "SegmentURL"
  7546. }, ds(e))
  7547. }),
  7548. n = ss(e, "SegmentBase")[0],
  7549. a = i || t,
  7550. s = a && ss(a, "SegmentTimeline")[0],
  7551. o = i || n || t,
  7552. u = o && ss(o, "Initialization")[0],
  7553. l = t && ds(t);
  7554. l && u ? l.initialization = u && ds(u) : l && l.initialization && (l.initialization = {
  7555. sourceURL: l.initialization
  7556. });
  7557. var d = {
  7558. template: l,
  7559. timeline: s && ss(s, "S").map(function(e) {
  7560. return ds(e)
  7561. }),
  7562. list: i && Fa(ds(i), {
  7563. segmentUrls: r,
  7564. initialization: ds(u)
  7565. }),
  7566. base: n && Fa(ds(n), {
  7567. initialization: ds(u)
  7568. })
  7569. };
  7570. return Object.keys(d).forEach(function(e) {
  7571. d[e] || delete d[e]
  7572. }), d
  7573. },
  7574. io = function(e) {
  7575. return e.reduce(function(e, t) {
  7576. var i = ds(t),
  7577. r = $s[i.schemeIdUri];
  7578. if (r) {
  7579. e[r] = {
  7580. attributes: i
  7581. };
  7582. var a = ss(t, "cenc:pssh")[0];
  7583. if (a) {
  7584. var s = os(a),
  7585. o = s && function(e) {
  7586. for (var t = n.atob(e), i = new Uint8Array(t.length), r = 0; r < t.length; r++) i[r] = t
  7587. .charCodeAt(r);
  7588. return i
  7589. }(s);
  7590. e[r].pssh = o
  7591. }
  7592. }
  7593. return e
  7594. }, {})
  7595. },
  7596. ro = function(e, t, i) {
  7597. return function(r) {
  7598. var n = ds(r),
  7599. a = eo(t, ss(r, "BaseURL")),
  7600. s = ss(r, "Role")[0],
  7601. o = {
  7602. role: ds(s)
  7603. },
  7604. u = Fa(e, n, o),
  7605. l = io(ss(r, "ContentProtection"));
  7606. Object.keys(l).length && (u = Fa(u, {
  7607. contentProtection: l
  7608. }));
  7609. var d = to(r),
  7610. c = ss(r, "Representation"),
  7611. h = Fa(i, d);
  7612. return Wa(c.map(function(e, t, i) {
  7613. return function(r) {
  7614. var n = ss(r, "BaseURL"),
  7615. a = eo(t, n),
  7616. s = Fa(e, ds(r)),
  7617. o = to(r);
  7618. return a.map(function(e) {
  7619. return {
  7620. segmentInfo: Fa(i, o),
  7621. attributes: Fa(s, {
  7622. baseUrl: e
  7623. })
  7624. }
  7625. })
  7626. }
  7627. }(u, a, h)))
  7628. }
  7629. },
  7630. no = function(e) {
  7631. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  7632. i = t.manifestUri,
  7633. r = void 0 === i ? "" : i,
  7634. n = t.NOW,
  7635. a = void 0 === n ? Date.now() : n,
  7636. s = t.clientOffset,
  7637. o = void 0 === s ? 0 : s,
  7638. u = ss(e, "Period");
  7639. if (1 !== u.length) throw new Error(Ja);
  7640. var l = ds(e),
  7641. d = eo([r], ss(e, "BaseURL"));
  7642. return l.sourceDuration = l.mediaPresentationDuration || 0, l.NOW = a, l.clientOffset = o, Wa(u.map(function(e,
  7643. t) {
  7644. return function(i, r) {
  7645. var n = eo(t, ss(i, "BaseURL")),
  7646. a = ds(i),
  7647. s = Fa(e, a, {
  7648. periodIndex: r
  7649. }),
  7650. o = ss(i, "AdaptationSet"),
  7651. u = to(i);
  7652. return Wa(o.map(ro(s, n, u)))
  7653. }
  7654. }(l, d)))
  7655. },
  7656. ao = function(e) {
  7657. if ("" === e) throw new Error(Za);
  7658. var t = (new n.DOMParser).parseFromString(e, "application/xml"),
  7659. i = t && "MPD" === t.documentElement.tagName ? t.documentElement : null;
  7660. if (!i || i && i.getElementsByTagName("parsererror").length > 0) throw new Error($a);
  7661. return i
  7662. },
  7663. so = function(e, t) {
  7664. return function(e) {
  7665. var t;
  7666. if (!e.length) return {};
  7667. var i = e[0].attributes,
  7668. r = i.sourceDuration,
  7669. n = i.minimumUpdatePeriod,
  7670. a = void 0 === n ? 0 : n,
  7671. s = e.filter(function(e) {
  7672. var t = e.attributes;
  7673. return "video/mp4" === t.mimeType || "video" === t.contentType
  7674. }).map(Ua),
  7675. o = e.filter(function(e) {
  7676. var t = e.attributes;
  7677. return "audio/mp4" === t.mimeType || "audio" === t.contentType
  7678. }),
  7679. u = e.filter(function(e) {
  7680. var t = e.attributes;
  7681. return "text/vtt" === t.mimeType || "text" === t.contentType
  7682. }),
  7683. l = {
  7684. allowCache: !0,
  7685. discontinuityStarts: [],
  7686. segments: [],
  7687. endList: !0,
  7688. mediaGroups: (t = {
  7689. AUDIO: {},
  7690. VIDEO: {}
  7691. }, t["CLOSED-CAPTIONS"] = {}, t.SUBTITLES = {}, t),
  7692. uri: "",
  7693. duration: r,
  7694. playlists: s,
  7695. minimumUpdatePeriod: 1e3 * a
  7696. };
  7697. return o.length && (l.mediaGroups.AUDIO.audio = o.reduce(function(e, t) {
  7698. var i = t.attributes.role && t.attributes.role.value || "main",
  7699. r = t.attributes.lang || "",
  7700. n = "main";
  7701. return r && (n = t.attributes.lang + " (" + i + ")"), e[n] && e[n].playlists[0].attributes
  7702. .BANDWIDTH > t.attributes.bandwidth ? e : (e[n] = {
  7703. language: r,
  7704. autoselect: !0,
  7705. default: "main" === i,
  7706. playlists: [function(e) {
  7707. var t, i = e.attributes,
  7708. r = e.segments,
  7709. n = {
  7710. attributes: (t = {
  7711. NAME: i.id,
  7712. BANDWIDTH: i.bandwidth,
  7713. CODECS: i.codecs
  7714. }, t["PROGRAM-ID"] = 1, t),
  7715. uri: "",
  7716. endList: "static" === (i.type || "static"),
  7717. timeline: i.periodIndex,
  7718. resolvedUri: "",
  7719. targetDuration: i.duration,
  7720. segments: r,
  7721. mediaSequence: r.length ? r[0].number : 1
  7722. };
  7723. return i.contentProtection && (n.contentProtection = i.contentProtection), n
  7724. }(t)],
  7725. uri: ""
  7726. }, e)
  7727. }, {})), u.length && (l.mediaGroups.SUBTITLES.subs = function(e) {
  7728. return e.reduce(function(e, t) {
  7729. var i, r, n, a, s = t.attributes.lang || "text";
  7730. return e[s] ? e : (e[s] = {
  7731. language: s,
  7732. default: !1,
  7733. autoselect: !1,
  7734. playlists: [(i = t, n = i.attributes, a = i.segments, void 0 === a && (a = [{
  7735. uri: n.baseUrl,
  7736. timeline: n.periodIndex,
  7737. resolvedUri: n.baseUrl || "",
  7738. duration: n.sourceDuration,
  7739. number: 0
  7740. }], n.duration = n.sourceDuration), {
  7741. attributes: (r = {
  7742. NAME: n.id,
  7743. BANDWIDTH: n.bandwidth
  7744. }, r["PROGRAM-ID"] = 1, r),
  7745. uri: "",
  7746. endList: "static" === (n.type || "static"),
  7747. timeline: n.periodIndex,
  7748. resolvedUri: n.baseUrl || "",
  7749. targetDuration: n.duration,
  7750. segments: a,
  7751. mediaSequence: a.length ? a[0].number : 1
  7752. })],
  7753. uri: ""
  7754. }, e)
  7755. }, {})
  7756. }(u)), l
  7757. }(no(ao(e), t).map(as))
  7758. },
  7759. oo = function(e) {
  7760. return function(e) {
  7761. var t = ss(e, "UTCTiming")[0];
  7762. if (!t) return null;
  7763. var i = ds(t);
  7764. switch (i.schemeIdUri) {
  7765. case "urn:mpeg:dash:utc:http-head:2014":
  7766. case "urn:mpeg:dash:utc:http-head:2012":
  7767. i.method = "HEAD";
  7768. break;
  7769. case "urn:mpeg:dash:utc:http-xsdate:2014":
  7770. case "urn:mpeg:dash:utc:http-iso:2014":
  7771. case "urn:mpeg:dash:utc:http-xsdate:2012":
  7772. case "urn:mpeg:dash:utc:http-iso:2012":
  7773. i.method = "GET";
  7774. break;
  7775. case "urn:mpeg:dash:utc:direct:2014":
  7776. case "urn:mpeg:dash:utc:direct:2012":
  7777. i.method = "DIRECT", i.value = Date.parse(i.value);
  7778. break;
  7779. case "urn:mpeg:dash:utc:http-ntp:2014":
  7780. case "urn:mpeg:dash:utc:ntp:2014":
  7781. case "urn:mpeg:dash:utc:sntp:2014":
  7782. default:
  7783. throw new Error(is)
  7784. }
  7785. return i
  7786. }(ao(e))
  7787. },
  7788. uo = {
  7789. toUnsigned: function(e) {
  7790. return e >>> 0
  7791. }
  7792. },
  7793. lo = uo.toUnsigned,
  7794. co = Object.freeze({
  7795. default: uo,
  7796. __moduleExports: uo,
  7797. toUnsigned: lo
  7798. }),
  7799. ho = (co && uo || co).toUnsigned,
  7800. fo = {
  7801. findBox: cs = function(e, t) {
  7802. var i, r, n, a, s, o = [];
  7803. if (!t.length) return null;
  7804. for (i = 0; i < e.byteLength;) r = ho(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]), n = hs(e
  7805. .subarray(i + 4, i + 8)), a = r > 1 ? i + r : e.byteLength, n === t[0] && (1 === t.length ? o.push(e
  7806. .subarray(i + 8, a)) : (s = cs(e.subarray(i + 8, a), t.slice(1))).length && (o = o.concat(s))), i = a;
  7807. return o
  7808. },
  7809. parseType: hs = function(e) {
  7810. var t = "";
  7811. return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[2]), t +=
  7812. String.fromCharCode(e[3])
  7813. },
  7814. timescale: function(e) {
  7815. return cs(e, ["moov", "trak"]).reduce(function(e, t) {
  7816. var i, r, n, a, s;
  7817. return (i = cs(t, ["tkhd"])[0]) ? (r = i[0], a = ho(i[n = 0 === r ? 12 : 20] << 24 | i[n + 1] << 16 |
  7818. i[n + 2] << 8 | i[n + 3]), (s = cs(t, ["mdia", "mdhd"])[0]) ? (n = 0 === (r = s[0]) ? 12 : 20,
  7819. e[a] = ho(s[n] << 24 | s[n + 1] << 16 | s[n + 2] << 8 | s[n + 3]), e) : null) : null
  7820. }, {})
  7821. },
  7822. startTime: function(e, t) {
  7823. var i, r, n;
  7824. return i = cs(t, ["moof", "traf"]), r = [].concat.apply([], i.map(function(t) {
  7825. return cs(t, ["tfhd"]).map(function(i) {
  7826. var r, n;
  7827. return r = ho(i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7]), n = e[r] || 9e4, (cs(t, ["tfdt"])
  7828. .map(function(e) {
  7829. var t, i;
  7830. return t = e[0], i = ho(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]), 1 === t && (i *=
  7831. Math.pow(2, 32), i += ho(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11])), i
  7832. })[0] || 1 / 0) / n
  7833. })
  7834. })), n = Math.min.apply(null, r), isFinite(n) ? n : 0
  7835. },
  7836. videoTrackIds: function(e) {
  7837. var t = [];
  7838. return cs(e, ["moov", "trak"]).forEach(function(e) {
  7839. var i = cs(e, ["mdia", "hdlr"]),
  7840. r = cs(e, ["tkhd"]);
  7841. i.forEach(function(e, i) {
  7842. var n, a, s = hs(e.subarray(8, 12)),
  7843. o = r[i];
  7844. "vide" === s && (a = 0 === (n = new DataView(o.buffer, o.byteOffset, o.byteLength)).getUint8(
  7845. 0) ? n.getUint32(12) : n.getUint32(20), t.push(a))
  7846. })
  7847. }), t
  7848. }
  7849. },
  7850. po = Math.pow(2, 32) - 1;
  7851. ! function() {
  7852. var e;
  7853. if (xs = {
  7854. avc1: [],
  7855. avcC: [],
  7856. btrt: [],
  7857. dinf: [],
  7858. dref: [],
  7859. esds: [],
  7860. ftyp: [],
  7861. hdlr: [],
  7862. mdat: [],
  7863. mdhd: [],
  7864. mdia: [],
  7865. mfhd: [],
  7866. minf: [],
  7867. moof: [],
  7868. moov: [],
  7869. mp4a: [],
  7870. mvex: [],
  7871. mvhd: [],
  7872. sdtp: [],
  7873. smhd: [],
  7874. stbl: [],
  7875. stco: [],
  7876. stsc: [],
  7877. stsd: [],
  7878. stsz: [],
  7879. stts: [],
  7880. styp: [],
  7881. tfdt: [],
  7882. tfhd: [],
  7883. traf: [],
  7884. trak: [],
  7885. trun: [],
  7886. trex: [],
  7887. tkhd: [],
  7888. vmhd: []
  7889. }, "undefined" != typeof Uint8Array) {
  7890. for (e in xs) xs.hasOwnProperty(e) && (xs[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e.charCodeAt(
  7891. 3)]);
  7892. Ps = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]), Ns =
  7893. new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]), Us =
  7894. new Uint8Array([0, 0, 0, 1]), Bs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0,
  7895. 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0
  7896. ]), Fs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83,
  7897. 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0
  7898. ]), js = {
  7899. video: Bs,
  7900. audio: Fs
  7901. }, Vs = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), Gs =
  7902. new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), Ws = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), qs = Ws, Xs =
  7903. new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), zs = Ws, Hs = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0,
  7904. 0, 0, 0
  7905. ])
  7906. }
  7907. }(), fs = function(e) {
  7908. var t, i, r = [],
  7909. n = 0;
  7910. for (t = 1; t < arguments.length; t++) r.push(arguments[t]);
  7911. for (t = r.length; t--;) n += r[t].byteLength;
  7912. for (i = new Uint8Array(n + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i.byteLength), i
  7913. .set(e, 4), t = 0, n = 8; t < r.length; t++) i.set(r[t], n), n += r[t].byteLength;
  7914. return i
  7915. }, ps = function() {
  7916. return fs(xs.dinf, fs(xs.dref, Vs))
  7917. }, ms = function(e) {
  7918. return fs(xs.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192, 0, 0,
  7919. 218, 192, 5, 2, e.audioobjecttype << 3 | e.samplingfrequencyindex >>> 1, e.samplingfrequencyindex << 7 |
  7920. e.channelcount << 3, 6, 1, 2
  7921. ]))
  7922. }, Rs = function(e) {
  7923. return fs(xs.hdlr, js[e])
  7924. }, ks = function(e) {
  7925. var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, e.duration >>> 24 & 255, e
  7926. .duration >>> 16 & 255, e.duration >>> 8 & 255, 255 & e.duration, 85, 196, 0, 0
  7927. ]);
  7928. return e.samplerate && (t[12] = e.samplerate >>> 24 & 255, t[13] = e.samplerate >>> 16 & 255, t[14] = e
  7929. .samplerate >>> 8 & 255, t[15] = 255 & e.samplerate), fs(xs.mdhd, t)
  7930. }, As = function(e) {
  7931. return fs(xs.mdia, ks(e), Rs(e.type), ys(e))
  7932. }, vs = function(e) {
  7933. return fs(xs.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 & e) >> 8,
  7934. 255 & e
  7935. ]))
  7936. }, ys = function(e) {
  7937. return fs(xs.minf, "video" === e.type ? fs(xs.vmhd, Hs) : fs(xs.smhd, Gs), ps(), Os(e))
  7938. }, _s = function(e, t) {
  7939. for (var i = [], r = t.length; r--;) i[r] = Ds(t[r]);
  7940. return fs.apply(null, [xs.moof, vs(e)].concat(i))
  7941. }, bs = function(e) {
  7942. for (var t = e.length, i = []; t--;) i[t] = Ts(e[t]);
  7943. return fs.apply(null, [xs.moov, Es(4294967295)].concat(i).concat(ws(e)))
  7944. }, ws = function(e) {
  7945. for (var t = e.length, i = []; t--;) i[t] = Is(e[t]);
  7946. return fs.apply(null, [xs.mvex].concat(i))
  7947. }, Es = function(e) {
  7948. var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & e) >> 24, (16711680 &
  7949. e) >> 16, (65280 & e) >> 8, 255 & e, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
  7950. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0,
  7951. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255
  7952. ]);
  7953. return fs(xs.mvhd, t)
  7954. }, Ms = function(e) {
  7955. var t, i, r = e.samples || [],
  7956. n = new Uint8Array(4 + r.length);
  7957. for (i = 0; i < r.length; i++) t = r[i].flags, n[i + 4] = t.dependsOn << 4 | t.isDependedOn << 2 | t
  7958. .hasRedundancy;
  7959. return fs(xs.sdtp, n)
  7960. }, Os = function(e) {
  7961. return fs(xs.stbl, Cs(e), fs(xs.stts, zs), fs(xs.stsc, qs), fs(xs.stsz, Xs), fs(xs.stco, Ws))
  7962. }, Cs = function(e) {
  7963. return fs(xs.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === e.type ? Ks(e) : Ys(e))
  7964. }, Ks = function(e) {
  7965. var t, i = e.sps || [],
  7966. r = e.pps || [],
  7967. n = [],
  7968. a = [];
  7969. for (t = 0; t < i.length; t++) n.push((65280 & i[t].byteLength) >>> 8), n.push(255 & i[t].byteLength), n = n
  7970. .concat(Array.prototype.slice.call(i[t]));
  7971. for (t = 0; t < r.length; t++) a.push((65280 & r[t].byteLength) >>> 8), a.push(255 & r[t].byteLength), a = a
  7972. .concat(Array.prototype.slice.call(r[t]));
  7973. return fs(xs.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (
  7974. 65280 & e.width) >> 8, 255 & e.width, (65280 & e.height) >> 8, 255 & e.height, 0, 72, 0, 0, 0, 72, 0,
  7975. 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111, 110, 116, 114, 105, 98, 45,
  7976. 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17
  7977. ]), fs(xs.avcC, new Uint8Array([1, e.profileIdc, e.profileCompatibility, e.levelIdc, 255].concat([i.length])
  7978. .concat(n).concat([r.length]).concat(a))), fs(xs.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192,
  7979. 0, 45, 198, 192
  7980. ])))
  7981. }, Ys = function(e) {
  7982. return fs(xs.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e.channelcount) >>
  7983. 8, 255 & e.channelcount, (65280 & e.samplesize) >> 8, 255 & e.samplesize, 0, 0, 0, 0, (65280 & e
  7984. .samplerate) >> 8, 255 & e.samplerate, 0, 0
  7985. ]), ms(e))
  7986. }, Ss = function(e) {
  7987. var t = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16,
  7988. (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 0, (4278190080 & e.duration) >> 24, (16711680 & e.duration) >>
  7989. 16, (65280 & e.duration) >> 8, 255 & e.duration, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0,
  7990. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (
  7991. 65280 & e.width) >> 8, 255 & e.width, 0, 0, (65280 & e.height) >> 8, 255 & e.height, 0, 0
  7992. ]);
  7993. return fs(xs.tkhd, t)
  7994. }, Ds = function(e) {
  7995. var t, i, r, n, a, s;
  7996. return t = fs(xs.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 &
  7997. e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), a = Math.floor(e
  7998. .baseMediaDecodeTime / (po + 1)), s = Math.floor(e.baseMediaDecodeTime % (po + 1)), i = fs(xs.tfdt,
  7999. new Uint8Array([1, 0, 0, 0, a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, 255 & a, s >>> 24 & 255, s >>>
  8000. 16 & 255, s >>> 8 & 255, 255 & s
  8001. ])), 92, "audio" === e.type ? (r = Ls(e, 92), fs(xs.traf, t, i, r)) : (n = Ms(e), r = Ls(e, n.length + 92),
  8002. fs(xs.traf, t, i, r, n))
  8003. }, Ts = function(e) {
  8004. return e.duration = e.duration || 4294967295, fs(xs.trak, Ss(e), As(e))
  8005. }, Is = function(e) {
  8006. var t = new Uint8Array([0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e.id) >> 8,
  8007. 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1
  8008. ]);
  8009. return "video" !== e.type && (t[t.length - 1] = 0), fs(xs.trex, t)
  8010. }, Zs = function(e, t) {
  8011. var i = 0,
  8012. r = 0,
  8013. n = 0,
  8014. a = 0;
  8015. return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (r = 2), void 0 !== e[0]
  8016. .flags && (n = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | r | n | a, 1, (4278190080 &
  8017. e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 & e.length, (4278190080 &
  8018. t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t
  8019. ]
  8020. }, Js = function(e, t) {
  8021. var i, r, n, a;
  8022. for (t += 20 + 16 * (r = e.samples || []).length, i = Zs(r, t), a = 0; a < r.length; a++) n = r[a], i = i
  8023. .concat([(4278190080 & n.duration) >>> 24, (16711680 & n.duration) >>> 16, (65280 & n.duration) >>> 8, 255 & n
  8024. .duration, (4278190080 & n.size) >>> 24, (16711680 & n.size) >>> 16, (65280 & n.size) >>> 8, 255 & n.size,
  8025. n.flags.isLeading << 2 | n.flags.dependsOn, n.flags.isDependedOn << 6 | n.flags.hasRedundancy << 4 | n
  8026. .flags.paddingValue << 1 | n.flags.isNonSyncSample, 61440 & n.flags.degradationPriority, 15 & n.flags
  8027. .degradationPriority, (4278190080 & n.compositionTimeOffset) >>> 24, (16711680 & n
  8028. .compositionTimeOffset) >>> 16, (65280 & n.compositionTimeOffset) >>> 8, 255 & n.compositionTimeOffset
  8029. ]);
  8030. return fs(xs.trun, new Uint8Array(i))
  8031. }, Qs = function(e, t) {
  8032. var i, r, n, a;
  8033. for (t += 20 + 8 * (r = e.samples || []).length, i = Zs(r, t), a = 0; a < r.length; a++) n = r[a], i = i.concat(
  8034. [(4278190080 & n.duration) >>> 24, (16711680 & n.duration) >>> 16, (65280 & n.duration) >>> 8, 255 & n
  8035. .duration, (4278190080 & n.size) >>> 24, (16711680 & n.size) >>> 16, (65280 & n.size) >>> 8, 255 & n.size
  8036. ]);
  8037. return fs(xs.trun, new Uint8Array(i))
  8038. }, Ls = function(e, t) {
  8039. return "audio" === e.type ? Qs(e, t) : Js(e, t)
  8040. };
  8041. var mo = {
  8042. ftyp: gs = function() {
  8043. return fs(xs.ftyp, Ps, Us, Ps, Ns)
  8044. },
  8045. mdat: function(e) {
  8046. return fs(xs.mdat, e)
  8047. },
  8048. moof: _s,
  8049. moov: bs,
  8050. initSegment: function(e) {
  8051. var t, i = gs(),
  8052. r = bs(e);
  8053. return (t = new Uint8Array(i.byteLength + r.byteLength)).set(i), t.set(r, i.byteLength), t
  8054. }
  8055. },
  8056. go = mo.ftyp,
  8057. vo = mo.mdat,
  8058. yo = mo.moof,
  8059. _o = mo.moov,
  8060. bo = mo.initSegment,
  8061. wo = Object.freeze({
  8062. default: mo,
  8063. __moduleExports: mo,
  8064. ftyp: go,
  8065. mdat: vo,
  8066. moof: yo,
  8067. moov: _o,
  8068. initSegment: bo
  8069. }),
  8070. Eo = function() {
  8071. this.init = function() {
  8072. var e = {};
  8073. this.on = function(t, i) {
  8074. e[t] || (e[t] = []), e[t] = e[t].concat(i)
  8075. }, this.off = function(t, i) {
  8076. var r;
  8077. return !!e[t] && (r = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(r, 1), r > -1)
  8078. }, this.trigger = function(t) {
  8079. var i, r, n, a;
  8080. if (i = e[t])
  8081. if (2 === arguments.length)
  8082. for (n = i.length, r = 0; r < n; ++r) i[r].call(this, arguments[1]);
  8083. else {
  8084. for (a = [], r = arguments.length, r = 1; r < arguments.length; ++r) a.push(arguments[r]);
  8085. for (n = i.length, r = 0; r < n; ++r) i[r].apply(this, a)
  8086. }
  8087. }, this.dispose = function() {
  8088. e = {}
  8089. }
  8090. }
  8091. };
  8092. Eo.prototype.pipe = function(e) {
  8093. return this.on("data", function(t) {
  8094. e.push(t)
  8095. }), this.on("done", function(t) {
  8096. e.flush(t)
  8097. }), e
  8098. }, Eo.prototype.push = function(e) {
  8099. this.trigger("data", e)
  8100. }, Eo.prototype.flush = function(e) {
  8101. this.trigger("done", e)
  8102. };
  8103. var To = Eo,
  8104. So = Object.freeze({
  8105. default: To,
  8106. __moduleExports: To
  8107. }),
  8108. Ao = function(e, t) {
  8109. var i = {
  8110. size: 0,
  8111. flags: {
  8112. isLeading: 0,
  8113. dependsOn: 1,
  8114. isDependedOn: 0,
  8115. hasRedundancy: 0,
  8116. degradationPriority: 0,
  8117. isNonSyncSample: 1
  8118. }
  8119. };
  8120. return i.dataOffset = t, i.compositionTimeOffset = e.pts - e.dts, i.duration = e.duration, i.size = 4 * e
  8121. .length, i.size += e.byteLength, e.keyFrame && (i.flags.dependsOn = 2, i.flags.isNonSyncSample = 0), i
  8122. },
  8123. ko = {
  8124. groupNalsIntoFrames: function(e) {
  8125. var t, i, r = [],
  8126. n = [];
  8127. for (r.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t]).nalUnitType ? (
  8128. r.length && (r.duration = i.dts - r.dts, n.push(r)), (r = [i]).byteLength = i.data.byteLength, r.pts = i
  8129. .pts, r.dts = i.dts) : ("slice_layer_without_partitioning_rbsp_idr" === i.nalUnitType && (r.keyFrame = !
  8130. 0), r.duration = i.dts - r.dts, r.byteLength += i.data.byteLength, r.push(i));
  8131. return n.length && (!r.duration || r.duration <= 0) && (r.duration = n[n.length - 1].duration), n.push(r), n
  8132. },
  8133. groupFramesIntoGops: function(e) {
  8134. var t, i, r = [],
  8135. n = [];
  8136. for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, n.byteLength = 0,
  8137. n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, t = 0; t < e.length; t++)(i = e[t])
  8138. .keyFrame ? (r.length && (n.push(r), n.byteLength += r.byteLength, n.nalCount += r.nalCount, n.duration +=
  8139. r.duration), (r = [i]).nalCount = i.length, r.byteLength = i.byteLength, r.pts = i.pts, r.dts = i.dts,
  8140. r.duration = i.duration) : (r.duration += i.duration, r.nalCount += i.length, r.byteLength += i
  8141. .byteLength, r.push(i));
  8142. return n.length && r.duration <= 0 && (r.duration = n[n.length - 1].duration), n.byteLength += r.byteLength,
  8143. n.nalCount += r.nalCount, n.duration += r.duration, n.push(r), n
  8144. },
  8145. extendFirstKeyFrame: function(e) {
  8146. var t;
  8147. return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e.nalCount -= t
  8148. .nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t.duration), e
  8149. },
  8150. generateSampleTable: function(e, t) {
  8151. var i, r, n, a, s, o = t || 0,
  8152. u = [];
  8153. for (i = 0; i < e.length; i++)
  8154. for (a = e[i], r = 0; r < a.length; r++) s = a[r], o += (n = Ao(s, o)).size, u.push(n);
  8155. return u
  8156. },
  8157. concatenateNalData: function(e) {
  8158. var t, i, r, n, a, s, o = 0,
  8159. u = e.byteLength,
  8160. l = e.nalCount,
  8161. d = new Uint8Array(u + 4 * l),
  8162. c = new DataView(d.buffer);
  8163. for (t = 0; t < e.length; t++)
  8164. for (n = e[t], i = 0; i < n.length; i++)
  8165. for (a = n[i], r = 0; r < a.length; r++) s = a[r], c.setUint32(o, s.data.byteLength), o += 4, d.set(s
  8166. .data, o), o += s.data.byteLength;
  8167. return d
  8168. }
  8169. },
  8170. Ro = ko.groupNalsIntoFrames,
  8171. Mo = ko.groupFramesIntoGops,
  8172. Oo = ko.extendFirstKeyFrame,
  8173. Co = ko.generateSampleTable,
  8174. Do = ko.concatenateNalData,
  8175. Io = Object.freeze({
  8176. default: ko,
  8177. __moduleExports: ko,
  8178. groupNalsIntoFrames: Ro,
  8179. groupFramesIntoGops: Mo,
  8180. extendFirstKeyFrame: Oo,
  8181. generateSampleTable: Co,
  8182. concatenateNalData: Do
  8183. }),
  8184. Lo = {
  8185. clearDtsInfo: function(e) {
  8186. delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts
  8187. },
  8188. calculateTrackBaseMediaDecodeTime: function(e, t) {
  8189. var i, r = e.minSegmentDts;
  8190. return t || (r -= e.timelineStartInfo.dts), i = e.timelineStartInfo.baseMediaDecodeTime, i += r, i = Math
  8191. .max(0, i), "audio" === e.type && (i *= e.samplerate / 9e4, i = Math.floor(i)), i
  8192. },
  8193. collectDtsInfo: function(e, t) {
  8194. "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t.pts),
  8195. void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e.minSegmentPts, t
  8196. .pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e.maxSegmentPts = Math.max(e
  8197. .maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts && (e
  8198. .timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e.minSegmentDts = t.dts : e
  8199. .minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e.maxSegmentDts ? e.maxSegmentDts = t
  8200. .dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts))
  8201. }
  8202. },
  8203. xo = Lo.clearDtsInfo,
  8204. Po = Lo.calculateTrackBaseMediaDecodeTime,
  8205. Uo = Lo.collectDtsInfo,
  8206. No = Object.freeze({
  8207. default: Lo,
  8208. __moduleExports: Lo,
  8209. clearDtsInfo: xo,
  8210. calculateTrackBaseMediaDecodeTime: Po,
  8211. collectDtsInfo: Uo
  8212. }),
  8213. Bo = {
  8214. parseSei: function(e) {
  8215. for (var t = 0, i = {
  8216. payloadType: -1,
  8217. payloadSize: 0
  8218. }, r = 0, n = 0; t < e.byteLength && 128 !== e[t];) {
  8219. for (; 255 === e[t];) r += 255, t++;
  8220. for (r += e[t++]; 255 === e[t];) n += 255, t++;
  8221. if (n += e[t++], !i.payload && 4 === r) {
  8222. i.payloadType = r, i.payloadSize = n, i.payload = e.subarray(t, t + n);
  8223. break
  8224. }
  8225. t += n, r = 0, n = 0
  8226. }
  8227. return i
  8228. },
  8229. parseUserData: function(e) {
  8230. return 181 !== e.payload[0] ? null : 49 != (e.payload[1] << 8 | e.payload[2]) ? null : "GA94" !== String
  8231. .fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) ? null : 3 !== e.payload[7] ? null :
  8232. e.payload.subarray(8, e.payload.length - 1)
  8233. },
  8234. parseCaptionPackets: function(e, t) {
  8235. var i, r, n, a, s = [];
  8236. if (!(64 & t[0])) return s;
  8237. for (r = 31 & t[0], i = 0; i < r; i++) a = {
  8238. type: 3 & t[2 + (n = 3 * i)],
  8239. pts: e
  8240. }, 4 & t[n + 2] && (a.ccData = t[n + 3] << 8 | t[n + 4], s.push(a));
  8241. return s
  8242. },
  8243. discardEmulationPreventionBytes: function(e) {
  8244. for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a + 2] ?
  8245. (n.push(a + 2), a += 2) : a++;
  8246. if (0 === n.length) return e;
  8247. t = r - n.length, i = new Uint8Array(t);
  8248. var s = 0;
  8249. for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s];
  8250. return i
  8251. },
  8252. USER_DATA_REGISTERED_ITU_T_T35: 4
  8253. },
  8254. Fo = Bo.parseSei,
  8255. jo = Bo.parseUserData,
  8256. Ho = Bo.parseCaptionPackets,
  8257. Go = Bo.discardEmulationPreventionBytes,
  8258. Vo = Bo.USER_DATA_REGISTERED_ITU_T_T35,
  8259. Wo = Object.freeze({
  8260. default: Bo,
  8261. __moduleExports: Bo,
  8262. parseSei: Fo,
  8263. parseUserData: jo,
  8264. parseCaptionPackets: Ho,
  8265. discardEmulationPreventionBytes: Go,
  8266. USER_DATA_REGISTERED_ITU_T_T35: Vo
  8267. }),
  8268. qo = So && To || So,
  8269. Xo = Wo && Bo || Wo,
  8270. zo = function e() {
  8271. e.prototype.init.call(this), this.captionPackets_ = [], this.ccStreams_ = [new Zo(0, 0), new Zo(0, 1), new Zo(1,
  8272. 0), new Zo(1, 1)], this.reset(), this.ccStreams_.forEach(function(e) {
  8273. e.on("data", this.trigger.bind(this, "data")), e.on("done", this.trigger.bind(this, "done"))
  8274. }, this)
  8275. };
  8276. (zo.prototype = new qo).push = function(e) {
  8277. var t, i, r;
  8278. if ("sei_rbsp" === e.nalUnitType && (t = Xo.parseSei(e.escapedRBSP)).payloadType === Xo
  8279. .USER_DATA_REGISTERED_ITU_T_T35 && (i = Xo.parseUserData(t)))
  8280. if (e.dts < this.latestDts_) this.ignoreNextEqualDts_ = !0;
  8281. else {
  8282. if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_) return this.numSameDts_--, void(this
  8283. .numSameDts_ || (this.ignoreNextEqualDts_ = !1));
  8284. r = Xo.parseCaptionPackets(e.pts, i), this.captionPackets_ = this.captionPackets_.concat(r), this
  8285. .latestDts_ !== e.dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts
  8286. }
  8287. }, zo.prototype.flush = function() {
  8288. this.captionPackets_.length ? (this.captionPackets_.forEach(function(e, t) {
  8289. e.presortIndex = t
  8290. }), this.captionPackets_.sort(function(e, t) {
  8291. return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts
  8292. }), this.captionPackets_.forEach(function(e) {
  8293. e.type < 2 && this.dispatchCea608Packet(e)
  8294. }, this), this.captionPackets_.length = 0, this.ccStreams_.forEach(function(e) {
  8295. e.flush()
  8296. }, this)) : this.ccStreams_.forEach(function(e) {
  8297. e.flush()
  8298. }, this)
  8299. }, zo.prototype.reset = function() {
  8300. this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.numSameDts_ = 0, this.activeCea608Channel_ = [null,
  8301. null
  8302. ], this.ccStreams_.forEach(function(e) {
  8303. e.reset()
  8304. })
  8305. }, zo.prototype.dispatchCea608Packet = function(e) {
  8306. this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (this
  8307. .activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this.ccStreams_[(e.type <<
  8308. 1) + this.activeCea608Channel_[e.type]].push(e)
  8309. }, zo.prototype.setsChannel1Active = function(e) {
  8310. return 4096 == (30720 & e.ccData)
  8311. }, zo.prototype.setsChannel2Active = function(e) {
  8312. return 6144 == (30720 & e.ccData)
  8313. };
  8314. var Ko = {
  8315. 42: 225,
  8316. 92: 233,
  8317. 94: 237,
  8318. 95: 243,
  8319. 96: 250,
  8320. 123: 231,
  8321. 124: 247,
  8322. 125: 209,
  8323. 126: 241,
  8324. 127: 9608,
  8325. 304: 174,
  8326. 305: 176,
  8327. 306: 189,
  8328. 307: 191,
  8329. 308: 8482,
  8330. 309: 162,
  8331. 310: 163,
  8332. 311: 9834,
  8333. 312: 224,
  8334. 313: 160,
  8335. 314: 232,
  8336. 315: 226,
  8337. 316: 234,
  8338. 317: 238,
  8339. 318: 244,
  8340. 319: 251,
  8341. 544: 193,
  8342. 545: 201,
  8343. 546: 211,
  8344. 547: 218,
  8345. 548: 220,
  8346. 549: 252,
  8347. 550: 8216,
  8348. 551: 161,
  8349. 552: 42,
  8350. 553: 39,
  8351. 554: 8212,
  8352. 555: 169,
  8353. 556: 8480,
  8354. 557: 8226,
  8355. 558: 8220,
  8356. 559: 8221,
  8357. 560: 192,
  8358. 561: 194,
  8359. 562: 199,
  8360. 563: 200,
  8361. 564: 202,
  8362. 565: 203,
  8363. 566: 235,
  8364. 567: 206,
  8365. 568: 207,
  8366. 569: 239,
  8367. 570: 212,
  8368. 571: 217,
  8369. 572: 249,
  8370. 573: 219,
  8371. 574: 171,
  8372. 575: 187,
  8373. 800: 195,
  8374. 801: 227,
  8375. 802: 205,
  8376. 803: 204,
  8377. 804: 236,
  8378. 805: 210,
  8379. 806: 242,
  8380. 807: 213,
  8381. 808: 245,
  8382. 809: 123,
  8383. 810: 125,
  8384. 811: 92,
  8385. 812: 94,
  8386. 813: 95,
  8387. 814: 124,
  8388. 815: 126,
  8389. 816: 196,
  8390. 817: 228,
  8391. 818: 214,
  8392. 819: 246,
  8393. 820: 223,
  8394. 821: 165,
  8395. 822: 164,
  8396. 823: 9474,
  8397. 824: 197,
  8398. 825: 229,
  8399. 826: 216,
  8400. 827: 248,
  8401. 828: 9484,
  8402. 829: 9488,
  8403. 830: 9492,
  8404. 831: 9496
  8405. },
  8406. Yo = function(e) {
  8407. return null === e ? "" : (e = Ko[e] || e, String.fromCharCode(e))
  8408. },
  8409. Qo = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152],
  8410. Jo = function() {
  8411. for (var e = [], t = 15; t--;) e.push("");
  8412. return e
  8413. },
  8414. Zo = function e(t, i) {
  8415. e.prototype.init.call(this), this.field_ = t || 0, this.dataChannel_ = i || 0, this.name_ = "CC" + (1 + (this
  8416. .field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push = function(e) {
  8417. var t, i, r, n, a;
  8418. if ((t = 32639 & e.ccData) !== this.lastControlCode_) {
  8419. if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this.lastControlCode_ =
  8420. null), r = t >>> 8, n = 255 & t, t !== this.PADDING_)
  8421. if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn";
  8422. else if (t === this.END_OF_CAPTION_) this.mode_ = "popOn", this.clearFormatting(e.pts), this
  8423. .flushDisplayed(e.pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ =
  8424. i, this.startPts_ = e.pts;
  8425. else if (t === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(e.pts);
  8426. else if (t === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(e.pts);
  8427. else if (t === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(e.pts);
  8428. else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts), this
  8429. .shiftRowsUp_(), this.startPts_ = e.pts;
  8430. else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this
  8431. .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(
  8432. 0, -1);
  8433. else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ = Jo();
  8434. else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = Jo();
  8435. else if (t === this.RESUME_DIRECT_CAPTIONING_) "paintOn" !== this.mode_ && (this.flushDisplayed(e.pts),
  8436. this.displayed_ = Jo()), this.mode_ = "paintOn", this.startPts_ = e.pts;
  8437. else if (this.isSpecialCharacter(r, n)) a = Yo((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this
  8438. .column_++;
  8439. else if (this.isExtCharacter(r, n)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this
  8440. .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_].slice(
  8441. 0, -1), a = Yo((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++;
  8442. else if (this.isMidRowCode(r, n)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "), this
  8443. .column_++, 14 == (14 & n) && this.addFormatting(e.pts, ["i"]), 1 == (1 & n) && this.addFormatting(e
  8444. .pts, ["u"]);
  8445. else if (this.isOffsetControlCode(r, n)) this.column_ += 3 & n;
  8446. else if (this.isPAC(r, n)) {
  8447. var s = Qo.indexOf(7968 & t);
  8448. "rollUp" === this.mode_ && this.setRollUp(e.pts, s), s !== this.row_ && (this.clearFormatting(e.pts),
  8449. this.row_ = s), 1 & n && -1 === this.formatting_.indexOf("u") && this.addFormatting(e.pts, ["u"]),
  8450. 16 == (16 & t) && (this.column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(n) && 14 == (14 & n) && this
  8451. .addFormatting(e.pts, ["i"])
  8452. } else this.isNormalChar(r) && (0 === n && (n = null), a = Yo(r), a += Yo(n), this[this.mode_](e.pts, a),
  8453. this.column_ += a.length)
  8454. } else this.lastControlCode_ = null
  8455. }
  8456. };
  8457. Zo.prototype = new qo, Zo.prototype.flushDisplayed = function(e) {
  8458. var t = this.displayed_.map(function(e) {
  8459. return e.trim()
  8460. }).join("\n").replace(/^\n+|\n+$/g, "");
  8461. t.length && this.trigger("data", {
  8462. startPts: this.startPts_,
  8463. endPts: e,
  8464. text: t,
  8465. stream: this.name_
  8466. })
  8467. }, Zo.prototype.reset = function() {
  8468. this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = Jo(), this.nonDisplayed_ = Jo(),
  8469. this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this.rollUpRows_ = 2, this.formatting_ = []
  8470. }, Zo.prototype.setConstants = function() {
  8471. 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8, this
  8472. .OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this.CONTROL_ = (28 | this
  8473. .field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this.RESUME_CAPTION_LOADING_ = 32 | this.CONTROL_,
  8474. this.END_OF_CAPTION_ = 47 | this.CONTROL_, this.ROLL_UP_2_ROWS_ = 37 | this.CONTROL_, this.ROLL_UP_3_ROWS_ =
  8475. 38 | this.CONTROL_, this.ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this.CARRIAGE_RETURN_ = 45 | this.CONTROL_,
  8476. this.RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this.BACKSPACE_ = 33 | this.CONTROL_, this
  8477. .ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this.ERASE_NON_DISPLAYED_MEMORY_ = 46 | this.CONTROL_
  8478. }, Zo.prototype.isSpecialCharacter = function(e, t) {
  8479. return e === this.EXT_ && t >= 48 && t <= 63
  8480. }, Zo.prototype.isExtCharacter = function(e, t) {
  8481. return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63
  8482. }, Zo.prototype.isMidRowCode = function(e, t) {
  8483. return e === this.EXT_ && t >= 32 && t <= 47
  8484. }, Zo.prototype.isOffsetControlCode = function(e, t) {
  8485. return e === this.OFFSET_ && t >= 33 && t <= 35
  8486. }, Zo.prototype.isPAC = function(e, t) {
  8487. return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127
  8488. }, Zo.prototype.isColorPAC = function(e) {
  8489. return e >= 64 && e <= 79 || e >= 96 && e <= 127
  8490. }, Zo.prototype.isNormalChar = function(e) {
  8491. return e >= 32 && e <= 127
  8492. }, Zo.prototype.setRollUp = function(e, t) {
  8493. if ("rollUp" !== this.mode_ && (this.row_ = 14, this.mode_ = "rollUp", this.flushDisplayed(e), this
  8494. .nonDisplayed_ = Jo(), this.displayed_ = Jo()), void 0 !== t && t !== this.row_)
  8495. for (var i = 0; i < this.rollUpRows_; i++) this.displayed_[t - i] = this.displayed_[this.row_ - i], this
  8496. .displayed_[this.row_ - i] = "";
  8497. void 0 === t && (t = this.row_), this.topRow_ = t - this.rollUpRows_ + 1
  8498. }, Zo.prototype.addFormatting = function(e, t) {
  8499. this.formatting_ = this.formatting_.concat(t);
  8500. var i = t.reduce(function(e, t) {
  8501. return e + "<" + t + ">"
  8502. }, "");
  8503. this[this.mode_](e, i)
  8504. }, Zo.prototype.clearFormatting = function(e) {
  8505. if (this.formatting_.length) {
  8506. var t = this.formatting_.reverse().reduce(function(e, t) {
  8507. return e + "</" + t + ">"
  8508. }, "");
  8509. this.formatting_ = [], this[this.mode_](e, t)
  8510. }
  8511. }, Zo.prototype.popOn = function(e, t) {
  8512. var i = this.nonDisplayed_[this.row_];
  8513. i += t, this.nonDisplayed_[this.row_] = i
  8514. }, Zo.prototype.rollUp = function(e, t) {
  8515. var i = this.displayed_[this.row_];
  8516. i += t, this.displayed_[this.row_] = i
  8517. }, Zo.prototype.shiftRowsUp_ = function() {
  8518. var e;
  8519. for (e = 0; e < this.topRow_; e++) this.displayed_[e] = "";
  8520. for (e = this.row_ + 1; e < 15; e++) this.displayed_[e] = "";
  8521. for (e = this.topRow_; e < this.row_; e++) this.displayed_[e] = this.displayed_[e + 1];
  8522. this.displayed_[this.row_] = ""
  8523. }, Zo.prototype.paintOn = function(e, t) {
  8524. var i = this.displayed_[this.row_];
  8525. i += t, this.displayed_[this.row_] = i
  8526. };
  8527. var $o = {
  8528. CaptionStream: zo,
  8529. Cea608Stream: Zo
  8530. },
  8531. eu = $o.CaptionStream,
  8532. tu = $o.Cea608Stream,
  8533. iu = Object.freeze({
  8534. default: $o,
  8535. __moduleExports: $o,
  8536. CaptionStream: eu,
  8537. Cea608Stream: tu
  8538. }),
  8539. ru = {
  8540. H264_STREAM_TYPE: 27,
  8541. ADTS_STREAM_TYPE: 15,
  8542. METADATA_STREAM_TYPE: 21
  8543. },
  8544. nu = ru.H264_STREAM_TYPE,
  8545. au = ru.ADTS_STREAM_TYPE,
  8546. su = ru.METADATA_STREAM_TYPE,
  8547. ou = Object.freeze({
  8548. default: ru,
  8549. __moduleExports: ru,
  8550. H264_STREAM_TYPE: nu,
  8551. ADTS_STREAM_TYPE: au,
  8552. METADATA_STREAM_TYPE: su
  8553. }),
  8554. uu = function(e, t) {
  8555. var i = 1;
  8556. for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i;
  8557. return e
  8558. },
  8559. lu = function e(t) {
  8560. var i, r;
  8561. e.prototype.init.call(this), this.type_ = t, this.push = function(e) {
  8562. e.type === this.type_ && (void 0 === r && (r = e.dts), e.dts = uu(e.dts, r), e.pts = uu(e.pts, r), i = e
  8563. .dts, this.trigger("data", e))
  8564. }, this.flush = function() {
  8565. r = i, this.trigger("done")
  8566. }, this.discontinuity = function() {
  8567. r = void 0, i = void 0
  8568. }
  8569. };
  8570. lu.prototype = new qo;
  8571. var du, cu = {
  8572. TimestampRolloverStream: lu,
  8573. handleRollover: uu
  8574. },
  8575. hu = cu.TimestampRolloverStream,
  8576. fu = cu.handleRollover,
  8577. pu = Object.freeze({
  8578. default: cu,
  8579. __moduleExports: cu,
  8580. TimestampRolloverStream: hu,
  8581. handleRollover: fu
  8582. }),
  8583. mu = ou && ru || ou,
  8584. gu = function(e, t, i) {
  8585. var r, n = "";
  8586. for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2);
  8587. return n
  8588. },
  8589. vu = function(e, t, i) {
  8590. return decodeURIComponent(gu(e, t, i))
  8591. },
  8592. yu = function(e) {
  8593. return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
  8594. },
  8595. _u = {
  8596. TXXX: function(e) {
  8597. var t;
  8598. if (3 === e.data[0]) {
  8599. for (t = 1; t < e.data.length; t++)
  8600. if (0 === e.data[t]) {
  8601. e.description = vu(e.data, 1, t), e.value = vu(e.data, t + 1, e.data.length).replace(/\0*$/, "");
  8602. break
  8603. } e.data = e.value
  8604. }
  8605. },
  8606. WXXX: function(e) {
  8607. var t;
  8608. if (3 === e.data[0])
  8609. for (t = 1; t < e.data.length; t++)
  8610. if (0 === e.data[t]) {
  8611. e.description = vu(e.data, 1, t), e.url = vu(e.data, t + 1, e.data.length);
  8612. break
  8613. }
  8614. },
  8615. PRIV: function(e) {
  8616. var t, i;
  8617. for (t = 0; t < e.data.length; t++)
  8618. if (0 === e.data[t]) {
  8619. e.owner = (i = e.data, unescape(gu(i, 0, t)));
  8620. break
  8621. } e.privateData = e.data.subarray(t + 1), e.data = e.privateData
  8622. }
  8623. };
  8624. (du = function(e) {
  8625. var t, i = {
  8626. debug: !(!e || !e.debug),
  8627. descriptor: e && e.descriptor
  8628. },
  8629. r = 0,
  8630. n = [],
  8631. a = 0;
  8632. if (du.prototype.init.call(this), this.dispatchType = mu.METADATA_STREAM_TYPE.toString(16), i.descriptor)
  8633. for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString(16)).slice(-
  8634. 2);
  8635. this.push = function(e) {
  8636. var t, s, o, u, l;
  8637. if ("timed-metadata" === e.type)
  8638. if (e.dataAlignmentIndicator && (a = 0, n.length = 0), 0 === n.length && (e.data.length < 10 || e.data[
  8639. 0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !== "3".charCodeAt(0))) i
  8640. .debug && console.log("Skipping unrecognized metadata packet");
  8641. else if (n.push(e), a += e.data.byteLength, 1 === n.length && (r = yu(e.data.subarray(6, 10)), r += 10), !
  8642. (a < r)) {
  8643. for (t = {
  8644. data: new Uint8Array(r),
  8645. frames: [],
  8646. pts: n[0].pts,
  8647. dts: n[0].dts
  8648. }, l = 0; l < r;) t.data.set(n[0].data.subarray(0, r - l), l), l += n[0].data.byteLength, a -= n[0].data
  8649. .byteLength, n.shift();
  8650. s = 10, 64 & t.data[5] && (s += 4, s += yu(t.data.subarray(10, 14)), r -= yu(t.data.subarray(16, 20)));
  8651. do {
  8652. if ((o = yu(t.data.subarray(s + 4, s + 8))) < 1) return console.log(
  8653. "Malformed ID3 frame encountered. Skipping metadata parsing.");
  8654. if ((u = {
  8655. id: String.fromCharCode(t.data[s], t.data[s + 1], t.data[s + 2], t.data[s + 3]),
  8656. data: t.data.subarray(s + 10, s + o + 10)
  8657. }).key = u.id, _u[u.id] && (_u[u.id](u), "com.apple.streaming.transportStreamTimestamp" === u
  8658. .owner)) {
  8659. var d = u.data,
  8660. c = (1 & d[3]) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;
  8661. c *= 4, c += 3 & d[7], u.timeStamp = c, void 0 === t.pts && void 0 === t.dts && (t.pts = u.timeStamp,
  8662. t.dts = u.timeStamp), this.trigger("timestamp", u)
  8663. }
  8664. t.frames.push(u), s += 10, s += o
  8665. } while (s < r);
  8666. this.trigger("data", t)
  8667. }
  8668. }
  8669. }).prototype = new qo;
  8670. var bu, wu, Eu, Tu = du,
  8671. Su = Object.freeze({
  8672. default: Tu,
  8673. __moduleExports: Tu
  8674. }),
  8675. Au = iu && $o || iu,
  8676. ku = pu && cu || pu,
  8677. Ru = Su && Tu || Su,
  8678. Mu = ku.TimestampRolloverStream;
  8679. (bu = function() {
  8680. var e = new Uint8Array(188),
  8681. t = 0;
  8682. bu.prototype.init.call(this), this.push = function(i) {
  8683. var r, n = 0,
  8684. a = 188;
  8685. for (t ? ((r = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), r.set(i, t), t = 0) : r = i; a < r
  8686. .byteLength;) 71 !== r[n] || 71 !== r[a] ? (n++, a++) : (this.trigger("data", r.subarray(n, a)), n += 188,
  8687. a += 188);
  8688. n < r.byteLength && (e.set(r.subarray(n), 0), t = r.byteLength - n)
  8689. }, this.flush = function() {
  8690. 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done")
  8691. }
  8692. }).prototype = new qo, (wu = function() {
  8693. var e, t, i, r;
  8694. wu.prototype.init.call(this), r = this, this.packetsWaitingForPmt = [], this.programMapTable = void 0, e =
  8695. function(e, r) {
  8696. var n = 0;
  8697. r.payloadUnitStartIndicator && (n += e[n] + 1), "pat" === r.type ? t(e.subarray(n), r) : i(e.subarray(n),
  8698. r)
  8699. }, t = function(e, t) {
  8700. t.section_number = e[7], t.last_section_number = e[8], r.pmtPid = (31 & e[10]) << 8 | e[11], t.pmtPid = r
  8701. .pmtPid
  8702. }, i = function(e, t) {
  8703. var i, n;
  8704. if (1 & e[5]) {
  8705. for (r.programMapTable = {
  8706. video: null,
  8707. audio: null,
  8708. "timed-metadata": {}
  8709. }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, n = 12 + ((15 & e[10]) << 8 | e[11]); n < i;) {
  8710. var a = e[n],
  8711. s = (31 & e[n + 1]) << 8 | e[n + 2];
  8712. a === mu.H264_STREAM_TYPE && null === r.programMapTable.video ? r.programMapTable.video = s : a === mu
  8713. .ADTS_STREAM_TYPE && null === r.programMapTable.audio ? r.programMapTable.audio = s : a === mu
  8714. .METADATA_STREAM_TYPE && (r.programMapTable["timed-metadata"][s] = a), n += 5 + ((15 & e[n + 3]) <<
  8715. 8 | e[n + 4])
  8716. }
  8717. t.programMapTable = r.programMapTable
  8718. }
  8719. }, this.push = function(t) {
  8720. var i = {},
  8721. r = 4;
  8722. if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[2], (48 & t[
  8723. 3]) >>> 4 > 1 && (r += t[r] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(r), i), this.trigger(
  8724. "data", i);
  8725. else if (i.pid === this.pmtPid)
  8726. for (i.type = "pmt", e(t.subarray(r), i), this.trigger("data", i); this.packetsWaitingForPmt.length;)
  8727. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  8728. else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, r, i]) : this.processPes_(t, r,
  8729. i)
  8730. }, this.processPes_ = function(e, t, i) {
  8731. i.pid === this.programMapTable.video ? i.streamType = mu.H264_STREAM_TYPE : i.pid === this.programMapTable
  8732. .audio ? i.streamType = mu.ADTS_STREAM_TYPE : i.streamType = this.programMapTable["timed-metadata"][i
  8733. .pid
  8734. ], i.type = "pes", i.data = e.subarray(t), this.trigger("data", i)
  8735. }
  8736. }).prototype = new qo, wu.STREAM_TYPES = {
  8737. h264: 27,
  8738. adts: 15
  8739. }, (Eu = function() {
  8740. var e = this,
  8741. t = {
  8742. data: [],
  8743. size: 0
  8744. },
  8745. i = {
  8746. data: [],
  8747. size: 0
  8748. },
  8749. r = {
  8750. data: [],
  8751. size: 0
  8752. },
  8753. n = function(t, i, r) {
  8754. var n, a, s = new Uint8Array(t.size),
  8755. o = {
  8756. type: i
  8757. },
  8758. u = 0,
  8759. l = 0;
  8760. if (t.data.length && !(t.size < 9)) {
  8761. for (o.trackId = t.data[0].pid, u = 0; u < t.data.length; u++) a = t.data[u], s.set(a.data, l), l += a
  8762. .data.byteLength;
  8763. var d, c, h;
  8764. d = s, (c = o).packetLength = 6 + (d[4] << 8 | d[5]), c.dataAlignmentIndicator = 0 != (4 & d[6]), 192 &
  8765. (h = d[7]) && (c.pts = (14 & d[9]) << 27 | (255 & d[10]) << 20 | (254 & d[11]) << 12 | (255 & d[
  8766. 12]) << 5 | (254 & d[13]) >>> 3, c.pts *= 4, c.pts += (6 & d[13]) >>> 1, c.dts = c.pts, 64 & h && (c
  8767. .dts = (14 & d[14]) << 27 | (255 & d[15]) << 20 | (254 & d[16]) << 12 | (255 & d[17]) << 5 | (
  8768. 254 & d[18]) >>> 3, c.dts *= 4, c.dts += (6 & d[18]) >>> 1)), c.data = d.subarray(9 + d[8]), n =
  8769. "video" === i || o.packetLength <= t.size, (r || n) && (t.size = 0, t.data.length = 0), n && e
  8770. .trigger("data", o)
  8771. }
  8772. };
  8773. Eu.prototype.init.call(this), this.push = function(a) {
  8774. ({
  8775. pat: function() {},
  8776. pes: function() {
  8777. var e, s;
  8778. switch (a.streamType) {
  8779. case mu.H264_STREAM_TYPE:
  8780. case mu.H264_STREAM_TYPE:
  8781. e = t, s = "video";
  8782. break;
  8783. case mu.ADTS_STREAM_TYPE:
  8784. e = i, s = "audio";
  8785. break;
  8786. case mu.METADATA_STREAM_TYPE:
  8787. e = r, s = "timed-metadata";
  8788. break;
  8789. default:
  8790. return
  8791. }
  8792. a.payloadUnitStartIndicator && n(e, s, !0), e.data.push(a), e.size += a.data.byteLength
  8793. },
  8794. pmt: function() {
  8795. var t = {
  8796. type: "metadata",
  8797. tracks: []
  8798. },
  8799. i = a.programMapTable;
  8800. null !== i.video && t.tracks.push({
  8801. timelineStartInfo: {
  8802. baseMediaDecodeTime: 0
  8803. },
  8804. id: +i.video,
  8805. codec: "avc",
  8806. type: "video"
  8807. }), null !== i.audio && t.tracks.push({
  8808. timelineStartInfo: {
  8809. baseMediaDecodeTime: 0
  8810. },
  8811. id: +i.audio,
  8812. codec: "adts",
  8813. type: "audio"
  8814. }), e.trigger("data", t)
  8815. }
  8816. })[a.type]()
  8817. }, this.flush = function() {
  8818. n(t, "video"), n(i, "audio"), n(r, "timed-metadata"), this.trigger("done")
  8819. }
  8820. }).prototype = new qo;
  8821. var Ou = {
  8822. PAT_PID: 0,
  8823. MP2T_PACKET_LENGTH: 188,
  8824. TransportPacketStream: bu,
  8825. TransportParseStream: wu,
  8826. ElementaryStream: Eu,
  8827. TimestampRolloverStream: Mu,
  8828. CaptionStream: Au.CaptionStream,
  8829. Cea608Stream: Au.Cea608Stream,
  8830. MetadataStream: Ru
  8831. };
  8832. for (var Cu in mu) mu.hasOwnProperty(Cu) && (Ou[Cu] = mu[Cu]);
  8833. var Du, Iu = Ou,
  8834. Lu = Object.freeze({
  8835. default: Iu,
  8836. __moduleExports: Iu
  8837. }),
  8838. xu = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  8839. (Du = function() {
  8840. var e;
  8841. Du.prototype.init.call(this), this.push = function(t) {
  8842. var i, r, n, a, s, o, u = 0,
  8843. l = 0;
  8844. if ("audio" === t.type)
  8845. for (e ? (a = e, (e = new Uint8Array(a.byteLength + t.data.byteLength)).set(a), e.set(t.data, a
  8846. .byteLength)) : e = t.data; u + 5 < e.length;)
  8847. if (255 === e[u] && 240 == (246 & e[u + 1])) {
  8848. if (r = 2 * (1 & ~e[u + 1]), i = (3 & e[u + 3]) << 11 | e[u + 4] << 3 | (224 & e[u + 5]) >> 5, o =
  8849. 9e4 * (s = 1024 * (1 + (3 & e[u + 6]))) / xu[(60 & e[u + 2]) >>> 2], n = u + i, e.byteLength < n)
  8850. return;
  8851. if (this.trigger("data", {
  8852. pts: t.pts + l * o,
  8853. dts: t.dts + l * o,
  8854. sampleCount: s,
  8855. audioobjecttype: 1 + (e[u + 2] >>> 6 & 3),
  8856. channelcount: (1 & e[u + 2]) << 2 | (192 & e[u + 3]) >>> 6,
  8857. samplerate: xu[(60 & e[u + 2]) >>> 2],
  8858. samplingfrequencyindex: (60 & e[u + 2]) >>> 2,
  8859. samplesize: 16,
  8860. data: e.subarray(u + 7 + r, n)
  8861. }), e.byteLength === n) return void(e = void 0);
  8862. l++, e = e.subarray(n)
  8863. } else u++
  8864. }, this.flush = function() {
  8865. this.trigger("done")
  8866. }
  8867. }).prototype = new qo;
  8868. var Pu, Uu, Nu, Bu = Du,
  8869. Fu = Object.freeze({
  8870. default: Bu,
  8871. __moduleExports: Bu
  8872. }),
  8873. ju = function(e) {
  8874. var t = e.byteLength,
  8875. i = 0,
  8876. r = 0;
  8877. this.length = function() {
  8878. return 8 * t
  8879. }, this.bitsAvailable = function() {
  8880. return 8 * t + r
  8881. }, this.loadWord = function() {
  8882. var n = e.byteLength - t,
  8883. a = new Uint8Array(4),
  8884. s = Math.min(4, t);
  8885. if (0 === s) throw new Error("no bytes available");
  8886. a.set(e.subarray(n, n + s)), i = new DataView(a.buffer).getUint32(0), r = 8 * s, t -= s
  8887. }, this.skipBits = function(e) {
  8888. var n;
  8889. r > e ? (i <<= e, r -= e) : (e -= r, e -= 8 * (n = Math.floor(e / 8)), t -= n, this.loadWord(), i <<= e,
  8890. r -= e)
  8891. }, this.readBits = function(e) {
  8892. var n = Math.min(r, e),
  8893. a = i >>> 32 - n;
  8894. return (r -= n) > 0 ? i <<= n : t > 0 && this.loadWord(), (n = e - n) > 0 ? a << n | this.readBits(n) : a
  8895. }, this.skipLeadingZeros = function() {
  8896. var e;
  8897. for (e = 0; e < r; ++e)
  8898. if (0 != (i & 2147483648 >>> e)) return i <<= e, r -= e, e;
  8899. return this.loadWord(), e + this.skipLeadingZeros()
  8900. }, this.skipUnsignedExpGolomb = function() {
  8901. this.skipBits(1 + this.skipLeadingZeros())
  8902. }, this.skipExpGolomb = function() {
  8903. this.skipBits(1 + this.skipLeadingZeros())
  8904. }, this.readUnsignedExpGolomb = function() {
  8905. var e = this.skipLeadingZeros();
  8906. return this.readBits(e + 1) - 1
  8907. }, this.readExpGolomb = function() {
  8908. var e = this.readUnsignedExpGolomb();
  8909. return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
  8910. }, this.readBoolean = function() {
  8911. return 1 === this.readBits(1)
  8912. }, this.readUnsignedByte = function() {
  8913. return this.readBits(8)
  8914. }, this.loadWord()
  8915. },
  8916. Hu = Object.freeze({
  8917. default: ju,
  8918. __moduleExports: ju
  8919. }),
  8920. Gu = Hu && ju || Hu;
  8921. (Uu = function() {
  8922. var e, t, i = 0;
  8923. Uu.prototype.init.call(this), this.push = function(r) {
  8924. var n;
  8925. for (t ? ((n = new Uint8Array(t.byteLength + r.data.byteLength)).set(t), n.set(r.data, t.byteLength), t =
  8926. n) : t = r.data; i < t.byteLength - 3; i++)
  8927. if (1 === t[i + 2]) {
  8928. e = i + 5;
  8929. break
  8930. } for (; e < t.byteLength;) switch (t[e]) {
  8931. case 0:
  8932. if (0 !== t[e - 1]) {
  8933. e += 2;
  8934. break
  8935. }
  8936. if (0 !== t[e - 2]) {
  8937. e++;
  8938. break
  8939. }
  8940. i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2));
  8941. do {
  8942. e++
  8943. } while (1 !== t[e] && e < t.length);
  8944. i = e - 2, e += 3;
  8945. break;
  8946. case 1:
  8947. if (0 !== t[e - 1] || 0 !== t[e - 2]) {
  8948. e += 3;
  8949. break
  8950. }
  8951. this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3;
  8952. break;
  8953. default:
  8954. e += 3
  8955. }
  8956. t = t.subarray(i), e -= i, i = 0
  8957. }, this.flush = function() {
  8958. t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger("done")
  8959. }
  8960. }).prototype = new qo, Nu = {
  8961. 100: !0,
  8962. 110: !0,
  8963. 122: !0,
  8964. 244: !0,
  8965. 44: !0,
  8966. 83: !0,
  8967. 86: !0,
  8968. 118: !0,
  8969. 128: !0,
  8970. 138: !0,
  8971. 139: !0,
  8972. 134: !0
  8973. }, (Pu = function() {
  8974. var e, t, i, r, n, a, s, o = new Uu;
  8975. Pu.prototype.init.call(this), e = this, this.push = function(e) {
  8976. "video" === e.type && (t = e.trackId, i = e.pts, r = e.dts, o.push(e))
  8977. }, o.on("data", function(s) {
  8978. var o = {
  8979. trackId: t,
  8980. pts: i,
  8981. dts: r,
  8982. data: s
  8983. };
  8984. switch (31 & s[0]) {
  8985. case 5:
  8986. o.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  8987. break;
  8988. case 6:
  8989. o.nalUnitType = "sei_rbsp", o.escapedRBSP = n(s.subarray(1));
  8990. break;
  8991. case 7:
  8992. o.nalUnitType = "seq_parameter_set_rbsp", o.escapedRBSP = n(s.subarray(1)), o.config = a(o
  8993. .escapedRBSP);
  8994. break;
  8995. case 8:
  8996. o.nalUnitType = "pic_parameter_set_rbsp";
  8997. break;
  8998. case 9:
  8999. o.nalUnitType = "access_unit_delimiter_rbsp"
  9000. }
  9001. e.trigger("data", o)
  9002. }), o.on("done", function() {
  9003. e.trigger("done")
  9004. }), this.flush = function() {
  9005. o.flush()
  9006. }, s = function(e, t) {
  9007. var i, r = 8,
  9008. n = 8;
  9009. for (i = 0; i < e; i++) 0 !== n && (n = (r + t.readExpGolomb() + 256) % 256), r = 0 === n ? r : n
  9010. }, n = function(e) {
  9011. for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a +
  9012. 2] ? (n.push(a + 2), a += 2) : a++;
  9013. if (0 === n.length) return e;
  9014. t = r - n.length, i = new Uint8Array(t);
  9015. var s = 0;
  9016. for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s];
  9017. return i
  9018. }, a = function(e) {
  9019. var t, i, r, n, a, o, u, l, d, c, h, f, p, m = 0,
  9020. g = 0,
  9021. v = 0,
  9022. y = 0,
  9023. _ = 1;
  9024. if (i = (t = new Gu(e)).readUnsignedByte(), n = t.readUnsignedByte(), r = t.readUnsignedByte(), t
  9025. .skipUnsignedExpGolomb(), Nu[i] && (3 === (a = t.readUnsignedExpGolomb()) && t.skipBits(1), t
  9026. .skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean()))
  9027. for (h = 3 !== a ? 8 : 12, p = 0; p < h; p++) t.readBoolean() && s(p < 6 ? 16 : 64, t);
  9028. if (t.skipUnsignedExpGolomb(), 0 === (o = t.readUnsignedExpGolomb())) t.readUnsignedExpGolomb();
  9029. else if (1 === o)
  9030. for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), u = t.readUnsignedExpGolomb(), p = 0; p <
  9031. u; p++) t.skipExpGolomb();
  9032. if (t.skipUnsignedExpGolomb(), t.skipBits(1), l = t.readUnsignedExpGolomb(), d = t
  9033. .readUnsignedExpGolomb(), 0 === (c = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t.readBoolean() && (
  9034. m = t.readUnsignedExpGolomb(), g = t.readUnsignedExpGolomb(), v = t.readUnsignedExpGolomb(), y = t
  9035. .readUnsignedExpGolomb()), t.readBoolean() && t.readBoolean()) {
  9036. switch (t.readUnsignedByte()) {
  9037. case 1:
  9038. f = [1, 1];
  9039. break;
  9040. case 2:
  9041. f = [12, 11];
  9042. break;
  9043. case 3:
  9044. f = [10, 11];
  9045. break;
  9046. case 4:
  9047. f = [16, 11];
  9048. break;
  9049. case 5:
  9050. f = [40, 33];
  9051. break;
  9052. case 6:
  9053. f = [24, 11];
  9054. break;
  9055. case 7:
  9056. f = [20, 11];
  9057. break;
  9058. case 8:
  9059. f = [32, 11];
  9060. break;
  9061. case 9:
  9062. f = [80, 33];
  9063. break;
  9064. case 10:
  9065. f = [18, 11];
  9066. break;
  9067. case 11:
  9068. f = [15, 11];
  9069. break;
  9070. case 12:
  9071. f = [64, 33];
  9072. break;
  9073. case 13:
  9074. f = [160, 99];
  9075. break;
  9076. case 14:
  9077. f = [4, 3];
  9078. break;
  9079. case 15:
  9080. f = [3, 2];
  9081. break;
  9082. case 16:
  9083. f = [2, 1];
  9084. break;
  9085. case 255:
  9086. f = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t
  9087. .readUnsignedByte()
  9088. ]
  9089. }
  9090. f && (_ = f[0] / f[1])
  9091. }
  9092. return {
  9093. profileIdc: i,
  9094. levelIdc: r,
  9095. profileCompatibility: n,
  9096. width: Math.ceil((16 * (l + 1) - 2 * m - 2 * g) * _),
  9097. height: (2 - c) * (d + 1) * 16 - 2 * v - 2 * y
  9098. }
  9099. }
  9100. }).prototype = new qo;
  9101. var Vu, Wu = {
  9102. H264Stream: Pu,
  9103. NalByteStream: Uu
  9104. },
  9105. qu = Wu.H264Stream,
  9106. Xu = Wu.NalByteStream,
  9107. zu = Object.freeze({
  9108. default: Wu,
  9109. __moduleExports: Wu,
  9110. H264Stream: qu,
  9111. NalByteStream: Xu
  9112. });
  9113. (Vu = function() {
  9114. var e = new Uint8Array,
  9115. t = 0;
  9116. Vu.prototype.init.call(this), this.setTimestamp = function(e) {
  9117. t = e
  9118. }, this.parseId3TagSize = function(e, t) {
  9119. var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
  9120. return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10
  9121. }, this.parseAdtsSize = function(e, t) {
  9122. var i = (224 & e[t + 5]) >> 5,
  9123. r = e[t + 4] << 3;
  9124. return 6144 & e[t + 3] | r | i
  9125. }, this.push = function(i) {
  9126. var r, n, a, s, o = 0,
  9127. u = 0;
  9128. for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e.set(i, s)) :
  9129. e = i; e.length - u >= 3;)
  9130. if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3".charCodeAt(0))
  9131. if (!0 & e[u] && 240 == (240 & e[u + 1])) {
  9132. if (e.length - u < 7) break;
  9133. if ((o = this.parseAdtsSize(e, u)) > e.length) break;
  9134. a = {
  9135. type: "audio",
  9136. data: e.subarray(u, u + o),
  9137. pts: t,
  9138. dts: t
  9139. }, this.trigger("data", a), u += o
  9140. } else u++;
  9141. else {
  9142. if (e.length - u < 10) break;
  9143. if ((o = this.parseId3TagSize(e, u)) > e.length) break;
  9144. n = {
  9145. type: "timed-metadata",
  9146. data: e.subarray(u, u + o)
  9147. }, this.trigger("data", n), u += o
  9148. }
  9149. r = e.length - u, e = r > 0 ? e.subarray(u) : new Uint8Array
  9150. }
  9151. }).prototype = new qo;
  9152. var Ku, Yu, Qu, Ju, Zu, $u, el, tl, il, rl, nl, al, sl = Vu,
  9153. ol = Object.freeze({
  9154. default: sl,
  9155. __moduleExports: sl
  9156. }),
  9157. ul = [33, 16, 5, 32, 164, 27],
  9158. ll = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252],
  9159. dl = function(e) {
  9160. for (var t = []; e--;) t.push(0);
  9161. return t
  9162. },
  9163. cl = {
  9164. 96000: [ul, [227, 64], dl(154), [56]],
  9165. 88200: [ul, [231], dl(170), [56]],
  9166. 64000: [ul, [248, 192], dl(240), [56]],
  9167. 48000: [ul, [255, 192], dl(268), [55, 148, 128], dl(54), [112]],
  9168. 44100: [ul, [255, 192], dl(268), [55, 163, 128], dl(84), [112]],
  9169. 32000: [ul, [255, 192], dl(268), [55, 234], dl(226), [112]],
  9170. 24000: [ul, [255, 192], dl(268), [55, 255, 128], dl(268), [111, 112], dl(126), [224]],
  9171. 16000: [ul, [255, 192], dl(268), [55, 255, 128], dl(268), [111, 255], dl(269), [223, 108], dl(195), [1, 192]],
  9172. 12000: [ll, dl(268), [3, 127, 248], dl(268), [6, 255, 240], dl(268), [13, 255, 224], dl(268), [27, 253, 128],
  9173. dl(259), [56]
  9174. ],
  9175. 11025: [ll, dl(268), [3, 127, 248], dl(268), [6, 255, 240], dl(268), [13, 255, 224], dl(268), [27, 255, 192],
  9176. dl(268), [55, 175, 128], dl(108), [112]
  9177. ],
  9178. 8000: [ll, dl(268), [3, 121, 16], dl(47), [7]]
  9179. },
  9180. hl = (Ku = cl, Object.keys(Ku).reduce(function(e, t) {
  9181. return e[t] = new Uint8Array(Ku[t].reduce(function(e, t) {
  9182. return e.concat(t)
  9183. }, [])), e
  9184. }, {})),
  9185. fl = Object.freeze({
  9186. default: hl,
  9187. __moduleExports: hl
  9188. }),
  9189. pl = {
  9190. secondsToVideoTs: Yu = function(e) {
  9191. return 9e4 * e
  9192. },
  9193. secondsToAudioTs: Qu = function(e, t) {
  9194. return e * t
  9195. },
  9196. videoTsToSeconds: Ju = function(e) {
  9197. return e / 9e4
  9198. },
  9199. audioTsToSeconds: Zu = function(e, t) {
  9200. return e / t
  9201. },
  9202. audioTsToVideoTs: function(e, t) {
  9203. return Yu(Zu(e, t))
  9204. },
  9205. videoTsToAudioTs: function(e, t) {
  9206. return Qu(Ju(e), t)
  9207. }
  9208. },
  9209. ml = pl.secondsToVideoTs,
  9210. gl = pl.secondsToAudioTs,
  9211. vl = pl.videoTsToSeconds,
  9212. yl = pl.audioTsToSeconds,
  9213. _l = pl.audioTsToVideoTs,
  9214. bl = pl.videoTsToAudioTs,
  9215. wl = Object.freeze({
  9216. default: pl,
  9217. __moduleExports: pl,
  9218. secondsToVideoTs: ml,
  9219. secondsToAudioTs: gl,
  9220. videoTsToSeconds: vl,
  9221. audioTsToSeconds: yl,
  9222. audioTsToVideoTs: _l,
  9223. videoTsToAudioTs: bl
  9224. }),
  9225. El = wo && mo || wo,
  9226. Tl = Io && ko || Io,
  9227. Sl = No && Lo || No,
  9228. Al = Lu && Iu || Lu,
  9229. kl = Fu && Bu || Fu,
  9230. Rl = ol && sl || ol,
  9231. Ml = fl && hl || fl,
  9232. Ol = wl && pl || wl,
  9233. Cl = (zu && Wu || zu).H264Stream,
  9234. Dl = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"],
  9235. Il = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility"];
  9236. rl = function(e) {
  9237. return e[0] === "I".charCodeAt(0) && e[1] === "D".charCodeAt(0) && e[2] === "3".charCodeAt(0)
  9238. }, nl = function(e, t) {
  9239. var i;
  9240. if (e.length !== t.length) return !1;
  9241. for (i = 0; i < e.length; i++)
  9242. if (e[i] !== t[i]) return !1;
  9243. return !0
  9244. }, al = function(e) {
  9245. var t, i = 0;
  9246. for (t = 0; t < e.length; t++) i += e[t].data.byteLength;
  9247. return i
  9248. }, (el = function(e, t) {
  9249. var i = [],
  9250. r = 0,
  9251. n = 0,
  9252. a = 0,
  9253. s = 1 / 0;
  9254. t = t || {}, el.prototype.init.call(this), this.push = function(t) {
  9255. Sl.collectDtsInfo(e, t), e && Dl.forEach(function(i) {
  9256. e[i] = t[i]
  9257. }), i.push(t)
  9258. }, this.setEarliestDts = function(t) {
  9259. n = t - e.timelineStartInfo.baseMediaDecodeTime
  9260. }, this.setVideoBaseMediaDecodeTime = function(e) {
  9261. s = e
  9262. }, this.setAudioAppendStart = function(e) {
  9263. a = e
  9264. }, this.flush = function() {
  9265. var n, a, s, o;
  9266. 0 !== i.length ? (n = this.trimAdtsFramesByEarliestDts_(i), e.baseMediaDecodeTime = Sl
  9267. .calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), this.prefixWithSilence_(e, n), e
  9268. .samples = this.generateSampleTable_(n), s = El.mdat(this.concatenateFrameData_(n)), i = [], a = El
  9269. .moof(r, [e]), o = new Uint8Array(a.byteLength + s.byteLength), r++, o.set(a), o.set(s, a.byteLength),
  9270. Sl.clearDtsInfo(e), this.trigger("data", {
  9271. track: e,
  9272. boxes: o
  9273. }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done", "AudioSegmentStream")
  9274. }, this.prefixWithSilence_ = function(e, t) {
  9275. var i, r, n, o, u = 0,
  9276. l = 0,
  9277. d = 0;
  9278. if (t.length && (i = Ol.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate), r = Math.ceil(9e4 / (e
  9279. .samplerate / 1024)), a && s && (u = i - Math.max(a, s), d = (l = Math.floor(u / r)) * r), !(l <
  9280. 1 || d > 45e3))) {
  9281. for ((n = Ml[e.samplerate]) || (n = t[0].data), o = 0; o < l; o++) t.splice(o, 0, {
  9282. data: n
  9283. });
  9284. e.baseMediaDecodeTime -= Math.floor(Ol.videoTsToAudioTs(d, e.samplerate))
  9285. }
  9286. }, this.trimAdtsFramesByEarliestDts_ = function(t) {
  9287. return e.minSegmentDts >= n ? t : (e.minSegmentDts = 1 / 0, t.filter(function(t) {
  9288. return t.dts >= n && (e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), e.minSegmentPts = e
  9289. .minSegmentDts, !0)
  9290. }))
  9291. }, this.generateSampleTable_ = function(e) {
  9292. var t, i, r = [];
  9293. for (t = 0; t < e.length; t++) i = e[t], r.push({
  9294. size: i.data.byteLength,
  9295. duration: 1024
  9296. });
  9297. return r
  9298. }, this.concatenateFrameData_ = function(e) {
  9299. var t, i, r = 0,
  9300. n = new Uint8Array(al(e));
  9301. for (t = 0; t < e.length; t++) i = e[t], n.set(i.data, r), r += i.data.byteLength;
  9302. return n
  9303. }
  9304. }).prototype = new qo, ($u = function(e, t) {
  9305. var i, r, n = 0,
  9306. a = [],
  9307. s = [];
  9308. t = t || {}, $u.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push = function(t) {
  9309. Sl.collectDtsInfo(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config, e.sps = [t
  9310. .data], Il.forEach(function(t) {
  9311. e[t] = i[t]
  9312. }, this)), "pic_parameter_set_rbsp" !== t.nalUnitType || r || (r = t.data, e.pps = [t.data]), a.push(t)
  9313. }, this.flush = function() {
  9314. for (var i, r, o, u, l, d; a.length && "access_unit_delimiter_rbsp" !== a[0].nalUnitType;) a.shift();
  9315. if (0 === a.length) return this.resetStream_(), void this.trigger("done", "VideoSegmentStream");
  9316. if (i = Tl.groupNalsIntoFrames(a), (o = Tl.groupFramesIntoGops(i))[0][0].keyFrame || ((r = this
  9317. .getGopForFusion_(a[0], e)) ? (o.unshift(r), o.byteLength += r.byteLength, o.nalCount += r.nalCount,
  9318. o.pts = r.pts, o.dts = r.dts, o.duration += r.duration) : o = Tl.extendFirstKeyFrame(o)), s.length) {
  9319. var c;
  9320. if (!(c = t.alignGopsAtEnd ? this.alignGopsAtEnd_(o) : this.alignGopsAtStart_(o))) return this.gopCache_
  9321. .unshift({
  9322. gop: o.pop(),
  9323. pps: e.pps,
  9324. sps: e.sps
  9325. }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.resetStream_(),
  9326. void this.trigger("done", "VideoSegmentStream");
  9327. Sl.clearDtsInfo(e), o = c
  9328. }
  9329. Sl.collectDtsInfo(e, o), e.samples = Tl.generateSampleTable(o), l = El.mdat(Tl.concatenateNalData(o)), e
  9330. .baseMediaDecodeTime = Sl.calculateTrackBaseMediaDecodeTime(e, t.keepOriginalTimestamps), this.trigger(
  9331. "processedGopsInfo", o.map(function(e) {
  9332. return {
  9333. pts: e.pts,
  9334. dts: e.dts,
  9335. byteLength: e.byteLength
  9336. }
  9337. })), this.gopCache_.unshift({
  9338. gop: o.pop(),
  9339. pps: e.pps,
  9340. sps: e.sps
  9341. }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.trigger(
  9342. "baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e.timelineStartInfo),
  9343. u = El.moof(n, [e]), d = new Uint8Array(u.byteLength + l.byteLength), n++, d.set(u), d.set(l, u
  9344. .byteLength), this.trigger("data", {
  9345. track: e,
  9346. boxes: d
  9347. }), this.resetStream_(), this.trigger("done", "VideoSegmentStream")
  9348. }, this.resetStream_ = function() {
  9349. Sl.clearDtsInfo(e), i = void 0, r = void 0
  9350. }, this.getGopForFusion_ = function(t) {
  9351. var i, r, n, a, s, o = 1 / 0;
  9352. for (s = 0; s < this.gopCache_.length; s++) n = (a = this.gopCache_[s]).gop, e.pps && nl(e.pps[0], a.pps[
  9353. 0]) && e.sps && nl(e.sps[0], a.sps[0]) && (n.dts < e.timelineStartInfo.dts || (i = t.dts - n.dts - n
  9354. .duration) >= -1e4 && i <= 45e3 && (!r || o > i) && (r = a, o = i));
  9355. return r ? r.gop : null
  9356. }, this.alignGopsAtStart_ = function(e) {
  9357. var t, i, r, n, a, o, u, l;
  9358. for (a = e.byteLength, o = e.nalCount, u = e.duration, t = i = 0; t < s.length && i < e.length && (r = s[
  9359. t], n = e[i], r.pts !== n.pts);) n.pts > r.pts ? t++ : (i++, a -= n.byteLength, o -= n.nalCount, u -=
  9360. n.duration);
  9361. return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u, l
  9362. .nalCount = o, l.pts = l[0].pts, l.dts = l[0].dts, l)
  9363. }, this.alignGopsAtEnd_ = function(e) {
  9364. var t, i, r, n, a, o, u;
  9365. for (t = s.length - 1, i = e.length - 1, a = null, o = !1; t >= 0 && i >= 0;) {
  9366. if (r = s[t], n = e[i], r.pts === n.pts) {
  9367. o = !0;
  9368. break
  9369. }
  9370. r.pts > n.pts ? t-- : (t === s.length - 1 && (a = i), i--)
  9371. }
  9372. if (!o && null === a) return null;
  9373. if (0 === (u = o ? i : a)) return e;
  9374. var l = e.slice(u),
  9375. d = l.reduce(function(e, t) {
  9376. return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount, e
  9377. }, {
  9378. byteLength: 0,
  9379. duration: 0,
  9380. nalCount: 0
  9381. });
  9382. return l.byteLength = d.byteLength, l.duration = d.duration, l.nalCount = d.nalCount, l.pts = l[0].pts, l
  9383. .dts = l[0].dts, l
  9384. }, this.alignGopsWith = function(e) {
  9385. s = e
  9386. }
  9387. }).prototype = new qo, (il = function(e, t) {
  9388. this.numberOfTracks = 0, this.metadataStream = t, void 0 !== e.remux ? this.remuxTracks = !!e.remux : this
  9389. .remuxTracks = !0, this.pendingTracks = [], this.videoTrack = null, this.pendingBoxes = [], this
  9390. .pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0, this.emittedTracks = 0, il
  9391. .prototype.init.call(this), this.push = function(e) {
  9392. return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this
  9393. .pendingTracks.push(e.track), this.pendingBoxes.push(e.boxes), this.pendingBytes += e.boxes
  9394. .byteLength, "video" === e.track.type && (this.videoTrack = e.track), void("audio" === e.track.type &&
  9395. (this.audioTrack = e.track)))
  9396. }
  9397. }).prototype = new qo, il.prototype.flush = function(e) {
  9398. var t, i, r, n, a = 0,
  9399. s = {
  9400. captions: [],
  9401. captionStreams: {},
  9402. metadata: [],
  9403. info: {}
  9404. },
  9405. o = 0;
  9406. if (this.pendingTracks.length < this.numberOfTracks) {
  9407. if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return;
  9408. if (this.remuxTracks) return;
  9409. if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this
  9410. .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0))
  9411. }
  9412. for (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, Il.forEach(function(e) {
  9413. s.info[e] = this.videoTrack[e]
  9414. }, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, Dl.forEach(function(e) {
  9415. s.info[e] = this.audioTrack[e]
  9416. }, this)), 1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type = "combined", this
  9417. .emittedTracks += this.pendingTracks.length, r = El.initSegment(this.pendingTracks), s.initSegment =
  9418. new Uint8Array(r.byteLength), s.initSegment.set(r), s.data = new Uint8Array(this.pendingBytes), n = 0; n <
  9419. this.pendingBoxes.length; n++) s.data.set(this.pendingBoxes[n], a), a += this.pendingBoxes[n].byteLength;
  9420. for (n = 0; n < this.pendingCaptions.length; n++)(t = this.pendingCaptions[n]).startTime = t.startPts - o, t
  9421. .startTime /= 9e4, t.endTime = t.endPts - o, t.endTime /= 9e4, s.captionStreams[t.stream] = !0, s.captions
  9422. .push(t);
  9423. for (n = 0; n < this.pendingMetadata.length; n++)(i = this.pendingMetadata[n]).cueTime = i.pts - o, i.cueTime /=
  9424. 9e4, s.metadata.push(i);
  9425. s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this.videoTrack =
  9426. null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes = 0, this
  9427. .pendingMetadata.length = 0, this.trigger("data", s), this.emittedTracks >= this.numberOfTracks && (this
  9428. .trigger("done"), this.emittedTracks = 0)
  9429. }, (tl = function(e) {
  9430. var t, i, r = this,
  9431. n = !0;
  9432. tl.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0, this
  9433. .transmuxPipeline_ = {}, this.setupAacPipeline = function() {
  9434. var t = {};
  9435. this.transmuxPipeline_ = t, t.type = "aac", t.metadataStream = new Al.MetadataStream, t.aacStream =
  9436. new Rl, t.audioTimestampRolloverStream = new Al.TimestampRolloverStream("audio"), t
  9437. .timedMetadataTimestampRolloverStream = new Al.TimestampRolloverStream("timed-metadata"), t.adtsStream =
  9438. new kl, t.coalesceStream = new il(e, t.metadataStream), t.headOfPipeline = t.aacStream, t.aacStream
  9439. .pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream), t.aacStream.pipe(t
  9440. .timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream), t.metadataStream
  9441. .on("timestamp", function(e) {
  9442. t.aacStream.setTimestamp(e.timeStamp)
  9443. }), t.aacStream.on("data", function(n) {
  9444. "timed-metadata" !== n.type || t.audioSegmentStream || (i = i || {
  9445. timelineStartInfo: {
  9446. baseMediaDecodeTime: r.baseMediaDecodeTime
  9447. },
  9448. codec: "adts",
  9449. type: "audio"
  9450. }, t.coalesceStream.numberOfTracks++, t.audioSegmentStream = new el(i, e), t.adtsStream.pipe(t
  9451. .audioSegmentStream).pipe(t.coalesceStream))
  9452. }), t.coalesceStream.on("data", this.trigger.bind(this, "data")), t.coalesceStream.on("done", this
  9453. .trigger.bind(this, "done"))
  9454. }, this.setupTsPipeline = function() {
  9455. var n = {};
  9456. this.transmuxPipeline_ = n, n.type = "ts", n.metadataStream = new Al.MetadataStream, n.packetStream =
  9457. new Al.TransportPacketStream, n.parseStream = new Al.TransportParseStream, n.elementaryStream = new Al
  9458. .ElementaryStream, n.videoTimestampRolloverStream = new Al.TimestampRolloverStream("video"), n
  9459. .audioTimestampRolloverStream = new Al.TimestampRolloverStream("audio"), n
  9460. .timedMetadataTimestampRolloverStream = new Al.TimestampRolloverStream("timed-metadata"), n.adtsStream =
  9461. new kl, n.h264Stream = new Cl, n.captionStream = new Al.CaptionStream, n.coalesceStream = new il(e, n
  9462. .metadataStream), n.headOfPipeline = n.packetStream, n.packetStream.pipe(n.parseStream).pipe(n
  9463. .elementaryStream), n.elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream), n
  9464. .elementaryStream.pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream), n.elementaryStream.pipe(n
  9465. .timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream), n.h264Stream
  9466. .pipe(n.captionStream).pipe(n.coalesceStream), n.elementaryStream.on("data", function(a) {
  9467. var s;
  9468. if ("metadata" === a.type) {
  9469. for (s = a.tracks.length; s--;) t || "video" !== a.tracks[s].type ? i || "audio" !== a.tracks[s]
  9470. .type || ((i = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r.baseMediaDecodeTime) : (
  9471. t = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r.baseMediaDecodeTime;
  9472. t && !n.videoSegmentStream && (n.coalesceStream.numberOfTracks++, n.videoSegmentStream = new $u(t,
  9473. e), n.videoSegmentStream.on("timelineStartInfo", function(e) {
  9474. i && (i.timelineStartInfo = e, n.audioSegmentStream.setEarliestDts(e.dts))
  9475. }), n.videoSegmentStream.on("processedGopsInfo", r.trigger.bind(r, "gopInfo")), n
  9476. .videoSegmentStream.on("baseMediaDecodeTime", function(e) {
  9477. i && n.audioSegmentStream.setVideoBaseMediaDecodeTime(e)
  9478. }), n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)), i && !n
  9479. .audioSegmentStream && (n.coalesceStream.numberOfTracks++, n.audioSegmentStream = new el(i, e),
  9480. n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream))
  9481. }
  9482. }), n.coalesceStream.on("data", this.trigger.bind(this, "data")), n.coalesceStream.on("done", this
  9483. .trigger.bind(this, "done"))
  9484. }, this.setBaseMediaDecodeTime = function(e) {
  9485. var r = this.transmuxPipeline_;
  9486. this.baseMediaDecodeTime = e, i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo.pts = void 0, Sl
  9487. .clearDtsInfo(i), i.timelineStartInfo.baseMediaDecodeTime = e, r.audioTimestampRolloverStream && r
  9488. .audioTimestampRolloverStream.discontinuity()), t && (r.videoSegmentStream && (r.videoSegmentStream
  9489. .gopCache_ = [], r.videoTimestampRolloverStream.discontinuity()), t.timelineStartInfo.dts = void 0,
  9490. t.timelineStartInfo.pts = void 0, Sl.clearDtsInfo(t), r.captionStream.reset(), t.timelineStartInfo
  9491. .baseMediaDecodeTime = e), r.timedMetadataTimestampRolloverStream && r
  9492. .timedMetadataTimestampRolloverStream.discontinuity()
  9493. }, this.setAudioAppendStart = function(e) {
  9494. i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)
  9495. }, this.alignGopsWith = function(e) {
  9496. t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream.alignGopsWith(
  9497. e)
  9498. }, this.push = function(e) {
  9499. if (n) {
  9500. var t = rl(e);
  9501. t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this
  9502. .transmuxPipeline_.type || this.setupTsPipeline(), n = !1
  9503. }
  9504. this.transmuxPipeline_.headOfPipeline.push(e)
  9505. }, this.flush = function() {
  9506. n = !0, this.transmuxPipeline_.headOfPipeline.flush()
  9507. }, this.resetCaptions = function() {
  9508. this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset()
  9509. }
  9510. }).prototype = new qo;
  9511. var Ll, xl, Pl = {
  9512. Transmuxer: tl,
  9513. VideoSegmentStream: $u,
  9514. AudioSegmentStream: el,
  9515. AUDIO_PROPERTIES: Dl,
  9516. VIDEO_PROPERTIES: Il
  9517. },
  9518. Ul = Pl.Transmuxer,
  9519. Nl = Pl.VideoSegmentStream,
  9520. Bl = Pl.AudioSegmentStream,
  9521. Fl = Pl.AUDIO_PROPERTIES,
  9522. jl = Pl.VIDEO_PROPERTIES,
  9523. Hl = Object.freeze({
  9524. default: Pl,
  9525. __moduleExports: Pl,
  9526. Transmuxer: Ul,
  9527. VideoSegmentStream: Nl,
  9528. AudioSegmentStream: Bl,
  9529. AUDIO_PROPERTIES: Fl,
  9530. VIDEO_PROPERTIES: jl
  9531. }),
  9532. Gl = fo.parseType,
  9533. Vl = function(e) {
  9534. return new Date(1e3 * e - 20828448e5)
  9535. },
  9536. Wl = function(e) {
  9537. return {
  9538. isLeading: (12 & e[0]) >>> 2,
  9539. dependsOn: 3 & e[0],
  9540. isDependedOn: (192 & e[1]) >>> 6,
  9541. hasRedundancy: (48 & e[1]) >>> 4,
  9542. paddingValue: (14 & e[1]) >>> 1,
  9543. isNonSyncSample: 1 & e[1],
  9544. degradationPriority: e[2] << 8 | e[3]
  9545. }
  9546. },
  9547. ql = {
  9548. avc1: function(e) {
  9549. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  9550. return {
  9551. dataReferenceIndex: t.getUint16(6),
  9552. width: t.getUint16(24),
  9553. height: t.getUint16(26),
  9554. horizresolution: t.getUint16(28) + t.getUint16(30) / 16,
  9555. vertresolution: t.getUint16(32) + t.getUint16(34) / 16,
  9556. frameCount: t.getUint16(40),
  9557. depth: t.getUint16(74),
  9558. config: Ll(e.subarray(78, e.byteLength))
  9559. }
  9560. },
  9561. avcC: function(e) {
  9562. var t, i, r, n, a = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9563. s = {
  9564. configurationVersion: e[0],
  9565. avcProfileIndication: e[1],
  9566. profileCompatibility: e[2],
  9567. avcLevelIndication: e[3],
  9568. lengthSizeMinusOne: 3 & e[4],
  9569. sps: [],
  9570. pps: []
  9571. },
  9572. o = 31 & e[5];
  9573. for (r = 6, n = 0; n < o; n++) i = a.getUint16(r), r += 2, s.sps.push(new Uint8Array(e.subarray(r, r + i))),
  9574. r += i;
  9575. for (t = e[r], r++, n = 0; n < t; n++) i = a.getUint16(r), r += 2, s.pps.push(new Uint8Array(e.subarray(r,
  9576. r + i))), r += i;
  9577. return s
  9578. },
  9579. btrt: function(e) {
  9580. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  9581. return {
  9582. bufferSizeDB: t.getUint32(0),
  9583. maxBitrate: t.getUint32(4),
  9584. avgBitrate: t.getUint32(8)
  9585. }
  9586. },
  9587. esds: function(e) {
  9588. return {
  9589. version: e[0],
  9590. flags: new Uint8Array(e.subarray(1, 4)),
  9591. esId: e[6] << 8 | e[7],
  9592. streamPriority: 31 & e[8],
  9593. decoderConfig: {
  9594. objectProfileIndication: e[11],
  9595. streamType: e[12] >>> 2 & 63,
  9596. bufferSize: e[13] << 16 | e[14] << 8 | e[15],
  9597. maxBitrate: e[16] << 24 | e[17] << 16 | e[18] << 8 | e[19],
  9598. avgBitrate: e[20] << 24 | e[21] << 16 | e[22] << 8 | e[23],
  9599. decoderConfigDescriptor: {
  9600. tag: e[24],
  9601. length: e[25],
  9602. audioObjectType: e[26] >>> 3 & 31,
  9603. samplingFrequencyIndex: (7 & e[26]) << 1 | e[27] >>> 7 & 1,
  9604. channelConfiguration: e[27] >>> 3 & 15
  9605. }
  9606. }
  9607. }
  9608. },
  9609. ftyp: function(e) {
  9610. for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = {
  9611. majorBrand: Gl(e.subarray(0, 4)),
  9612. minorVersion: t.getUint32(4),
  9613. compatibleBrands: []
  9614. }, r = 8; r < e.byteLength;) i.compatibleBrands.push(Gl(e.subarray(r, r + 4))), r += 4;
  9615. return i
  9616. },
  9617. dinf: function(e) {
  9618. return {
  9619. boxes: Ll(e)
  9620. }
  9621. },
  9622. dref: function(e) {
  9623. return {
  9624. version: e[0],
  9625. flags: new Uint8Array(e.subarray(1, 4)),
  9626. dataReferences: Ll(e.subarray(8))
  9627. }
  9628. },
  9629. hdlr: function(e) {
  9630. var t = {
  9631. version: new DataView(e.buffer, e.byteOffset, e.byteLength).getUint8(0),
  9632. flags: new Uint8Array(e.subarray(1, 4)),
  9633. handlerType: Gl(e.subarray(8, 12)),
  9634. name: ""
  9635. },
  9636. i = 8;
  9637. for (i = 24; i < e.byteLength; i++) {
  9638. if (0 === e[i]) {
  9639. i++;
  9640. break
  9641. }
  9642. t.name += String.fromCharCode(e[i])
  9643. }
  9644. return t.name = decodeURIComponent(escape(t.name)), t
  9645. },
  9646. mdat: function(e) {
  9647. return {
  9648. byteLength: e.byteLength,
  9649. nals: function(e) {
  9650. var t, i, r = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9651. n = [];
  9652. for (t = 0; t + 4 < e.length; t += i)
  9653. if (i = r.getUint32(t), t += 4, i <= 0) n.push("<span style='color:red;'>MALFORMED DATA</span>");
  9654. else switch (31 & e[t]) {
  9655. case 1:
  9656. n.push("slice_layer_without_partitioning_rbsp");
  9657. break;
  9658. case 5:
  9659. n.push("slice_layer_without_partitioning_rbsp_idr");
  9660. break;
  9661. case 6:
  9662. n.push("sei_rbsp");
  9663. break;
  9664. case 7:
  9665. n.push("seq_parameter_set_rbsp");
  9666. break;
  9667. case 8:
  9668. n.push("pic_parameter_set_rbsp");
  9669. break;
  9670. case 9:
  9671. n.push("access_unit_delimiter_rbsp");
  9672. break;
  9673. default:
  9674. n.push("UNKNOWN NAL - " + e[t] & 31)
  9675. }
  9676. return n
  9677. }(e)
  9678. }
  9679. },
  9680. mdhd: function(e) {
  9681. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9682. r = 4,
  9683. n = {
  9684. version: i.getUint8(0),
  9685. flags: new Uint8Array(e.subarray(1, 4)),
  9686. language: ""
  9687. };
  9688. return 1 === n.version ? (r += 4, n.creationTime = Vl(i.getUint32(r)), r += 8, n.modificationTime = Vl(i
  9689. .getUint32(r)), r += 4, n.timescale = i.getUint32(r), r += 8, n.duration = i.getUint32(r)) : (n
  9690. .creationTime = Vl(i.getUint32(r)), r += 4, n.modificationTime = Vl(i.getUint32(r)), r += 4, n
  9691. .timescale = i.getUint32(r), r += 4, n.duration = i.getUint32(r)), r += 4, t = i.getUint16(r), n
  9692. .language += String.fromCharCode(96 + (t >> 10)), n.language += String.fromCharCode(96 + ((992 & t) >>
  9693. 5)), n.language += String.fromCharCode(96 + (31 & t)), n
  9694. },
  9695. mdia: function(e) {
  9696. return {
  9697. boxes: Ll(e)
  9698. }
  9699. },
  9700. mfhd: function(e) {
  9701. return {
  9702. version: e[0],
  9703. flags: new Uint8Array(e.subarray(1, 4)),
  9704. sequenceNumber: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]
  9705. }
  9706. },
  9707. minf: function(e) {
  9708. return {
  9709. boxes: Ll(e)
  9710. }
  9711. },
  9712. mp4a: function(e) {
  9713. var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9714. i = {
  9715. dataReferenceIndex: t.getUint16(6),
  9716. channelcount: t.getUint16(16),
  9717. samplesize: t.getUint16(18),
  9718. samplerate: t.getUint16(24) + t.getUint16(26) / 65536
  9719. };
  9720. return e.byteLength > 28 && (i.streamDescriptor = Ll(e.subarray(28))[0]), i
  9721. },
  9722. moof: function(e) {
  9723. return {
  9724. boxes: Ll(e)
  9725. }
  9726. },
  9727. moov: function(e) {
  9728. return {
  9729. boxes: Ll(e)
  9730. }
  9731. },
  9732. mvex: function(e) {
  9733. return {
  9734. boxes: Ll(e)
  9735. }
  9736. },
  9737. mvhd: function(e) {
  9738. var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9739. i = 4,
  9740. r = {
  9741. version: t.getUint8(0),
  9742. flags: new Uint8Array(e.subarray(1, 4))
  9743. };
  9744. return 1 === r.version ? (i += 4, r.creationTime = Vl(t.getUint32(i)), i += 8, r.modificationTime = Vl(t
  9745. .getUint32(i)), i += 4, r.timescale = t.getUint32(i), i += 8, r.duration = t.getUint32(i)) : (r
  9746. .creationTime = Vl(t.getUint32(i)), i += 4, r.modificationTime = Vl(t.getUint32(i)), i += 4, r
  9747. .timescale = t.getUint32(i), i += 4, r.duration = t.getUint32(i)), i += 4, r.rate = t.getUint16(i) + t
  9748. .getUint16(i + 2) / 16, i += 4, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2, i += 2, i += 8,
  9749. r.matrix = new Uint32Array(e.subarray(i, i + 36)), i += 36, i += 24, r.nextTrackId = t.getUint32(i), r
  9750. },
  9751. pdin: function(e) {
  9752. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  9753. return {
  9754. version: t.getUint8(0),
  9755. flags: new Uint8Array(e.subarray(1, 4)),
  9756. rate: t.getUint32(4),
  9757. initialDelay: t.getUint32(8)
  9758. }
  9759. },
  9760. sdtp: function(e) {
  9761. var t, i = {
  9762. version: e[0],
  9763. flags: new Uint8Array(e.subarray(1, 4)),
  9764. samples: []
  9765. };
  9766. for (t = 4; t < e.byteLength; t++) i.samples.push({
  9767. dependsOn: (48 & e[t]) >> 4,
  9768. isDependedOn: (12 & e[t]) >> 2,
  9769. hasRedundancy: 3 & e[t]
  9770. });
  9771. return i
  9772. },
  9773. sidx: function(e) {
  9774. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9775. r = {
  9776. version: e[0],
  9777. flags: new Uint8Array(e.subarray(1, 4)),
  9778. references: [],
  9779. referenceId: i.getUint32(4),
  9780. timescale: i.getUint32(8),
  9781. earliestPresentationTime: i.getUint32(12),
  9782. firstOffset: i.getUint32(16)
  9783. },
  9784. n = i.getUint16(22);
  9785. for (t = 24; n; t += 12, n--) r.references.push({
  9786. referenceType: (128 & e[t]) >>> 7,
  9787. referencedSize: 2147483647 & i.getUint32(t),
  9788. subsegmentDuration: i.getUint32(t + 4),
  9789. startsWithSap: !!(128 & e[t + 8]),
  9790. sapType: (112 & e[t + 8]) >>> 4,
  9791. sapDeltaTime: 268435455 & i.getUint32(t + 8)
  9792. });
  9793. return r
  9794. },
  9795. smhd: function(e) {
  9796. return {
  9797. version: e[0],
  9798. flags: new Uint8Array(e.subarray(1, 4)),
  9799. balance: e[4] + e[5] / 256
  9800. }
  9801. },
  9802. stbl: function(e) {
  9803. return {
  9804. boxes: Ll(e)
  9805. }
  9806. },
  9807. stco: function(e) {
  9808. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9809. r = {
  9810. version: e[0],
  9811. flags: new Uint8Array(e.subarray(1, 4)),
  9812. chunkOffsets: []
  9813. },
  9814. n = i.getUint32(4);
  9815. for (t = 8; n; t += 4, n--) r.chunkOffsets.push(i.getUint32(t));
  9816. return r
  9817. },
  9818. stsc: function(e) {
  9819. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9820. r = i.getUint32(4),
  9821. n = {
  9822. version: e[0],
  9823. flags: new Uint8Array(e.subarray(1, 4)),
  9824. sampleToChunks: []
  9825. };
  9826. for (t = 8; r; t += 12, r--) n.sampleToChunks.push({
  9827. firstChunk: i.getUint32(t),
  9828. samplesPerChunk: i.getUint32(t + 4),
  9829. sampleDescriptionIndex: i.getUint32(t + 8)
  9830. });
  9831. return n
  9832. },
  9833. stsd: function(e) {
  9834. return {
  9835. version: e[0],
  9836. flags: new Uint8Array(e.subarray(1, 4)),
  9837. sampleDescriptions: Ll(e.subarray(8))
  9838. }
  9839. },
  9840. stsz: function(e) {
  9841. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9842. r = {
  9843. version: e[0],
  9844. flags: new Uint8Array(e.subarray(1, 4)),
  9845. sampleSize: i.getUint32(4),
  9846. entries: []
  9847. };
  9848. for (t = 12; t < e.byteLength; t += 4) r.entries.push(i.getUint32(t));
  9849. return r
  9850. },
  9851. stts: function(e) {
  9852. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9853. r = {
  9854. version: e[0],
  9855. flags: new Uint8Array(e.subarray(1, 4)),
  9856. timeToSamples: []
  9857. },
  9858. n = i.getUint32(4);
  9859. for (t = 8; n; t += 8, n--) r.timeToSamples.push({
  9860. sampleCount: i.getUint32(t),
  9861. sampleDelta: i.getUint32(t + 4)
  9862. });
  9863. return r
  9864. },
  9865. styp: function(e) {
  9866. return ql.ftyp(e)
  9867. },
  9868. tfdt: function(e) {
  9869. var t = {
  9870. version: e[0],
  9871. flags: new Uint8Array(e.subarray(1, 4)),
  9872. baseMediaDecodeTime: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]
  9873. };
  9874. return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32), t.baseMediaDecodeTime += e[8] << 24 |
  9875. e[9] << 16 | e[10] << 8 | e[11]), t
  9876. },
  9877. tfhd: function(e) {
  9878. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9879. r = {
  9880. version: e[0],
  9881. flags: new Uint8Array(e.subarray(1, 4)),
  9882. trackId: i.getUint32(4)
  9883. },
  9884. n = 1 & r.flags[2],
  9885. a = 2 & r.flags[2],
  9886. s = 8 & r.flags[2],
  9887. o = 16 & r.flags[2],
  9888. u = 32 & r.flags[2],
  9889. l = 65536 & r.flags[0],
  9890. d = 131072 & r.flags[0];
  9891. return t = 8, n && (t += 4, r.baseDataOffset = i.getUint32(12), t += 4), a && (r.sampleDescriptionIndex = i
  9892. .getUint32(t), t += 4), s && (r.defaultSampleDuration = i.getUint32(t), t += 4), o && (r
  9893. .defaultSampleSize = i.getUint32(t), t += 4), u && (r.defaultSampleFlags = i.getUint32(t)), l && (r
  9894. .durationIsEmpty = !0), !n && d && (r.baseDataOffsetIsMoof = !0), r
  9895. },
  9896. tkhd: function(e) {
  9897. var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9898. i = 4,
  9899. r = {
  9900. version: t.getUint8(0),
  9901. flags: new Uint8Array(e.subarray(1, 4))
  9902. };
  9903. return 1 === r.version ? (i += 4, r.creationTime = Vl(t.getUint32(i)), i += 8, r.modificationTime = Vl(t
  9904. .getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 8, r.duration = t.getUint32(i)) : (r
  9905. .creationTime = Vl(t.getUint32(i)), i += 4, r.modificationTime = Vl(t.getUint32(i)), i += 4, r.trackId =
  9906. t.getUint32(i), i += 4, i += 4, r.duration = t.getUint32(i)), i += 4, i += 8, r.layer = t.getUint16(i),
  9907. i += 2, r.alternateGroup = t.getUint16(i), i += 2, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i +=
  9908. 2, i += 2, r.matrix = new Uint32Array(e.subarray(i, i + 36)), i += 36, r.width = t.getUint16(i) + t
  9909. .getUint16(i + 2) / 16, i += 4, r.height = t.getUint16(i) + t.getUint16(i + 2) / 16, r
  9910. },
  9911. traf: function(e) {
  9912. return {
  9913. boxes: Ll(e)
  9914. }
  9915. },
  9916. trak: function(e) {
  9917. return {
  9918. boxes: Ll(e)
  9919. }
  9920. },
  9921. trex: function(e) {
  9922. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  9923. return {
  9924. version: e[0],
  9925. flags: new Uint8Array(e.subarray(1, 4)),
  9926. trackId: t.getUint32(4),
  9927. defaultSampleDescriptionIndex: t.getUint32(8),
  9928. defaultSampleDuration: t.getUint32(12),
  9929. defaultSampleSize: t.getUint32(16),
  9930. sampleDependsOn: 3 & e[20],
  9931. sampleIsDependedOn: (192 & e[21]) >> 6,
  9932. sampleHasRedundancy: (48 & e[21]) >> 4,
  9933. samplePaddingValue: (14 & e[21]) >> 1,
  9934. sampleIsDifferenceSample: !!(1 & e[21]),
  9935. sampleDegradationPriority: t.getUint16(22)
  9936. }
  9937. },
  9938. trun: function(e) {
  9939. var t, i = {
  9940. version: e[0],
  9941. flags: new Uint8Array(e.subarray(1, 4)),
  9942. samples: []
  9943. },
  9944. r = new DataView(e.buffer, e.byteOffset, e.byteLength),
  9945. n = 1 & i.flags[2],
  9946. a = 4 & i.flags[2],
  9947. s = 1 & i.flags[1],
  9948. o = 2 & i.flags[1],
  9949. u = 4 & i.flags[1],
  9950. l = 8 & i.flags[1],
  9951. d = r.getUint32(4),
  9952. c = 8;
  9953. for (n && (i.dataOffset = r.getInt32(c), c += 4), a && d && (t = {
  9954. flags: Wl(e.subarray(c, c + 4))
  9955. }, c += 4, s && (t.duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), l && (t
  9956. .compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push(t), d--); d--;) t = {}, s && (t
  9957. .duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), u && (t.flags = Wl(e
  9958. .subarray(c, c + 4)), c += 4), l && (t.compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push(
  9959. t);
  9960. return i
  9961. },
  9962. "url ": function(e) {
  9963. return {
  9964. version: e[0],
  9965. flags: new Uint8Array(e.subarray(1, 4))
  9966. }
  9967. },
  9968. vmhd: function(e) {
  9969. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  9970. return {
  9971. version: e[0],
  9972. flags: new Uint8Array(e.subarray(1, 4)),
  9973. graphicsmode: t.getUint16(4),
  9974. opcolor: new Uint16Array([t.getUint16(6), t.getUint16(8), t.getUint16(10)])
  9975. }
  9976. }
  9977. },
  9978. Xl = {
  9979. inspect: Ll = function(e) {
  9980. for (var t, i, r, n, a, s = 0, o = [], u = new ArrayBuffer(e.length), l = new Uint8Array(u), d = 0; d < e
  9981. .length; ++d) l[d] = e[d];
  9982. for (t = new DataView(u); s < e.byteLength;) i = t.getUint32(s), r = Gl(e.subarray(s + 4, s + 8)), n = i >
  9983. 1 ? s + i : e.byteLength, (a = (ql[r] || function(e) {
  9984. return {
  9985. data: e
  9986. }
  9987. })(e.subarray(s + 8, n))).size = i, a.type = r, o.push(a), s = n;
  9988. return o
  9989. },
  9990. textify: xl = function(e, t) {
  9991. var i;
  9992. return t = t || 0, i = new Array(2 * t + 1).join(" "), e.map(function(e, r) {
  9993. return i + e.type + "\n" + Object.keys(e).filter(function(e) {
  9994. return "type" !== e && "boxes" !== e
  9995. }).map(function(t) {
  9996. var r = i + " " + t + ": ",
  9997. n = e[t];
  9998. if (n instanceof Uint8Array || n instanceof Uint32Array) {
  9999. var a = Array.prototype.slice.call(new Uint8Array(n.buffer, n.byteOffset, n.byteLength)).map(
  10000. function(e) {
  10001. return " " + ("00" + e.toString(16)).slice(-2)
  10002. }).join("").match(/.{1,24}/g);
  10003. return a ? 1 === a.length ? r + "<" + a.join("").slice(1) + ">" : r + "<\n" + a.map(function(
  10004. e) {
  10005. return i + " " + e
  10006. }).join("\n") + "\n" + i + " >" : r + "<>"
  10007. }
  10008. return r + JSON.stringify(n, null, 2).split("\n").map(function(e, t) {
  10009. return 0 === t ? e : i + " " + e
  10010. }).join("\n")
  10011. }).join("\n") + (e.boxes ? "\n" + xl(e.boxes, t + 1) : "")
  10012. }).join("\n")
  10013. },
  10014. parseTfdt: ql.tfdt,
  10015. parseHdlr: ql.hdlr,
  10016. parseTfhd: ql.tfhd,
  10017. parseTrun: ql.trun
  10018. },
  10019. zl = Xl.inspect,
  10020. Kl = Xl.textify,
  10021. Yl = Xl.parseTfdt,
  10022. Ql = Xl.parseHdlr,
  10023. Jl = Xl.parseTfhd,
  10024. Zl = Xl.parseTrun,
  10025. $l = Object.freeze({
  10026. default: Xl,
  10027. __moduleExports: Xl,
  10028. inspect: zl,
  10029. textify: Kl,
  10030. parseTfdt: Yl,
  10031. parseHdlr: Ql,
  10032. parseTfhd: Jl,
  10033. parseTrun: Zl
  10034. }),
  10035. ed = $l && Xl || $l,
  10036. td = Xo.discardEmulationPreventionBytes,
  10037. id = Au.CaptionStream,
  10038. rd = function(e, t) {
  10039. for (var i = e, r = 0; r < t.length; r++) {
  10040. var n = t[r];
  10041. if (i < n.size) return n;
  10042. i -= n.size
  10043. }
  10044. return null
  10045. },
  10046. nd = function(e, t) {
  10047. var i = fo.findBox(e, ["moof", "traf"]),
  10048. r = {},
  10049. n = [];
  10050. return fo.findBox(e, ["mdat"]).forEach(function(e, t) {
  10051. var r = i[t];
  10052. n.push({
  10053. mdat: e,
  10054. traf: r
  10055. })
  10056. }), n.forEach(function(e) {
  10057. var i, n = e.mdat,
  10058. a = e.traf,
  10059. s = fo.findBox(a, ["tfhd"]),
  10060. o = ed.parseTfhd(s[0]),
  10061. u = o.trackId,
  10062. l = fo.findBox(a, ["tfdt"]),
  10063. d = l.length > 0 ? ed.parseTfdt(l[0]).baseMediaDecodeTime : 0,
  10064. c = fo.findBox(a, ["trun"]);
  10065. t === u && c.length > 0 && (i = function(e, t, i) {
  10066. var r, n, a, s, o = new DataView(e.buffer, e.byteOffset, e.byteLength),
  10067. u = [];
  10068. for (n = 0; n + 4 < e.length; n += a)
  10069. if (a = o.getUint32(n), n += 4, !(a <= 0)) switch (31 & e[n]) {
  10070. case 6:
  10071. var l = e.subarray(n + 1, n + 1 + a),
  10072. d = rd(n, t);
  10073. r = {
  10074. nalUnitType: "sei_rbsp",
  10075. size: a,
  10076. data: l,
  10077. escapedRBSP: td(l),
  10078. trackId: i
  10079. }, d ? (r.pts = d.pts, r.dts = d.dts, s = d) : (r.pts = s.pts, r.dts = s.dts), u.push(r)
  10080. }
  10081. return u
  10082. }(n, function(e, t, i) {
  10083. var r = t,
  10084. n = i.defaultSampleDuration || 0,
  10085. a = i.defaultSampleSize || 0,
  10086. s = i.trackId,
  10087. o = [];
  10088. return e.forEach(function(e) {
  10089. var t = ed.parseTrun(e).samples;
  10090. t.forEach(function(e) {
  10091. void 0 === e.duration && (e.duration = n), void 0 === e.size && (e.size = a), e
  10092. .trackId = s, e.dts = r, void 0 === e.compositionTimeOffset && (e
  10093. .compositionTimeOffset = 0), e.pts = r + e.compositionTimeOffset, r += e.duration
  10094. }), o = o.concat(t)
  10095. }), o
  10096. }(c, d, o), u), r[u] || (r[u] = []), r[u] = r[u].concat(i))
  10097. }), r
  10098. },
  10099. ad = function() {
  10100. var e, t, i, r, n, a = !1;
  10101. this.isInitialized = function() {
  10102. return a
  10103. }, this.init = function() {
  10104. e = new id, a = !0, e.on("data", function(e) {
  10105. e.startTime = e.startPts / r, e.endTime = e.endPts / r, n.captions.push(e), n.captionStreams[e
  10106. .stream] = !0
  10107. })
  10108. }, this.isNewInit = function(e, t) {
  10109. return !(e && 0 === e.length || t && "object" === (void 0 === t ? "undefined" : v(t)) && 0 === Object.keys(
  10110. t).length || i === e[0] && r === t[i])
  10111. }, this.parse = function(e, a, s) {
  10112. var o;
  10113. if (!this.isInitialized()) return null;
  10114. if (!a || !s) return null;
  10115. if (this.isNewInit(a, s)) i = a[0], r = s[i];
  10116. else if (!i || !r) return t.push(e), null;
  10117. for (; t.length > 0;) {
  10118. var u = t.shift();
  10119. this.parse(u, a, s)
  10120. }
  10121. return null !== (o = function(e, t, i) {
  10122. return t ? {
  10123. seiNals: nd(e, t)[t],
  10124. timescale: i
  10125. } : null
  10126. }(e, i, r)) && o.seiNals ? (this.pushNals(o.seiNals), this.flushStream(), n) : null
  10127. }, this.pushNals = function(t) {
  10128. if (!this.isInitialized() || !t || 0 === t.length) return null;
  10129. t.forEach(function(t) {
  10130. e.push(t)
  10131. })
  10132. }, this.flushStream = function() {
  10133. if (!this.isInitialized()) return null;
  10134. e.flush()
  10135. }, this.clearParsedCaptions = function() {
  10136. n.captions = [], n.captionStreams = {}
  10137. }, this.resetCaptionStream = function() {
  10138. if (!this.isInitialized()) return null;
  10139. e.reset()
  10140. }, this.clearAllCaptions = function() {
  10141. this.clearParsedCaptions(), this.resetCaptionStream()
  10142. }, this.reset = function() {
  10143. t = [], i = null, r = null, n ? this.clearParsedCaptions() : n = {
  10144. captions: [],
  10145. captionStreams: {}
  10146. }, this.resetCaptionStream()
  10147. }, this.reset()
  10148. },
  10149. sd = Object.freeze({
  10150. default: ad,
  10151. __moduleExports: ad
  10152. }),
  10153. od = Hl && Pl || Hl,
  10154. ud = sd && ad || sd,
  10155. ld = {
  10156. generator: El,
  10157. probe: fo,
  10158. Transmuxer: od.Transmuxer,
  10159. AudioSegmentStream: od.AudioSegmentStream,
  10160. VideoSegmentStream: od.VideoSegmentStream,
  10161. CaptionParser: ud
  10162. }.CaptionParser,
  10163. dd = function(e) {
  10164. var t = 31 & e[1];
  10165. return t <<= 8, t |= e[2]
  10166. },
  10167. cd = function(e) {
  10168. return !!(64 & e[1])
  10169. },
  10170. hd = function(e) {
  10171. var t = 0;
  10172. return (48 & e[3]) >>> 4 > 1 && (t += e[4] + 1), t
  10173. },
  10174. fd = function(e) {
  10175. switch (e) {
  10176. case 5:
  10177. return "slice_layer_without_partitioning_rbsp_idr";
  10178. case 6:
  10179. return "sei_rbsp";
  10180. case 7:
  10181. return "seq_parameter_set_rbsp";
  10182. case 8:
  10183. return "pic_parameter_set_rbsp";
  10184. case 9:
  10185. return "access_unit_delimiter_rbsp";
  10186. default:
  10187. return null
  10188. }
  10189. },
  10190. pd = {
  10191. parseType: function(e, t) {
  10192. var i = dd(e);
  10193. return 0 === i ? "pat" : i === t ? "pmt" : t ? "pes" : null
  10194. },
  10195. parsePat: function(e) {
  10196. var t = cd(e),
  10197. i = 4 + hd(e);
  10198. return t && (i += e[i] + 1), (31 & e[i + 10]) << 8 | e[i + 11]
  10199. },
  10200. parsePmt: function(e) {
  10201. var t = {},
  10202. i = cd(e),
  10203. r = 4 + hd(e);
  10204. if (i && (r += e[r] + 1), 1 & e[r + 5]) {
  10205. var n;
  10206. n = 3 + ((15 & e[r + 1]) << 8 | e[r + 2]) - 4;
  10207. for (var a = 12 + ((15 & e[r + 10]) << 8 | e[r + 11]); a < n;) {
  10208. var s = r + a;
  10209. t[(31 & e[s + 1]) << 8 | e[s + 2]] = e[s], a += 5 + ((15 & e[s + 3]) << 8 | e[s + 4])
  10210. }
  10211. return t
  10212. }
  10213. },
  10214. parsePayloadUnitStartIndicator: cd,
  10215. parsePesType: function(e, t) {
  10216. switch (t[dd(e)]) {
  10217. case mu.H264_STREAM_TYPE:
  10218. return "video";
  10219. case mu.ADTS_STREAM_TYPE:
  10220. return "audio";
  10221. case mu.METADATA_STREAM_TYPE:
  10222. return "timed-metadata";
  10223. default:
  10224. return null
  10225. }
  10226. },
  10227. parsePesTime: function(e) {
  10228. if (!cd(e)) return null;
  10229. var t = 4 + hd(e);
  10230. if (t >= e.byteLength) return null;
  10231. var i, r = null;
  10232. return 192 & (i = e[t + 7]) && ((r = {}).pts = (14 & e[t + 9]) << 27 | (255 & e[t + 10]) << 20 | (254 & e[
  10233. t + 11]) << 12 | (255 & e[t + 12]) << 5 | (254 & e[t + 13]) >>> 3, r.pts *= 4, r.pts += (6 & e[t +
  10234. 13]) >>> 1, r.dts = r.pts, 64 & i && (r.dts = (14 & e[t + 14]) << 27 | (255 & e[t + 15]) << 20 | (
  10235. 254 & e[t + 16]) << 12 | (255 & e[t + 17]) << 5 | (254 & e[t + 18]) >>> 3, r.dts *= 4, r.dts += (6 &
  10236. e[t + 18]) >>> 1)), r
  10237. },
  10238. videoPacketContainsKeyFrame: function(e) {
  10239. for (var t = 4 + hd(e), i = e.subarray(t), r = 0, n = 0, a = !1; n < i.byteLength - 3; n++)
  10240. if (1 === i[n + 2]) {
  10241. r = n + 5;
  10242. break
  10243. } for (; r < i.byteLength;) switch (i[r]) {
  10244. case 0:
  10245. if (0 !== i[r - 1]) {
  10246. r += 2;
  10247. break
  10248. }
  10249. if (0 !== i[r - 2]) {
  10250. r++;
  10251. break
  10252. }
  10253. n + 3 !== r - 2 && "slice_layer_without_partitioning_rbsp_idr" === fd(31 & i[n + 3]) && (a = !0);
  10254. do {
  10255. r++
  10256. } while (1 !== i[r] && r < i.length);
  10257. n = r - 2, r += 3;
  10258. break;
  10259. case 1:
  10260. if (0 !== i[r - 1] || 0 !== i[r - 2]) {
  10261. r += 3;
  10262. break
  10263. }
  10264. "slice_layer_without_partitioning_rbsp_idr" === fd(31 & i[n + 3]) && (a = !0), n = r - 2, r += 3;
  10265. break;
  10266. default:
  10267. r += 3
  10268. }
  10269. return i = i.subarray(n), r -= n, n = 0, i && i.byteLength > 3 &&
  10270. "slice_layer_without_partitioning_rbsp_idr" === fd(31 & i[n + 3]) && (a = !0), a
  10271. }
  10272. },
  10273. md = pd.parseType,
  10274. gd = pd.parsePat,
  10275. vd = pd.parsePmt,
  10276. yd = pd.parsePayloadUnitStartIndicator,
  10277. _d = pd.parsePesType,
  10278. bd = pd.parsePesTime,
  10279. wd = pd.videoPacketContainsKeyFrame,
  10280. Ed = Object.freeze({
  10281. default: pd,
  10282. __moduleExports: pd,
  10283. parseType: md,
  10284. parsePat: gd,
  10285. parsePmt: vd,
  10286. parsePayloadUnitStartIndicator: yd,
  10287. parsePesType: _d,
  10288. parsePesTime: bd,
  10289. videoPacketContainsKeyFrame: wd
  10290. }),
  10291. Td = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350],
  10292. Sd = function(e) {
  10293. return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
  10294. },
  10295. Ad = {
  10296. parseId3TagSize: function(e, t) {
  10297. var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
  10298. return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10
  10299. },
  10300. parseAdtsSize: function(e, t) {
  10301. var i = (224 & e[t + 5]) >> 5,
  10302. r = e[t + 4] << 3;
  10303. return 6144 & e[t + 3] | r | i
  10304. },
  10305. parseType: function(e, t) {
  10306. return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3".charCodeAt(0) ?
  10307. "timed-metadata" : !0 & e[t] && 240 == (240 & e[t + 1]) ? "audio" : null
  10308. },
  10309. parseSampleRate: function(e) {
  10310. for (var t = 0; t + 5 < e.length;) {
  10311. if (255 === e[t] && 240 == (246 & e[t + 1])) return Td[(60 & e[t + 2]) >>> 2];
  10312. t++
  10313. }
  10314. return null
  10315. },
  10316. parseAacTimestamp: function(e) {
  10317. var t, i, r;
  10318. t = 10, 64 & e[5] && (t += 4, t += Sd(e.subarray(10, 14)));
  10319. do {
  10320. if ((i = Sd(e.subarray(t + 4, t + 8))) < 1) return null;
  10321. if ("PRIV" === String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3])) {
  10322. r = e.subarray(t + 10, t + i + 10);
  10323. for (var n = 0; n < r.byteLength; n++)
  10324. if (0 === r[n]) {
  10325. if ("com.apple.streaming.transportStreamTimestamp" === unescape(function(e, t, i) {
  10326. var r, n = "";
  10327. for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2);
  10328. return n
  10329. }(r, 0, n))) {
  10330. var a = r.subarray(n + 1),
  10331. s = (1 & a[3]) << 30 | a[4] << 22 | a[5] << 14 | a[6] << 6 | a[7] >>> 2;
  10332. return s *= 4, s += 3 & a[7]
  10333. }
  10334. break
  10335. }
  10336. }
  10337. t += 10, t += i
  10338. } while (t < e.byteLength);
  10339. return null
  10340. }
  10341. },
  10342. kd = Ad.parseId3TagSize,
  10343. Rd = Ad.parseAdtsSize,
  10344. Md = Ad.parseType,
  10345. Od = Ad.parseSampleRate,
  10346. Cd = Ad.parseAacTimestamp,
  10347. Dd = Object.freeze({
  10348. default: Ad,
  10349. __moduleExports: Ad,
  10350. parseId3TagSize: kd,
  10351. parseAdtsSize: Rd,
  10352. parseType: Md,
  10353. parseSampleRate: Od,
  10354. parseAacTimestamp: Cd
  10355. }),
  10356. Id = Ed && pd || Ed,
  10357. Ld = Dd && Ad || Dd,
  10358. xd = ku.handleRollover,
  10359. Pd = {};
  10360. Pd.ts = Id, Pd.aac = Ld;
  10361. var Ud = function(e, t, i) {
  10362. for (var r, n, a, s, o = 0, u = 188, l = !1; u < e.byteLength;)
  10363. if (71 !== e[o] || 71 !== e[u]) o++, u++;
  10364. else {
  10365. switch (r = e.subarray(o, u), Pd.ts.parseType(r, t.pid)) {
  10366. case "pes":
  10367. n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "audio" === n && a && (
  10368. s = Pd.ts.parsePesTime(r)) && (s.type = "audio", i.audio.push(s), l = !0)
  10369. }
  10370. if (l) break;
  10371. o += 188, u += 188
  10372. } for (o = (u = e.byteLength) - 188, l = !1; o >= 0;)
  10373. if (71 !== e[o] || 71 !== e[u]) o--, u--;
  10374. else {
  10375. switch (r = e.subarray(o, u), Pd.ts.parseType(r, t.pid)) {
  10376. case "pes":
  10377. n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "audio" === n && a && (
  10378. s = Pd.ts.parsePesTime(r)) && (s.type = "audio", i.audio.push(s), l = !0)
  10379. }
  10380. if (l) break;
  10381. o -= 188, u -= 188
  10382. }
  10383. },
  10384. Nd = function(e, t, i) {
  10385. for (var r, n, a, s, o, u, l, d = 0, c = 188, h = !1, f = {
  10386. data: [],
  10387. size: 0
  10388. }; c < e.byteLength;)
  10389. if (71 !== e[d] || 71 !== e[c]) d++, c++;
  10390. else {
  10391. switch (r = e.subarray(d, c), Pd.ts.parseType(r, t.pid)) {
  10392. case "pes":
  10393. if (n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "video" === n && (
  10394. a && !h && (s = Pd.ts.parsePesTime(r)) && (s.type = "video", i.video.push(s), h = !0), !i
  10395. .firstKeyFrame)) {
  10396. if (a && 0 !== f.size) {
  10397. for (o = new Uint8Array(f.size), u = 0; f.data.length;) l = f.data.shift(), o.set(l, u), u += l
  10398. .byteLength;
  10399. Pd.ts.videoPacketContainsKeyFrame(o) && (i.firstKeyFrame = Pd.ts.parsePesTime(o), i.firstKeyFrame
  10400. .type = "video"), f.size = 0
  10401. }
  10402. f.data.push(r), f.size += r.byteLength
  10403. }
  10404. }
  10405. if (h && i.firstKeyFrame) break;
  10406. d += 188, c += 188
  10407. } for (d = (c = e.byteLength) - 188, h = !1; d >= 0;)
  10408. if (71 !== e[d] || 71 !== e[c]) d--, c--;
  10409. else {
  10410. switch (r = e.subarray(d, c), Pd.ts.parseType(r, t.pid)) {
  10411. case "pes":
  10412. n = Pd.ts.parsePesType(r, t.table), a = Pd.ts.parsePayloadUnitStartIndicator(r), "video" === n && a && (
  10413. s = Pd.ts.parsePesTime(r)) && (s.type = "video", i.video.push(s), h = !0)
  10414. }
  10415. if (h) break;
  10416. d -= 188, c -= 188
  10417. }
  10418. },
  10419. Bd = function(e) {
  10420. var t = {
  10421. pid: null,
  10422. table: null
  10423. },
  10424. i = {};
  10425. for (var r in function(e, t) {
  10426. for (var i, r = 0, n = 188; n < e.byteLength;)
  10427. if (71 !== e[r] || 71 !== e[n]) r++, n++;
  10428. else {
  10429. switch (i = e.subarray(r, n), Pd.ts.parseType(i, t.pid)) {
  10430. case "pat":
  10431. t.pid || (t.pid = Pd.ts.parsePat(i));
  10432. break;
  10433. case "pmt":
  10434. t.table || (t.table = Pd.ts.parsePmt(i))
  10435. }
  10436. if (t.pid && t.table) return;
  10437. r += 188, n += 188
  10438. }
  10439. }(e, t), t.table) {
  10440. if (t.table.hasOwnProperty(r)) switch (t.table[r]) {
  10441. case mu.H264_STREAM_TYPE:
  10442. i.video = [], Nd(e, t, i), 0 === i.video.length && delete i.video;
  10443. break;
  10444. case mu.ADTS_STREAM_TYPE:
  10445. i.audio = [], Ud(e, t, i), 0 === i.audio.length && delete i.audio
  10446. }
  10447. }
  10448. return i
  10449. },
  10450. Fd = function(e, t) {
  10451. var i, r;
  10452. return (r = (i = e)[0] === "I".charCodeAt(0) && i[1] === "D".charCodeAt(0) && i[2] === "3".charCodeAt(0) ?
  10453. function(e) {
  10454. for (var t, i = !1, r = 0, n = null, a = null, s = 0, o = 0; e.length - o >= 3;) {
  10455. switch (Pd.aac.parseType(e, o)) {
  10456. case "timed-metadata":
  10457. if (e.length - o < 10) {
  10458. i = !0;
  10459. break
  10460. }
  10461. if ((s = Pd.aac.parseId3TagSize(e, o)) > e.length) {
  10462. i = !0;
  10463. break
  10464. }
  10465. null === a && (t = e.subarray(o, o + s), a = Pd.aac.parseAacTimestamp(t)), o += s;
  10466. break;
  10467. case "audio":
  10468. if (e.length - o < 7) {
  10469. i = !0;
  10470. break
  10471. }
  10472. if ((s = Pd.aac.parseAdtsSize(e, o)) > e.length) {
  10473. i = !0;
  10474. break
  10475. }
  10476. null === n && (t = e.subarray(o, o + s), n = Pd.aac.parseSampleRate(t)), r++, o += s;
  10477. break;
  10478. default:
  10479. o++
  10480. }
  10481. if (i) return null
  10482. }
  10483. if (null === n || null === a) return null;
  10484. var u = 9e4 / n;
  10485. return {
  10486. audio: [{
  10487. type: "audio",
  10488. dts: a,
  10489. pts: a
  10490. }, {
  10491. type: "audio",
  10492. dts: a + 1024 * r * u,
  10493. pts: a + 1024 * r * u
  10494. }]
  10495. }
  10496. }(e) : Bd(e)) && (r.audio || r.video) ? (function(e, t) {
  10497. if (e.audio && e.audio.length) {
  10498. var i = t;
  10499. void 0 === i && (i = e.audio[0].dts), e.audio.forEach(function(e) {
  10500. e.dts = xd(e.dts, i), e.pts = xd(e.pts, i), e.dtsTime = e.dts / 9e4, e.ptsTime = e.pts / 9e4
  10501. })
  10502. }
  10503. if (e.video && e.video.length) {
  10504. var r = t;
  10505. if (void 0 === r && (r = e.video[0].dts), e.video.forEach(function(e) {
  10506. e.dts = xd(e.dts, r), e.pts = xd(e.pts, r), e.dtsTime = e.dts / 9e4, e.ptsTime = e.pts / 9e4
  10507. }), e.firstKeyFrame) {
  10508. var n = e.firstKeyFrame;
  10509. n.dts = xd(n.dts, r), n.pts = xd(n.pts, r), n.dtsTime = n.dts / 9e4, n.ptsTime = n.dts / 9e4
  10510. }
  10511. }
  10512. }(r, t), r) : null
  10513. };
  10514. var jd = function(e, t) {
  10515. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  10516. },
  10517. Hd = function() {
  10518. function e(e, t) {
  10519. for (var i = 0; i < t.length; i++) {
  10520. var r = t[i];
  10521. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  10522. .defineProperty(e, r.key, r)
  10523. }
  10524. }
  10525. return function(t, i, r) {
  10526. return i && e(t.prototype, i), r && e(t, r), t
  10527. }
  10528. }(),
  10529. Gd = function(e, t) {
  10530. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  10531. return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t
  10532. },
  10533. Vd = function() {
  10534. var e = [
  10535. [
  10536. [],
  10537. [],
  10538. [],
  10539. [],
  10540. []
  10541. ],
  10542. [
  10543. [],
  10544. [],
  10545. [],
  10546. [],
  10547. []
  10548. ]
  10549. ],
  10550. t = e[0],
  10551. i = e[1],
  10552. r = t[4],
  10553. n = i[4],
  10554. a = void 0,
  10555. s = void 0,
  10556. o = void 0,
  10557. u = [],
  10558. l = [],
  10559. d = void 0,
  10560. c = void 0,
  10561. h = void 0,
  10562. f = void 0,
  10563. p = void 0;
  10564. for (a = 0; a < 256; a++) l[(u[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a;
  10565. for (s = o = 0; !r[s]; s ^= d || 1, o = l[o] || 1)
  10566. for (h = (h = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4) >> 8 ^ 255 & h ^ 99, r[s] = h, n[h] = s, p = 16843009 *
  10567. u[c = u[d = u[s]]] ^ 65537 * c ^ 257 * d ^ 16843008 * s, f = 257 * u[h] ^ 16843008 * h, a = 0; a < 4; a++)
  10568. t[a][s] = f = f << 24 ^ f >>> 8, i[a][h] = p = p << 24 ^ p >>> 8;
  10569. for (a = 0; a < 5; a++) t[a] = t[a].slice(0), i[a] = i[a].slice(0);
  10570. return e
  10571. },
  10572. Wd = null,
  10573. qd = function() {
  10574. function e(t) {
  10575. jd(this, e), Wd || (Wd = Vd()), this._tables = [
  10576. [Wd[0][0].slice(), Wd[0][1].slice(), Wd[0][2].slice(), Wd[0][3].slice(), Wd[0][4].slice()],
  10577. [Wd[1][0].slice(), Wd[1][1].slice(), Wd[1][2].slice(), Wd[1][3].slice(), Wd[1][4].slice()]
  10578. ];
  10579. var i = void 0,
  10580. r = void 0,
  10581. n = void 0,
  10582. a = void 0,
  10583. s = void 0,
  10584. o = this._tables[0][4],
  10585. u = this._tables[1],
  10586. l = t.length,
  10587. d = 1;
  10588. if (4 !== l && 6 !== l && 8 !== l) throw new Error("Invalid aes key size");
  10589. for (a = t.slice(0), s = [], this._key = [a, s], i = l; i < 4 * l + 28; i++) n = a[i - 1], (i % l == 0 ||
  10590. 8 === l && i % l == 4) && (n = o[n >>> 24] << 24 ^ o[n >> 16 & 255] << 16 ^ o[n >> 8 & 255] << 8 ^ o[255 &
  10591. n], i % l == 0 && (n = n << 8 ^ n >>> 24 ^ d << 24, d = d << 1 ^ 283 * (d >> 7))), a[i] = a[i - l] ^ n;
  10592. for (r = 0; i; r++, i--) n = a[3 & r ? i : i - 4], s[r] = i <= 4 || r < 4 ? n : u[0][o[n >>> 24]] ^ u[1][o[
  10593. n >> 16 & 255]] ^ u[2][o[n >> 8 & 255]] ^ u[3][o[255 & n]]
  10594. }
  10595. return e.prototype.decrypt = function(e, t, i, r, n, a) {
  10596. var s = this._key[1],
  10597. o = e ^ s[0],
  10598. u = r ^ s[1],
  10599. l = i ^ s[2],
  10600. d = t ^ s[3],
  10601. c = void 0,
  10602. h = void 0,
  10603. f = void 0,
  10604. p = s.length / 4 - 2,
  10605. m = void 0,
  10606. g = 4,
  10607. v = this._tables[1],
  10608. y = v[0],
  10609. _ = v[1],
  10610. b = v[2],
  10611. w = v[3],
  10612. E = v[4];
  10613. for (m = 0; m < p; m++) c = y[o >>> 24] ^ _[u >> 16 & 255] ^ b[l >> 8 & 255] ^ w[255 & d] ^ s[g], h = y[
  10614. u >>> 24] ^ _[l >> 16 & 255] ^ b[d >> 8 & 255] ^ w[255 & o] ^ s[g + 1], f = y[l >>> 24] ^ _[d >> 16 &
  10615. 255] ^ b[o >> 8 & 255] ^ w[255 & u] ^ s[g + 2], d = y[d >>> 24] ^ _[o >> 16 & 255] ^ b[u >> 8 & 255] ^
  10616. w[255 & l] ^ s[g + 3], g += 4, o = c, u = h, l = f;
  10617. for (m = 0; m < 4; m++) n[(3 & -m) + a] = E[o >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^ E[l >> 8 & 255] <<
  10618. 8 ^ E[255 & d] ^ s[g++], c = o, o = u, u = l, l = d, d = c
  10619. }, e
  10620. }(),
  10621. Xd = function() {
  10622. function e() {
  10623. jd(this, e), this.listeners = {}
  10624. }
  10625. return e.prototype.on = function(e, t) {
  10626. this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
  10627. }, e.prototype.off = function(e, t) {
  10628. if (!this.listeners[e]) return !1;
  10629. var i = this.listeners[e].indexOf(t);
  10630. return this.listeners[e].splice(i, 1), i > -1
  10631. }, e.prototype.trigger = function(e) {
  10632. var t = this.listeners[e];
  10633. if (t)
  10634. if (2 === arguments.length)
  10635. for (var i = t.length, r = 0; r < i; ++r) t[r].call(this, arguments[1]);
  10636. else
  10637. for (var n = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s].apply(this,
  10638. n)
  10639. }, e.prototype.dispose = function() {
  10640. this.listeners = {}
  10641. }, e.prototype.pipe = function(e) {
  10642. this.on("data", function(t) {
  10643. e.push(t)
  10644. })
  10645. }, e
  10646. }(),
  10647. zd = function(e) {
  10648. function t() {
  10649. jd(this, t);
  10650. var i = Gd(this, e.call(this, Xd));
  10651. return i.jobs = [], i.delay = 1, i.timeout_ = null, i
  10652. }
  10653. return function(e, t) {
  10654. if ("function" != typeof t && null !== t) throw new TypeError(
  10655. "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t)));
  10656. e.prototype = Object.create(t && t.prototype, {
  10657. constructor: {
  10658. value: e,
  10659. enumerable: !1,
  10660. writable: !0,
  10661. configurable: !0
  10662. }
  10663. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  10664. }(t, e), t.prototype.processJob_ = function() {
  10665. this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_.bind(this), this
  10666. .delay) : this.timeout_ = null
  10667. }, t.prototype.push = function(e) {
  10668. this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay))
  10669. }, t
  10670. }(Xd),
  10671. Kd = function(e) {
  10672. return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
  10673. },
  10674. Yd = function(e, t, i) {
  10675. var r = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2),
  10676. n = new qd(Array.prototype.slice.call(t)),
  10677. a = new Uint8Array(e.byteLength),
  10678. s = new Int32Array(a.buffer),
  10679. o = void 0,
  10680. u = void 0,
  10681. l = void 0,
  10682. d = void 0,
  10683. c = void 0,
  10684. h = void 0,
  10685. f = void 0,
  10686. p = void 0,
  10687. m = void 0;
  10688. for (o = i[0], u = i[1], l = i[2], d = i[3], m = 0; m < r.length; m += 4) c = Kd(r[m]), h = Kd(r[m + 1]), f =
  10689. Kd(r[m + 2]), p = Kd(r[m + 3]), n.decrypt(c, h, f, p, s, m), s[m] = Kd(s[m] ^ o), s[m + 1] = Kd(s[m + 1] ^ u),
  10690. s[m + 2] = Kd(s[m + 2] ^ l), s[m + 3] = Kd(s[m + 3] ^ d), o = c, u = h, l = f, d = p;
  10691. return a
  10692. },
  10693. Qd = function() {
  10694. function e(t, i, r, n) {
  10695. jd(this, e);
  10696. var a = e.STEP,
  10697. s = new Int32Array(t.buffer),
  10698. o = new Uint8Array(t.byteLength),
  10699. u = 0;
  10700. for (this.asyncStream_ = new zd, this.asyncStream_.push(this.decryptChunk_(s.subarray(u, u + a), i, r, o)),
  10701. u = a; u < s.length; u += a) r = new Uint32Array([Kd(s[u - 4]), Kd(s[u - 3]), Kd(s[u - 2]), Kd(s[u - 1])]),
  10702. this.asyncStream_.push(this.decryptChunk_(s.subarray(u, u + a), i, r, o));
  10703. this.asyncStream_.push(function() {
  10704. var e;
  10705. n(null, (e = o).subarray(0, e.byteLength - e[e.byteLength - 1]))
  10706. })
  10707. }
  10708. return e.prototype.decryptChunk_ = function(e, t, i, r) {
  10709. return function() {
  10710. var n = Yd(e, t, i);
  10711. r.set(n, e.byteOffset)
  10712. }
  10713. }, Hd(e, null, [{
  10714. key: "STEP",
  10715. get: function() {
  10716. return 32e3
  10717. }
  10718. }]), e
  10719. }(),
  10720. Jd = function(e, t) {
  10721. return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = ka.buildAbsoluteURL(n.location.href, e)), ka
  10722. .buildAbsoluteURL(e, t))
  10723. },
  10724. Zd = function(e, t) {
  10725. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  10726. },
  10727. $d = function() {
  10728. function e(e, t) {
  10729. for (var i = 0; i < t.length; i++) {
  10730. var r = t[i];
  10731. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  10732. .defineProperty(e, r.key, r)
  10733. }
  10734. }
  10735. return function(t, i, r) {
  10736. return i && e(t.prototype, i), r && e(t, r), t
  10737. }
  10738. }(),
  10739. ec = function(e, t) {
  10740. if ("function" != typeof t && null !== t) throw new TypeError(
  10741. "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(t)));
  10742. e.prototype = Object.create(t && t.prototype, {
  10743. constructor: {
  10744. value: e,
  10745. enumerable: !1,
  10746. writable: !0,
  10747. configurable: !0
  10748. }
  10749. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  10750. },
  10751. tc = function(e, t) {
  10752. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  10753. return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t
  10754. },
  10755. ic = function() {
  10756. return function(e, t) {
  10757. if (Array.isArray(e)) return e;
  10758. if (Symbol.iterator in Object(e)) return function(e, t) {
  10759. var i = [],
  10760. r = !0,
  10761. n = !1,
  10762. a = void 0;
  10763. try {
  10764. for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s.value), !t || i
  10765. .length !== t); r = !0);
  10766. } catch (e) {
  10767. n = !0, a = e
  10768. } finally {
  10769. try {
  10770. !r && o.return && o.return()
  10771. } finally {
  10772. if (n) throw a
  10773. }
  10774. }
  10775. return i
  10776. }(e, t);
  10777. throw new TypeError("Invalid attempt to destructure non-iterable instance")
  10778. }
  10779. }(),
  10780. rc = Ta.mergeOptions,
  10781. nc = Ta.EventTarget,
  10782. ac = Ta.log,
  10783. sc = function(e, t) {
  10784. ["AUDIO", "SUBTITLES"].forEach(function(i) {
  10785. for (var r in e.mediaGroups[i])
  10786. for (var n in e.mediaGroups[i][r]) {
  10787. var a = e.mediaGroups[i][r][n];
  10788. t(a, i, r, n)
  10789. }
  10790. })
  10791. },
  10792. oc = function(e, t) {
  10793. var i = rc(e, {}),
  10794. r = i.playlists[t.uri];
  10795. if (!r) return null;
  10796. if (r.segments && t.segments && r.segments.length === t.segments.length && r.mediaSequence === t.mediaSequence)
  10797. return null;
  10798. var n = rc(r, t);
  10799. r.segments && (n.segments = function(e, t, i) {
  10800. var r = t.slice();
  10801. i = i || 0;
  10802. for (var n = Math.min(e.length, t.length + i), a = i; a < n; a++) r[a - i] = rc(e[a], r[a - i]);
  10803. return r
  10804. }(r.segments, t.segments, t.mediaSequence - r.mediaSequence)), n.segments.forEach(function(e) {
  10805. ! function(e, t) {
  10806. e.resolvedUri || (e.resolvedUri = Jd(t, e.uri)), e.key && !e.key.resolvedUri && (e.key.resolvedUri = Jd(
  10807. t, e.key.uri)), e.map && !e.map.resolvedUri && (e.map.resolvedUri = Jd(t, e.map.uri))
  10808. }(e, n.resolvedUri)
  10809. });
  10810. for (var a = 0; a < i.playlists.length; a++) i.playlists[a].uri === t.uri && (i.playlists[a] = n);
  10811. return i.playlists[t.uri] = n, i
  10812. },
  10813. uc = function(e) {
  10814. for (var t = e.playlists.length; t--;) {
  10815. var i = e.playlists[t];
  10816. e.playlists[i.uri] = i, i.resolvedUri = Jd(e.uri, i.uri), i.id = t, i.attributes || (i.attributes = {}, ac
  10817. .warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))
  10818. }
  10819. },
  10820. lc = function(e) {
  10821. sc(e, function(t) {
  10822. t.uri && (t.resolvedUri = Jd(e.uri, t.uri))
  10823. })
  10824. },
  10825. dc = function(e, t) {
  10826. var i = e.segments[e.segments.length - 1];
  10827. return t && i && i.duration ? 1e3 * i.duration : 500 * (e.targetDuration || 10)
  10828. },
  10829. cc = function(e) {
  10830. function t(e, i, r) {
  10831. Zd(this, t);
  10832. var n = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
  10833. if (n.srcUrl = e, n.hls_ = i, n.withCredentials = r, !n.srcUrl) throw new Error(
  10834. "A non-empty playlist URL is required");
  10835. return n.state = "HAVE_NOTHING", n.on("mediaupdatetimeout", function() {
  10836. "HAVE_METADATA" === n.state && (n.state = "HAVE_CURRENT_METADATA", n.request = n.hls_.xhr({
  10837. uri: Jd(n.master.uri, n.media().uri),
  10838. withCredentials: n.withCredentials
  10839. }, function(e, t) {
  10840. if (n.request) return e ? n.playlistRequestError(n.request, n.media().uri, "HAVE_METADATA") :
  10841. void n.haveMetadata(n.request, n.media().uri)
  10842. }))
  10843. }), n
  10844. }
  10845. return ec(t, nc), $d(t, [{
  10846. key: "playlistRequestError",
  10847. value: function(e, t, i) {
  10848. this.request = null, i && (this.state = i), this.error = {
  10849. playlist: this.master.playlists[t],
  10850. status: e.status,
  10851. message: "HLS playlist request error at URL: " + t,
  10852. responseText: e.responseText,
  10853. code: e.status >= 500 ? 4 : 2
  10854. }, this.trigger("error")
  10855. }
  10856. }, {
  10857. key: "haveMetadata",
  10858. value: function(e, t) {
  10859. var i = this;
  10860. this.request = null, this.state = "HAVE_METADATA";
  10861. var r = new Pa;
  10862. r.push(e.responseText), r.end(), r.manifest.uri = t, r.manifest.attributes = r.manifest
  10863. .attributes || {};
  10864. var a = oc(this.master, r.manifest);
  10865. this.targetDuration = r.manifest.targetDuration, a ? (this.master = a, this.media_ = this.master
  10866. .playlists[r.manifest.uri]) : this.trigger("playlistunchanged"), this.media().endList || (n
  10867. .clearTimeout(this.mediaUpdateTimeout), this.mediaUpdateTimeout = n.setTimeout(function() {
  10868. i.trigger("mediaupdatetimeout")
  10869. }, dc(this.media(), !!a))), this.trigger("loadedplaylist")
  10870. }
  10871. }, {
  10872. key: "dispose",
  10873. value: function() {
  10874. this.stopRequest(), n.clearTimeout(this.mediaUpdateTimeout)
  10875. }
  10876. }, {
  10877. key: "stopRequest",
  10878. value: function() {
  10879. if (this.request) {
  10880. var e = this.request;
  10881. this.request = null, e.onreadystatechange = null, e.abort()
  10882. }
  10883. }
  10884. }, {
  10885. key: "media",
  10886. value: function(e) {
  10887. var t = this;
  10888. if (!e) return this.media_;
  10889. if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this
  10890. .state);
  10891. var i = this.state;
  10892. if ("string" == typeof e) {
  10893. if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e);
  10894. e = this.master.playlists[e]
  10895. }
  10896. var r = !this.media_ || e.uri !== this.media_.uri;
  10897. if (this.master.playlists[e.uri].endList) return this.request && (this.request.onreadystatechange =
  10898. null, this.request.abort(), this.request = null), this.state = "HAVE_METADATA", this.media_ =
  10899. e, void(r && (this.trigger("mediachanging"), this.trigger("mediachange")));
  10900. if (r) {
  10901. if (this.state = "SWITCHING_MEDIA", this.request) {
  10902. if (Jd(this.master.uri, e.uri) === this.request.url) return;
  10903. this.request.onreadystatechange = null, this.request.abort(), this.request = null
  10904. }
  10905. this.media_ && this.trigger("mediachanging"), this.request = this.hls_.xhr({
  10906. uri: Jd(this.master.uri, e.uri),
  10907. withCredentials: this.withCredentials
  10908. }, function(r, n) {
  10909. if (t.request) {
  10910. if (r) return t.playlistRequestError(t.request, e.uri, i);
  10911. t.haveMetadata(n, e.uri), "HAVE_MASTER" === i ? t.trigger("loadedmetadata") : t.trigger(
  10912. "mediachange")
  10913. }
  10914. })
  10915. }
  10916. }
  10917. }, {
  10918. key: "pause",
  10919. value: function() {
  10920. this.stopRequest(), n.clearTimeout(this.mediaUpdateTimeout), "HAVE_NOTHING" === this.state && (this
  10921. .started = !1), "SWITCHING_MEDIA" === this.state ? this.media_ ? this.state = "HAVE_METADATA" :
  10922. this.state = "HAVE_MASTER" : "HAVE_CURRENT_METADATA" === this.state && (this.state =
  10923. "HAVE_METADATA")
  10924. }
  10925. }, {
  10926. key: "load",
  10927. value: function(e) {
  10928. var t = this;
  10929. n.clearTimeout(this.mediaUpdateTimeout);
  10930. var i = this.media();
  10931. if (e) {
  10932. var r = i ? i.targetDuration / 2 * 1e3 : 5e3;
  10933. this.mediaUpdateTimeout = n.setTimeout(function() {
  10934. return t.load()
  10935. }, r)
  10936. } else this.started ? i && !i.endList ? this.trigger("mediaupdatetimeout") : this.trigger(
  10937. "loadedplaylist") : this.start()
  10938. }
  10939. }, {
  10940. key: "start",
  10941. value: function() {
  10942. var e = this;
  10943. this.started = !0, this.request = this.hls_.xhr({
  10944. uri: this.srcUrl,
  10945. withCredentials: this.withCredentials
  10946. }, function(t, i) {
  10947. if (e.request) {
  10948. if (e.request = null, t) return e.error = {
  10949. status: i.status,
  10950. message: "HLS playlist request error at URL: " + e.srcUrl,
  10951. responseText: i.responseText,
  10952. code: 2
  10953. }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error");
  10954. var r = new Pa;
  10955. return r.push(i.responseText), r.end(), e.state = "HAVE_MASTER", r.manifest.uri = e.srcUrl,
  10956. r.manifest.playlists ? (e.master = r.manifest, uc(e.master), lc(e.master), e.trigger(
  10957. "loadedplaylist"), void(e.request || e.media(r.manifest.playlists[0]))) : (e.master = {
  10958. mediaGroups: {
  10959. AUDIO: {},
  10960. VIDEO: {},
  10961. "CLOSED-CAPTIONS": {},
  10962. SUBTITLES: {}
  10963. },
  10964. uri: n.location.href,
  10965. playlists: [{
  10966. uri: e.srcUrl,
  10967. id: 0
  10968. }]
  10969. }, e.master.playlists[e.srcUrl] = e.master.playlists[0], e.master.playlists[0]
  10970. .resolvedUri = e.srcUrl, e.master.playlists[0].attributes = e.master.playlists[0]
  10971. .attributes || {}, e.haveMetadata(i, e.srcUrl), e.trigger("loadedmetadata"))
  10972. }
  10973. })
  10974. }
  10975. }]), t
  10976. }(),
  10977. hc = Ta.createTimeRange,
  10978. fc = function(e, t, i) {
  10979. var r, n;
  10980. return void 0 === t && (t = e.mediaSequence + e.segments.length), t < e.mediaSequence ? 0 : (r = function(e,
  10981. t) {
  10982. var i = 0,
  10983. r = t - e.mediaSequence,
  10984. n = e.segments[r];
  10985. if (n) {
  10986. if (void 0 !== n.start) return {
  10987. result: n.start,
  10988. precise: !0
  10989. };
  10990. if (void 0 !== n.end) return {
  10991. result: n.end - n.duration,
  10992. precise: !0
  10993. }
  10994. }
  10995. for (; r--;) {
  10996. if (void 0 !== (n = e.segments[r]).end) return {
  10997. result: i + n.end,
  10998. precise: !0
  10999. };
  11000. if (i += n.duration, void 0 !== n.start) return {
  11001. result: i + n.start,
  11002. precise: !0
  11003. }
  11004. }
  11005. return {
  11006. result: i,
  11007. precise: !1
  11008. }
  11009. }(e, t)).precise ? r.result : (n = function(e, t) {
  11010. for (var i = 0, r = void 0, n = t - e.mediaSequence; n < e.segments.length; n++) {
  11011. if (void 0 !== (r = e.segments[n]).start) return {
  11012. result: r.start - i,
  11013. precise: !0
  11014. };
  11015. if (i += r.duration, void 0 !== r.end) return {
  11016. result: r.end - i,
  11017. precise: !0
  11018. }
  11019. }
  11020. return {
  11021. result: -1,
  11022. precise: !1
  11023. }
  11024. }(e, t)).precise ? n.result : r.result + i
  11025. },
  11026. pc = function(e, t, i) {
  11027. if (!e) return 0;
  11028. if ("number" != typeof i && (i = 0), void 0 === t) {
  11029. if (e.totalDuration) return e.totalDuration;
  11030. if (!e.endList) return n.Infinity
  11031. }
  11032. return fc(e, t, i)
  11033. },
  11034. mc = function(e, t, i) {
  11035. var r = 0;
  11036. if (t > i) {
  11037. var n = [i, t];
  11038. t = n[0], i = n[1]
  11039. }
  11040. if (t < 0) {
  11041. for (var a = t; a < Math.min(0, i); a++) r += e.targetDuration;
  11042. t = 0
  11043. }
  11044. for (var s = t; s < i; s++) r += e.segments[s].duration;
  11045. return r
  11046. },
  11047. gc = function(e) {
  11048. if (!e.segments.length) return 0;
  11049. for (var t = e.segments.length - 1, i = e.segments[t].duration || e.targetDuration, r = i + 2 * e
  11050. .targetDuration; t-- && !((i += e.segments[t].duration) >= r););
  11051. return Math.max(0, t)
  11052. },
  11053. vc = function(e, t, i) {
  11054. if (!e || !e.segments) return null;
  11055. if (e.endList) return pc(e);
  11056. if (null === t) return null;
  11057. t = t || 0;
  11058. var r = i ? gc(e) : e.segments.length;
  11059. return fc(e, e.mediaSequence + r, t)
  11060. },
  11061. yc = function(e) {
  11062. return e - Math.floor(e) == 0
  11063. },
  11064. _c = function(e, t) {
  11065. if (yc(t)) return t + .1 * e;
  11066. for (var i = t.toString().split(".")[1].length, r = 1; r <= i; r++) {
  11067. var n = Math.pow(10, r),
  11068. a = t * n;
  11069. if (yc(a) || r === i) return (a + e) / n
  11070. }
  11071. },
  11072. bc = _c.bind(null, 1),
  11073. wc = _c.bind(null, -1),
  11074. Ec = function(e) {
  11075. return e.excludeUntil && e.excludeUntil > Date.now()
  11076. },
  11077. Tc = function(e) {
  11078. return e.excludeUntil && e.excludeUntil === 1 / 0
  11079. },
  11080. Sc = function(e) {
  11081. var t = Ec(e);
  11082. return !e.disabled && !t
  11083. },
  11084. Ac = function(e, t) {
  11085. return t.attributes && t.attributes[e]
  11086. },
  11087. kc = function(e, t) {
  11088. if (1 === e.playlists.length) return !0;
  11089. var i = t.attributes.BANDWIDTH || Number.MAX_VALUE;
  11090. return 0 === e.playlists.filter(function(e) {
  11091. return !!Sc(e) && (e.attributes.BANDWIDTH || 0) < i
  11092. }).length
  11093. },
  11094. Rc = {
  11095. duration: pc,
  11096. seekable: function(e, t) {
  11097. var i = t || 0,
  11098. r = vc(e, t, !0);
  11099. return null === r ? hc() : hc(i, r)
  11100. },
  11101. safeLiveIndex: gc,
  11102. getMediaInfoForTime: function(e, t, i, r) {
  11103. var n = void 0,
  11104. a = void 0,
  11105. s = e.segments.length,
  11106. o = t - r;
  11107. if (o < 0) {
  11108. if (i > 0)
  11109. for (n = i - 1; n >= 0; n--)
  11110. if (a = e.segments[n], (o += wc(a.duration)) > 0) return {
  11111. mediaIndex: n,
  11112. startTime: r - mc(e, i, n)
  11113. };
  11114. return {
  11115. mediaIndex: 0,
  11116. startTime: t
  11117. }
  11118. }
  11119. if (i < 0) {
  11120. for (n = i; n < 0; n++)
  11121. if ((o -= e.targetDuration) < 0) return {
  11122. mediaIndex: 0,
  11123. startTime: t
  11124. };
  11125. i = 0
  11126. }
  11127. for (n = i; n < s; n++)
  11128. if (a = e.segments[n], (o -= bc(a.duration)) < 0) return {
  11129. mediaIndex: n,
  11130. startTime: r + mc(e, i, n)
  11131. };
  11132. return {
  11133. mediaIndex: s - 1,
  11134. startTime: t
  11135. }
  11136. },
  11137. isEnabled: Sc,
  11138. isDisabled: function(e) {
  11139. return e.disabled
  11140. },
  11141. isBlacklisted: Ec,
  11142. isIncompatible: Tc,
  11143. playlistEnd: vc,
  11144. isAes: function(e) {
  11145. for (var t = 0; t < e.segments.length; t++)
  11146. if (e.segments[t].key) return !0;
  11147. return !1
  11148. },
  11149. isFmp4: function(e) {
  11150. for (var t = 0; t < e.segments.length; t++)
  11151. if (e.segments[t].map) return !0;
  11152. return !1
  11153. },
  11154. hasAttribute: Ac,
  11155. estimateSegmentRequestTime: function(e, t, i) {
  11156. var r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
  11157. return Ac("BANDWIDTH", i) ? (e * i.attributes.BANDWIDTH - 8 * r) / t : NaN
  11158. },
  11159. isLowestEnabledRendition: kc
  11160. },
  11161. Mc = Ta.xhr,
  11162. Oc = Ta.mergeOptions,
  11163. Cc = function() {
  11164. return function e(t, i) {
  11165. t = Oc({
  11166. timeout: 45e3
  11167. }, t);
  11168. var r = e.beforeRequest || Ta.Hls.xhr.beforeRequest;
  11169. if (r && "function" == typeof r) {
  11170. var n = r(t);
  11171. n && (t = n)
  11172. }
  11173. var a = Mc(t, function(e, t) {
  11174. var r = a.response;
  11175. !e && r && (a.responseTime = Date.now(), a.roundTripTime = a.responseTime - a.requestTime, a
  11176. .bytesReceived = r.byteLength || r.length, a.bandwidth || (a.bandwidth = Math.floor(a
  11177. .bytesReceived / a.roundTripTime * 8 * 1e3))), t.headers && (a.responseHeaders = t.headers),
  11178. e && "ETIMEDOUT" === e.code && (a.timedout = !0), e || a.aborted || 200 === t.statusCode || 206 ===
  11179. t.statusCode || 0 === t.statusCode || (e = new Error("XHR Failed with a response of: " + (a && (r ||
  11180. a.responseText)))), i(e, a)
  11181. }),
  11182. s = a.abort;
  11183. return a.abort = function() {
  11184. return a.aborted = !0, s.apply(a, arguments)
  11185. }, a.uri = t.uri, a.requestTime = Date.now(), a
  11186. }
  11187. },
  11188. Dc = function(e, t) {
  11189. return e.start(t) + "-" + e.end(t)
  11190. },
  11191. Ic = function(e, t) {
  11192. var i = e.toString(16);
  11193. return "00".substring(0, 2 - i.length) + i + (t % 2 ? " " : "")
  11194. },
  11195. Lc = function(e) {
  11196. return e >= 32 && e < 126 ? String.fromCharCode(e) : "."
  11197. },
  11198. xc = function(e) {
  11199. var t = {};
  11200. return Object.keys(e).forEach(function(i) {
  11201. var r = e[i];
  11202. ArrayBuffer.isView(r) ? t[i] = {
  11203. bytes: r.buffer,
  11204. byteOffset: r.byteOffset,
  11205. byteLength: r.byteLength
  11206. } : t[i] = r
  11207. }), t
  11208. },
  11209. Pc = function(e) {
  11210. var t = e.byterange || {
  11211. length: 1 / 0,
  11212. offset: 0
  11213. };
  11214. return [t.length, t.offset, e.resolvedUri].join(",")
  11215. },
  11216. Uc = function(e) {
  11217. for (var t = Array.prototype.slice.call(e), i = "", r = 0; r < t.length / 16; r++) i += t.slice(16 * r, 16 * r +
  11218. 16).map(Ic).join("") + " " + t.slice(16 * r, 16 * r + 16).map(Lc).join("") + "\n";
  11219. return i
  11220. },
  11221. Nc = Object.freeze({
  11222. createTransferableMessage: xc,
  11223. initSegmentId: Pc,
  11224. hexDump: Uc,
  11225. tagDump: function(e) {
  11226. var t = e.bytes;
  11227. return Uc(t)
  11228. },
  11229. textRanges: function(e) {
  11230. var t = "",
  11231. i = void 0;
  11232. for (i = 0; i < e.length; i++) t += Dc(e, i) + " ";
  11233. return t
  11234. }
  11235. }),
  11236. Bc = function(e, t) {
  11237. var i = [],
  11238. r = void 0;
  11239. if (e && e.length)
  11240. for (r = 0; r < e.length; r++) t(e.start(r), e.end(r)) && i.push([e.start(r), e.end(r)]);
  11241. return Ta.createTimeRanges(i)
  11242. },
  11243. Fc = function(e, t) {
  11244. return Bc(e, function(e, i) {
  11245. return e - 1 / 30 <= t && i + 1 / 30 >= t
  11246. })
  11247. },
  11248. jc = function(e, t) {
  11249. return Bc(e, function(e) {
  11250. return e - 1 / 30 >= t
  11251. })
  11252. },
  11253. Hc = function(e) {
  11254. var t = [];
  11255. if (!e || !e.length) return "";
  11256. for (var i = 0; i < e.length; i++) t.push(e.start(i) + " => " + e.end(i));
  11257. return t.join(", ")
  11258. },
  11259. Gc = function(e) {
  11260. for (var t = [], i = 0; i < e.length; i++) t.push({
  11261. start: e.start(i),
  11262. end: e.end(i)
  11263. });
  11264. return t
  11265. },
  11266. Vc = function(e, t, i) {
  11267. var r = void 0,
  11268. n = void 0;
  11269. if (i && i.cues)
  11270. for (r = i.cues.length; r--;)(n = i.cues[r]).startTime <= t && n.endTime >= e && i.removeCue(n)
  11271. },
  11272. Wc = function(e) {
  11273. return isNaN(e) || Math.abs(e) === 1 / 0 ? Number.MAX_VALUE : e
  11274. },
  11275. qc = function(e, t, i) {
  11276. var r = n.WebKitDataCue || n.VTTCue;
  11277. if (t && t.forEach(function(e) {
  11278. var t = e.stream;
  11279. this.inbandTextTracks_[t].addCue(new r(e.startTime + this.timestampOffset, e.endTime + this
  11280. .timestampOffset, e.text))
  11281. }, e), i) {
  11282. var a = Wc(e.mediaSource_.duration);
  11283. if (i.forEach(function(e) {
  11284. var t = e.cueTime + this.timestampOffset;
  11285. e.frames.forEach(function(e) {
  11286. var i = new r(t, t, e.value || e.url || e.data || "");
  11287. i.frame = e, i.value = e,
  11288. function(e) {
  11289. Object.defineProperties(e.frame, {
  11290. id: {
  11291. get: function() {
  11292. return Ta.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."), e
  11293. .value.key
  11294. }
  11295. },
  11296. value: {
  11297. get: function() {
  11298. return Ta.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),
  11299. e.value.data
  11300. }
  11301. },
  11302. privateData: {
  11303. get: function() {
  11304. return Ta.log.warn(
  11305. "cue.frame.privateData is deprecated. Use cue.value.data instead."), e.value
  11306. .data
  11307. }
  11308. }
  11309. })
  11310. }(i), this.metadataTrack_.addCue(i)
  11311. }, this)
  11312. }, e), e.metadataTrack_ && e.metadataTrack_.cues && e.metadataTrack_.cues.length) {
  11313. for (var s = e.metadataTrack_.cues, o = [], u = 0; u < s.length; u++) s[u] && o.push(s[u]);
  11314. var l = o.reduce(function(e, t) {
  11315. var i = e[t.startTime] || [];
  11316. return i.push(t), e[t.startTime] = i, e
  11317. }, {}),
  11318. d = Object.keys(l).sort(function(e, t) {
  11319. return Number(e) - Number(t)
  11320. });
  11321. d.forEach(function(e, t) {
  11322. var i = l[e],
  11323. r = Number(d[t + 1]) || a;
  11324. i.forEach(function(e) {
  11325. e.endTime = r
  11326. })
  11327. })
  11328. }
  11329. }
  11330. },
  11331. Xc = "undefined" != typeof window ? window : {},
  11332. zc = "undefined" == typeof Symbol ? "__target" : Symbol(),
  11333. Kc = "application/javascript",
  11334. Yc = Xc.BlobBuilder || Xc.WebKitBlobBuilder || Xc.MozBlobBuilder || Xc.MSBlobBuilder,
  11335. Qc = Xc.URL || Xc.webkitURL || Qc && Qc.msURL,
  11336. Jc = Xc.Worker;
  11337. function Zc(e, t) {
  11338. return function(i) {
  11339. var r = this;
  11340. if (!t) return new Jc(e);
  11341. if (Jc && !i) {
  11342. var n = ih(t.toString().replace(/^function.+?{/, "").slice(0, -1));
  11343. return this[zc] = new Jc(n),
  11344. function(e, t) {
  11345. if (!e || !t) return;
  11346. var i = e.terminate;
  11347. e.objURL = t, e.terminate = function() {
  11348. e.objURL && Qc.revokeObjectURL(e.objURL), i.call(e)
  11349. }
  11350. }(this[zc], n), this[zc]
  11351. }
  11352. var a = {
  11353. postMessage: function(e) {
  11354. r.onmessage && setTimeout(function() {
  11355. r.onmessage({
  11356. data: e,
  11357. target: a
  11358. })
  11359. })
  11360. }
  11361. };
  11362. t.call(a), this.postMessage = function(e) {
  11363. setTimeout(function() {
  11364. a.onmessage({
  11365. data: e,
  11366. target: r
  11367. })
  11368. })
  11369. }, this.isThisThread = !0
  11370. }
  11371. }
  11372. if (Jc) {
  11373. var $c, eh = ih("self.onmessage = function () {}"),
  11374. th = new Uint8Array(1);
  11375. try {
  11376. ($c = new Jc(eh)).postMessage(th, [th.buffer])
  11377. } catch (e) {
  11378. Jc = null
  11379. } finally {
  11380. Qc.revokeObjectURL(eh), $c && $c.terminate()
  11381. }
  11382. }
  11383. function ih(e) {
  11384. try {
  11385. return Qc.createObjectURL(new Blob([e], {
  11386. type: Kc
  11387. }))
  11388. } catch (i) {
  11389. var t = new Yc;
  11390. return t.append(e), Qc.createObjectURL(t.getBlob(type))
  11391. }
  11392. }
  11393. var rh = new Zc("./transmuxer-worker.worker.js", function(e, t) {
  11394. var i = this;
  11395. ! function() {
  11396. var e, t, r, n, a, s, o, u, l, d, c, h, f, p, m, g, y, _, b, w, E, T, S, A, k, R, M, O, C, D, I, L, x, P, U,
  11397. N, B, F, j, H, G = Math.pow(2, 32) - 1;
  11398. ! function() {
  11399. var e;
  11400. if (T = {
  11401. avc1: [],
  11402. avcC: [],
  11403. btrt: [],
  11404. dinf: [],
  11405. dref: [],
  11406. esds: [],
  11407. ftyp: [],
  11408. hdlr: [],
  11409. mdat: [],
  11410. mdhd: [],
  11411. mdia: [],
  11412. mfhd: [],
  11413. minf: [],
  11414. moof: [],
  11415. moov: [],
  11416. mp4a: [],
  11417. mvex: [],
  11418. mvhd: [],
  11419. sdtp: [],
  11420. smhd: [],
  11421. stbl: [],
  11422. stco: [],
  11423. stsc: [],
  11424. stsd: [],
  11425. stsz: [],
  11426. stts: [],
  11427. styp: [],
  11428. tfdt: [],
  11429. tfhd: [],
  11430. traf: [],
  11431. trak: [],
  11432. trun: [],
  11433. trex: [],
  11434. tkhd: [],
  11435. vmhd: []
  11436. }, "undefined" != typeof Uint8Array) {
  11437. for (e in T) T.hasOwnProperty(e) && (T[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e
  11438. .charCodeAt(3)
  11439. ]);
  11440. S = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]), k =
  11441. new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]), A =
  11442. new Uint8Array([0, 0, 0, 1]), R = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0,
  11443. 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0
  11444. ]), M = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  11445. 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0
  11446. ]), O = {
  11447. video: R,
  11448. audio: M
  11449. }, I = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), D =
  11450. new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), L = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), x = L, P =
  11451. new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), U = L, C = new Uint8Array([0, 0, 0, 1, 0, 0, 0,
  11452. 0, 0, 0, 0, 0
  11453. ])
  11454. }
  11455. }(), e = function(e) {
  11456. var t, i, r = [],
  11457. n = 0;
  11458. for (t = 1; t < arguments.length; t++) r.push(arguments[t]);
  11459. for (t = r.length; t--;) n += r[t].byteLength;
  11460. for (i = new Uint8Array(n + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i
  11461. .byteLength), i.set(e, 4), t = 0, n = 8; t < r.length; t++) i.set(r[t], n), n += r[t].byteLength;
  11462. return i
  11463. }, t = function() {
  11464. return e(T.dinf, e(T.dref, I))
  11465. }, r = function(t) {
  11466. return e(T.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192, 0,
  11467. 0, 218, 192, 5, 2, t.audioobjecttype << 3 | t.samplingfrequencyindex >>> 1, t
  11468. .samplingfrequencyindex << 7 | t.channelcount << 3, 6, 1, 2
  11469. ]))
  11470. }, m = function(t) {
  11471. return e(T.hdlr, O[t])
  11472. }, p = function(t) {
  11473. var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, t.duration >>> 24 & 255, t
  11474. .duration >>> 16 & 255, t.duration >>> 8 & 255, 255 & t.duration, 85, 196, 0, 0
  11475. ]);
  11476. return t.samplerate && (i[12] = t.samplerate >>> 24 & 255, i[13] = t.samplerate >>> 16 & 255, i[14] = t
  11477. .samplerate >>> 8 & 255, i[15] = 255 & t.samplerate), e(T.mdhd, i)
  11478. }, f = function(t) {
  11479. return e(T.mdia, p(t), m(t.type), s(t))
  11480. }, a = function(t) {
  11481. return e(T.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & t) >> 24, (16711680 & t) >> 16, (65280 &
  11482. t) >> 8, 255 & t
  11483. ]))
  11484. }, s = function(i) {
  11485. return e(T.minf, "video" === i.type ? e(T.vmhd, C) : e(T.smhd, D), t(), y(i))
  11486. }, o = function(t, i) {
  11487. for (var r = [], n = i.length; n--;) r[n] = b(i[n]);
  11488. return e.apply(null, [T.moof, a(t)].concat(r))
  11489. }, u = function(t) {
  11490. for (var i = t.length, r = []; i--;) r[i] = c(t[i]);
  11491. return e.apply(null, [T.moov, d(4294967295)].concat(r).concat(l(t)))
  11492. }, l = function(t) {
  11493. for (var i = t.length, r = []; i--;) r[i] = w(t[i]);
  11494. return e.apply(null, [T.mvex].concat(r))
  11495. }, d = function(t) {
  11496. var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & t) >> 24, (
  11497. 16711680 & t) >> 16, (65280 & t) >> 8, 255 & t, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  11498. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  11499. 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255,
  11500. 255, 255
  11501. ]);
  11502. return e(T.mvhd, i)
  11503. }, g = function(t) {
  11504. var i, r, n = t.samples || [],
  11505. a = new Uint8Array(4 + n.length);
  11506. for (r = 0; r < n.length; r++) i = n[r].flags, a[r + 4] = i.dependsOn << 4 | i.isDependedOn << 2 | i
  11507. .hasRedundancy;
  11508. return e(T.sdtp, a)
  11509. }, y = function(t) {
  11510. return e(T.stbl, _(t), e(T.stts, U), e(T.stsc, x), e(T.stsz, P), e(T.stco, L))
  11511. }, _ = function(t) {
  11512. return e(T.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === t.type ? N(t) : B(t))
  11513. }, N = function(t) {
  11514. var i, r = t.sps || [],
  11515. n = t.pps || [],
  11516. a = [],
  11517. s = [];
  11518. for (i = 0; i < r.length; i++) a.push((65280 & r[i].byteLength) >>> 8), a.push(255 & r[i].byteLength),
  11519. a = a.concat(Array.prototype.slice.call(r[i]));
  11520. for (i = 0; i < n.length; i++) s.push((65280 & n[i].byteLength) >>> 8), s.push(255 & n[i].byteLength),
  11521. s = s.concat(Array.prototype.slice.call(n[i]));
  11522. return e(T.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  11523. (65280 & t.width) >> 8, 255 & t.width, (65280 & t.height) >> 8, 255 & t.height, 0, 72, 0, 0, 0,
  11524. 72, 0, 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111, 110, 116, 114,
  11525. 105, 98, 45, 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17
  11526. ]), e(T.avcC, new Uint8Array([1, t.profileIdc, t.profileCompatibility, t.levelIdc, 255].concat([r
  11527. .length
  11528. ]).concat(a).concat([n.length]).concat(s))), e(T.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198,
  11529. 192, 0, 45, 198, 192
  11530. ])))
  11531. }, B = function(t) {
  11532. return e(T.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & t
  11533. .channelcount) >> 8, 255 & t.channelcount, (65280 & t.samplesize) >> 8, 255 & t.samplesize, 0,
  11534. 0, 0, 0, (65280 & t.samplerate) >> 8, 255 & t.samplerate, 0, 0
  11535. ]), r(t))
  11536. }, h = function(t) {
  11537. var i = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & t.id) >> 24, (16711680 & t
  11538. .id) >> 16, (65280 & t.id) >> 8, 255 & t.id, 0, 0, 0, 0, (4278190080 & t.duration) >> 24, (
  11539. 16711680 & t.duration) >> 16, (65280 & t.duration) >> 8, 255 & t.duration, 0, 0, 0, 0, 0, 0, 0,
  11540. 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
  11541. 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (65280 & t.width) >> 8, 255 & t.width, 0, 0, (65280 & t
  11542. .height) >> 8, 255 & t.height, 0, 0
  11543. ]);
  11544. return e(T.tkhd, i)
  11545. }, b = function(t) {
  11546. var i, r, n, a, s, o;
  11547. return i = e(T.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & t.id) >> 24, (16711680 & t.id) >> 16, (
  11548. 65280 & t.id) >> 8, 255 & t.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])), s = Math.floor(t
  11549. .baseMediaDecodeTime / (G + 1)), o = Math.floor(t.baseMediaDecodeTime % (G + 1)), r = e(T.tfdt,
  11550. new Uint8Array([1, 0, 0, 0, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255, 255 & s, o >>> 24 & 255,
  11551. o >>> 16 & 255, o >>> 8 & 255, 255 & o
  11552. ])), 92, "audio" === t.type ? (n = E(t, 92), e(T.traf, i, r, n)) : (a = g(t), n = E(t, a.length +
  11553. 92), e(T.traf, i, r, n, a))
  11554. }, c = function(t) {
  11555. return t.duration = t.duration || 4294967295, e(T.trak, h(t), f(t))
  11556. }, w = function(t) {
  11557. var i = new Uint8Array([0, 0, 0, 0, (4278190080 & t.id) >> 24, (16711680 & t.id) >> 16, (65280 & t
  11558. .id) >> 8, 255 & t.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1
  11559. ]);
  11560. return "video" !== t.type && (i[i.length - 1] = 0), e(T.trex, i)
  11561. }, H = function(e, t) {
  11562. var i = 0,
  11563. r = 0,
  11564. n = 0,
  11565. a = 0;
  11566. return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (r = 2), void 0 !== e[
  11567. 0].flags && (n = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | r | n | a, 1, (
  11568. 4278190080 & e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 & e
  11569. .length, (4278190080 & t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t
  11570. ]
  11571. }, j = function(t, i) {
  11572. var r, n, a, s;
  11573. for (i += 20 + 16 * (n = t.samples || []).length, r = H(n, i), s = 0; s < n.length; s++) a = n[s], r = r
  11574. .concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a.duration) >>> 8,
  11575. 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>> 16, (65280 & a.size) >>>
  11576. 8, 255 & a.size, a.flags.isLeading << 2 | a.flags.dependsOn, a.flags.isDependedOn << 6 | a.flags
  11577. .hasRedundancy << 4 | a.flags.paddingValue << 1 | a.flags.isNonSyncSample, 61440 & a.flags
  11578. .degradationPriority, 15 & a.flags.degradationPriority, (4278190080 & a.compositionTimeOffset) >>>
  11579. 24, (16711680 & a.compositionTimeOffset) >>> 16, (65280 & a.compositionTimeOffset) >>> 8, 255 & a
  11580. .compositionTimeOffset
  11581. ]);
  11582. return e(T.trun, new Uint8Array(r))
  11583. }, F = function(t, i) {
  11584. var r, n, a, s;
  11585. for (i += 20 + 8 * (n = t.samples || []).length, r = H(n, i), s = 0; s < n.length; s++) a = n[s], r = r
  11586. .concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a.duration) >>> 8,
  11587. 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>> 16, (65280 & a.size) >>>
  11588. 8, 255 & a.size
  11589. ]);
  11590. return e(T.trun, new Uint8Array(r))
  11591. }, E = function(e, t) {
  11592. return "audio" === e.type ? F(e, t) : j(e, t)
  11593. };
  11594. var V, W, q = {
  11595. ftyp: n = function() {
  11596. return e(T.ftyp, S, A, S, k)
  11597. },
  11598. mdat: function(t) {
  11599. return e(T.mdat, t)
  11600. },
  11601. moof: o,
  11602. moov: u,
  11603. initSegment: function(e) {
  11604. var t, i = n(),
  11605. r = u(e);
  11606. return (t = new Uint8Array(i.byteLength + r.byteLength)).set(i), t.set(r, i.byteLength), t
  11607. }
  11608. },
  11609. X = function(e) {
  11610. return e >>> 0
  11611. },
  11612. z = {
  11613. findBox: V = function(e, t) {
  11614. var i, r, n, a, s, o = [];
  11615. if (!t.length) return null;
  11616. for (i = 0; i < e.byteLength;) r = X(e[i] << 24 | e[i + 1] << 16 | e[i + 2] << 8 | e[i + 3]), n = W(
  11617. e.subarray(i + 4, i + 8)), a = r > 1 ? i + r : e.byteLength, n === t[0] && (1 === t.length ? o
  11618. .push(e.subarray(i + 8, a)) : (s = V(e.subarray(i + 8, a), t.slice(1))).length && (o = o.concat(
  11619. s))), i = a;
  11620. return o
  11621. },
  11622. parseType: W = function(e) {
  11623. var t = "";
  11624. return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[
  11625. 2]), t += String.fromCharCode(e[3])
  11626. },
  11627. timescale: function(e) {
  11628. return V(e, ["moov", "trak"]).reduce(function(e, t) {
  11629. var i, r, n, a, s;
  11630. return (i = V(t, ["tkhd"])[0]) ? (r = i[0], a = X(i[n = 0 === r ? 12 : 20] << 24 | i[n + 1] <<
  11631. 16 | i[n + 2] << 8 | i[n + 3]), (s = V(t, ["mdia", "mdhd"])[0]) ? (n = 0 === (r = s[
  11632. 0]) ? 12 : 20, e[a] = X(s[n] << 24 | s[n + 1] << 16 | s[n + 2] << 8 | s[n + 3]), e) :
  11633. null) : null
  11634. }, {})
  11635. },
  11636. startTime: function(e, t) {
  11637. var i, r, n;
  11638. return i = V(t, ["moof", "traf"]), r = [].concat.apply([], i.map(function(t) {
  11639. return V(t, ["tfhd"]).map(function(i) {
  11640. var r, n;
  11641. return r = X(i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7]), n = e[r] || 9e4, (V(t, [
  11642. "tfdt"
  11643. ]).map(function(e) {
  11644. var t, i;
  11645. return t = e[0], i = X(e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]), 1 === t &&
  11646. (i *= Math.pow(2, 32), i += X(e[8] << 24 | e[9] << 16 | e[10] << 8 | e[
  11647. 11])), i
  11648. })[0] || 1 / 0) / n
  11649. })
  11650. })), n = Math.min.apply(null, r), isFinite(n) ? n : 0
  11651. },
  11652. videoTrackIds: function(e) {
  11653. var t = [];
  11654. return V(e, ["moov", "trak"]).forEach(function(e) {
  11655. var i = V(e, ["mdia", "hdlr"]),
  11656. r = V(e, ["tkhd"]);
  11657. i.forEach(function(e, i) {
  11658. var n, a, s = W(e.subarray(8, 12)),
  11659. o = r[i];
  11660. "vide" === s && (a = 0 === (n = new DataView(o.buffer, o.byteOffset, o.byteLength))
  11661. .getUint8(0) ? n.getUint32(12) : n.getUint32(20), t.push(a))
  11662. })
  11663. }), t
  11664. }
  11665. },
  11666. K = function() {
  11667. this.init = function() {
  11668. var e = {};
  11669. this.on = function(t, i) {
  11670. e[t] || (e[t] = []), e[t] = e[t].concat(i)
  11671. }, this.off = function(t, i) {
  11672. var r;
  11673. return !!e[t] && (r = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(r, 1), r > -1)
  11674. }, this.trigger = function(t) {
  11675. var i, r, n, a;
  11676. if (i = e[t])
  11677. if (2 === arguments.length)
  11678. for (n = i.length, r = 0; r < n; ++r) i[r].call(this, arguments[1]);
  11679. else {
  11680. for (a = [], r = arguments.length, r = 1; r < arguments.length; ++r) a.push(arguments[r]);
  11681. for (n = i.length, r = 0; r < n; ++r) i[r].apply(this, a)
  11682. }
  11683. }, this.dispose = function() {
  11684. e = {}
  11685. }
  11686. }
  11687. };
  11688. K.prototype.pipe = function(e) {
  11689. return this.on("data", function(t) {
  11690. e.push(t)
  11691. }), this.on("done", function(t) {
  11692. e.flush(t)
  11693. }), e
  11694. }, K.prototype.push = function(e) {
  11695. this.trigger("data", e)
  11696. }, K.prototype.flush = function(e) {
  11697. this.trigger("done", e)
  11698. };
  11699. var Y = K,
  11700. Q = function(e, t) {
  11701. var i = {
  11702. size: 0,
  11703. flags: {
  11704. isLeading: 0,
  11705. dependsOn: 1,
  11706. isDependedOn: 0,
  11707. hasRedundancy: 0,
  11708. degradationPriority: 0,
  11709. isNonSyncSample: 1
  11710. }
  11711. };
  11712. return i.dataOffset = t, i.compositionTimeOffset = e.pts - e.dts, i.duration = e.duration, i.size = 4 *
  11713. e.length, i.size += e.byteLength, e.keyFrame && (i.flags.dependsOn = 2, i.flags.isNonSyncSample = 0),
  11714. i
  11715. },
  11716. J = function(e) {
  11717. var t, i, r = [],
  11718. n = [];
  11719. for (r.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t])
  11720. .nalUnitType ? (r.length && (r.duration = i.dts - r.dts, n.push(r)), (r = [i]).byteLength = i.data
  11721. .byteLength, r.pts = i.pts, r.dts = i.dts) : ("slice_layer_without_partitioning_rbsp_idr" === i
  11722. .nalUnitType && (r.keyFrame = !0), r.duration = i.dts - r.dts, r.byteLength += i.data.byteLength, r
  11723. .push(i));
  11724. return n.length && (!r.duration || r.duration <= 0) && (r.duration = n[n.length - 1].duration), n.push(
  11725. r), n
  11726. },
  11727. Z = function(e) {
  11728. var t, i, r = [],
  11729. n = [];
  11730. for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, n
  11731. .byteLength = 0, n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, t = 0; t < e
  11732. .length; t++)(i = e[t]).keyFrame ? (r.length && (n.push(r), n.byteLength += r.byteLength, n
  11733. .nalCount += r.nalCount, n.duration += r.duration), (r = [i]).nalCount = i.length, r.byteLength =
  11734. i.byteLength, r.pts = i.pts, r.dts = i.dts, r.duration = i.duration) : (r.duration += i.duration, r
  11735. .nalCount += i.length, r.byteLength += i.byteLength, r.push(i));
  11736. return n.length && r.duration <= 0 && (r.duration = n[n.length - 1].duration), n.byteLength += r
  11737. .byteLength, n.nalCount += r.nalCount, n.duration += r.duration, n.push(r), n
  11738. },
  11739. $ = function(e) {
  11740. var t;
  11741. return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e.nalCount -=
  11742. t.nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t.duration), e
  11743. },
  11744. ee = function(e, t) {
  11745. var i, r, n, a, s, o = t || 0,
  11746. u = [];
  11747. for (i = 0; i < e.length; i++)
  11748. for (a = e[i], r = 0; r < a.length; r++) s = a[r], o += (n = Q(s, o)).size, u.push(n);
  11749. return u
  11750. },
  11751. te = function(e) {
  11752. var t, i, r, n, a, s, o = 0,
  11753. u = e.byteLength,
  11754. l = e.nalCount,
  11755. d = new Uint8Array(u + 4 * l),
  11756. c = new DataView(d.buffer);
  11757. for (t = 0; t < e.length; t++)
  11758. for (n = e[t], i = 0; i < n.length; i++)
  11759. for (a = n[i], r = 0; r < a.length; r++) s = a[r], c.setUint32(o, s.data.byteLength), o += 4, d.set(
  11760. s.data, o), o += s.data.byteLength;
  11761. return d
  11762. },
  11763. ie = function(e) {
  11764. delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts
  11765. },
  11766. re = function(e, t) {
  11767. var i, r = e.minSegmentDts;
  11768. return t || (r -= e.timelineStartInfo.dts), i = e.timelineStartInfo.baseMediaDecodeTime, i += r, i =
  11769. Math.max(0, i), "audio" === e.type && (i *= e.samplerate / 9e4, i = Math.floor(i)), i
  11770. },
  11771. ne = function(e, t) {
  11772. "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t.pts),
  11773. void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e.minSegmentPts, t
  11774. .pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e.maxSegmentPts = Math.max(e
  11775. .maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e.timelineStartInfo.dts && (e
  11776. .timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e.minSegmentDts = t.dts : e
  11777. .minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e.maxSegmentDts ? e.maxSegmentDts = t
  11778. .dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts))
  11779. },
  11780. ae = function(e) {
  11781. for (var t = 0, i = {
  11782. payloadType: -1,
  11783. payloadSize: 0
  11784. }, r = 0, n = 0; t < e.byteLength && 128 !== e[t];) {
  11785. for (; 255 === e[t];) r += 255, t++;
  11786. for (r += e[t++]; 255 === e[t];) n += 255, t++;
  11787. if (n += e[t++], !i.payload && 4 === r) {
  11788. i.payloadType = r, i.payloadSize = n, i.payload = e.subarray(t, t + n);
  11789. break
  11790. }
  11791. t += n, r = 0, n = 0
  11792. }
  11793. return i
  11794. },
  11795. se = function(e) {
  11796. return 181 !== e.payload[0] ? null : 49 != (e.payload[1] << 8 | e.payload[2]) ? null : "GA94" !== String
  11797. .fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) ? null : 3 !== e.payload[7] ?
  11798. null : e.payload.subarray(8, e.payload.length - 1)
  11799. },
  11800. oe = function(e, t) {
  11801. var i, r, n, a, s = [];
  11802. if (!(64 & t[0])) return s;
  11803. for (r = 31 & t[0], i = 0; i < r; i++) a = {
  11804. type: 3 & t[2 + (n = 3 * i)],
  11805. pts: e
  11806. }, 4 & t[n + 2] && (a.ccData = t[n + 3] << 8 | t[n + 4], s.push(a));
  11807. return s
  11808. },
  11809. ue = function(e) {
  11810. for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[a +
  11811. 2] ? (n.push(a + 2), a += 2) : a++;
  11812. if (0 === n.length) return e;
  11813. t = r - n.length, i = new Uint8Array(t);
  11814. var s = 0;
  11815. for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s];
  11816. return i
  11817. },
  11818. le = 4,
  11819. de = function e() {
  11820. e.prototype.init.call(this), this.captionPackets_ = [], this.ccStreams_ = [new me(0, 0), new me(0, 1),
  11821. new me(1, 0), new me(1, 1)
  11822. ], this.reset(), this.ccStreams_.forEach(function(e) {
  11823. e.on("data", this.trigger.bind(this, "data")), e.on("done", this.trigger.bind(this, "done"))
  11824. }, this)
  11825. };
  11826. (de.prototype = new Y).push = function(e) {
  11827. var t, i, r;
  11828. if ("sei_rbsp" === e.nalUnitType && (t = ae(e.escapedRBSP)).payloadType === le && (i = se(t)))
  11829. if (e.dts < this.latestDts_) this.ignoreNextEqualDts_ = !0;
  11830. else {
  11831. if (e.dts === this.latestDts_ && this.ignoreNextEqualDts_) return this.numSameDts_--, void(this
  11832. .numSameDts_ || (this.ignoreNextEqualDts_ = !1));
  11833. r = oe(e.pts, i), this.captionPackets_ = this.captionPackets_.concat(r), this.latestDts_ !== e
  11834. .dts && (this.numSameDts_ = 0), this.numSameDts_++, this.latestDts_ = e.dts
  11835. }
  11836. }, de.prototype.flush = function() {
  11837. this.captionPackets_.length ? (this.captionPackets_.forEach(function(e, t) {
  11838. e.presortIndex = t
  11839. }), this.captionPackets_.sort(function(e, t) {
  11840. return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts
  11841. }), this.captionPackets_.forEach(function(e) {
  11842. e.type < 2 && this.dispatchCea608Packet(e)
  11843. }, this), this.captionPackets_.length = 0, this.ccStreams_.forEach(function(e) {
  11844. e.flush()
  11845. }, this)) : this.ccStreams_.forEach(function(e) {
  11846. e.flush()
  11847. }, this)
  11848. }, de.prototype.reset = function() {
  11849. this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.numSameDts_ = 0, this
  11850. .activeCea608Channel_ = [null, null], this.ccStreams_.forEach(function(e) {
  11851. e.reset()
  11852. })
  11853. }, de.prototype.dispatchCea608Packet = function(e) {
  11854. this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (this
  11855. .activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this.ccStreams_[(e
  11856. .type << 1) + this.activeCea608Channel_[e.type]].push(e)
  11857. }, de.prototype.setsChannel1Active = function(e) {
  11858. return 4096 == (30720 & e.ccData)
  11859. }, de.prototype.setsChannel2Active = function(e) {
  11860. return 6144 == (30720 & e.ccData)
  11861. };
  11862. var ce = {
  11863. 42: 225,
  11864. 92: 233,
  11865. 94: 237,
  11866. 95: 243,
  11867. 96: 250,
  11868. 123: 231,
  11869. 124: 247,
  11870. 125: 209,
  11871. 126: 241,
  11872. 127: 9608,
  11873. 304: 174,
  11874. 305: 176,
  11875. 306: 189,
  11876. 307: 191,
  11877. 308: 8482,
  11878. 309: 162,
  11879. 310: 163,
  11880. 311: 9834,
  11881. 312: 224,
  11882. 313: 160,
  11883. 314: 232,
  11884. 315: 226,
  11885. 316: 234,
  11886. 317: 238,
  11887. 318: 244,
  11888. 319: 251,
  11889. 544: 193,
  11890. 545: 201,
  11891. 546: 211,
  11892. 547: 218,
  11893. 548: 220,
  11894. 549: 252,
  11895. 550: 8216,
  11896. 551: 161,
  11897. 552: 42,
  11898. 553: 39,
  11899. 554: 8212,
  11900. 555: 169,
  11901. 556: 8480,
  11902. 557: 8226,
  11903. 558: 8220,
  11904. 559: 8221,
  11905. 560: 192,
  11906. 561: 194,
  11907. 562: 199,
  11908. 563: 200,
  11909. 564: 202,
  11910. 565: 203,
  11911. 566: 235,
  11912. 567: 206,
  11913. 568: 207,
  11914. 569: 239,
  11915. 570: 212,
  11916. 571: 217,
  11917. 572: 249,
  11918. 573: 219,
  11919. 574: 171,
  11920. 575: 187,
  11921. 800: 195,
  11922. 801: 227,
  11923. 802: 205,
  11924. 803: 204,
  11925. 804: 236,
  11926. 805: 210,
  11927. 806: 242,
  11928. 807: 213,
  11929. 808: 245,
  11930. 809: 123,
  11931. 810: 125,
  11932. 811: 92,
  11933. 812: 94,
  11934. 813: 95,
  11935. 814: 124,
  11936. 815: 126,
  11937. 816: 196,
  11938. 817: 228,
  11939. 818: 214,
  11940. 819: 246,
  11941. 820: 223,
  11942. 821: 165,
  11943. 822: 164,
  11944. 823: 9474,
  11945. 824: 197,
  11946. 825: 229,
  11947. 826: 216,
  11948. 827: 248,
  11949. 828: 9484,
  11950. 829: 9488,
  11951. 830: 9492,
  11952. 831: 9496
  11953. },
  11954. he = function(e) {
  11955. return null === e ? "" : (e = ce[e] || e, String.fromCharCode(e))
  11956. },
  11957. fe = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152],
  11958. pe = function() {
  11959. for (var e = [], t = 15; t--;) e.push("");
  11960. return e
  11961. },
  11962. me = function e(t, i) {
  11963. e.prototype.init.call(this), this.field_ = t || 0, this.dataChannel_ = i || 0, this.name_ = "CC" + (1 +
  11964. (this.field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push = function(
  11965. e) {
  11966. var t, i, r, n, a;
  11967. if ((t = 32639 & e.ccData) !== this.lastControlCode_) {
  11968. if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this
  11969. .lastControlCode_ = null), r = t >>> 8, n = 255 & t, t !== this.PADDING_)
  11970. if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn";
  11971. else if (t === this.END_OF_CAPTION_) this.mode_ = "popOn", this.clearFormatting(e.pts), this
  11972. .flushDisplayed(e.pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this
  11973. .nonDisplayed_ = i, this.startPts_ = e.pts;
  11974. else if (t === this.ROLL_UP_2_ROWS_) this.rollUpRows_ = 2, this.setRollUp(e.pts);
  11975. else if (t === this.ROLL_UP_3_ROWS_) this.rollUpRows_ = 3, this.setRollUp(e.pts);
  11976. else if (t === this.ROLL_UP_4_ROWS_) this.rollUpRows_ = 4, this.setRollUp(e.pts);
  11977. else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts),
  11978. this.shiftRowsUp_(), this.startPts_ = e.pts;
  11979. else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this
  11980. .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_]
  11981. .slice(0, -1);
  11982. else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ = pe();
  11983. else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = pe();
  11984. else if (t === this.RESUME_DIRECT_CAPTIONING_) "paintOn" !== this.mode_ && (this.flushDisplayed(e
  11985. .pts), this.displayed_ = pe()), this.mode_ = "paintOn", this.startPts_ = e.pts;
  11986. else if (this.isSpecialCharacter(r, n)) a = he((r = (3 & r) << 8) | n), this[this.mode_](e.pts,
  11987. a), this.column_++;
  11988. else if (this.isExtCharacter(r, n)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] = this
  11989. .nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[this.row_] = this.displayed_[this.row_]
  11990. .slice(0, -1), a = he((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++;
  11991. else if (this.isMidRowCode(r, n)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "), this
  11992. .column_++, 14 == (14 & n) && this.addFormatting(e.pts, ["i"]), 1 == (1 & n) && this
  11993. .addFormatting(e.pts, ["u"]);
  11994. else if (this.isOffsetControlCode(r, n)) this.column_ += 3 & n;
  11995. else if (this.isPAC(r, n)) {
  11996. var s = fe.indexOf(7968 & t);
  11997. "rollUp" === this.mode_ && this.setRollUp(e.pts, s), s !== this.row_ && (this.clearFormatting(e
  11998. .pts), this.row_ = s), 1 & n && -1 === this.formatting_.indexOf("u") && this.addFormatting(e
  11999. .pts, ["u"]), 16 == (16 & t) && (this.column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(n) &&
  12000. 14 == (14 & n) && this.addFormatting(e.pts, ["i"])
  12001. } else this.isNormalChar(r) && (0 === n && (n = null), a = he(r), a += he(n), this[this.mode_](e
  12002. .pts, a), this.column_ += a.length)
  12003. } else this.lastControlCode_ = null
  12004. }
  12005. };
  12006. me.prototype = new Y, me.prototype.flushDisplayed = function(e) {
  12007. var t = this.displayed_.map(function(e) {
  12008. return e.trim()
  12009. }).join("\n").replace(/^\n+|\n+$/g, "");
  12010. t.length && this.trigger("data", {
  12011. startPts: this.startPts_,
  12012. endPts: e,
  12013. text: t,
  12014. stream: this.name_
  12015. })
  12016. }, me.prototype.reset = function() {
  12017. this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = pe(), this.nonDisplayed_ =
  12018. pe(), this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this.rollUpRows_ = 2, this
  12019. .formatting_ = []
  12020. }, me.prototype.setConstants = function() {
  12021. 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8,
  12022. this.OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this.CONTROL_ = (
  12023. 28 | this.field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this.RESUME_CAPTION_LOADING_ = 32 |
  12024. this.CONTROL_, this.END_OF_CAPTION_ = 47 | this.CONTROL_, this.ROLL_UP_2_ROWS_ = 37 | this.CONTROL_,
  12025. this.ROLL_UP_3_ROWS_ = 38 | this.CONTROL_, this.ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this
  12026. .CARRIAGE_RETURN_ = 45 | this.CONTROL_, this.RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this
  12027. .BACKSPACE_ = 33 | this.CONTROL_, this.ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this
  12028. .ERASE_NON_DISPLAYED_MEMORY_ = 46 | this.CONTROL_
  12029. }, me.prototype.isSpecialCharacter = function(e, t) {
  12030. return e === this.EXT_ && t >= 48 && t <= 63
  12031. }, me.prototype.isExtCharacter = function(e, t) {
  12032. return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63
  12033. }, me.prototype.isMidRowCode = function(e, t) {
  12034. return e === this.EXT_ && t >= 32 && t <= 47
  12035. }, me.prototype.isOffsetControlCode = function(e, t) {
  12036. return e === this.OFFSET_ && t >= 33 && t <= 35
  12037. }, me.prototype.isPAC = function(e, t) {
  12038. return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127
  12039. }, me.prototype.isColorPAC = function(e) {
  12040. return e >= 64 && e <= 79 || e >= 96 && e <= 127
  12041. }, me.prototype.isNormalChar = function(e) {
  12042. return e >= 32 && e <= 127
  12043. }, me.prototype.setRollUp = function(e, t) {
  12044. if ("rollUp" !== this.mode_ && (this.row_ = 14, this.mode_ = "rollUp", this.flushDisplayed(e), this
  12045. .nonDisplayed_ = pe(), this.displayed_ = pe()), void 0 !== t && t !== this.row_)
  12046. for (var i = 0; i < this.rollUpRows_; i++) this.displayed_[t - i] = this.displayed_[this.row_ - i],
  12047. this.displayed_[this.row_ - i] = "";
  12048. void 0 === t && (t = this.row_), this.topRow_ = t - this.rollUpRows_ + 1
  12049. }, me.prototype.addFormatting = function(e, t) {
  12050. this.formatting_ = this.formatting_.concat(t);
  12051. var i = t.reduce(function(e, t) {
  12052. return e + "<" + t + ">"
  12053. }, "");
  12054. this[this.mode_](e, i)
  12055. }, me.prototype.clearFormatting = function(e) {
  12056. if (this.formatting_.length) {
  12057. var t = this.formatting_.reverse().reduce(function(e, t) {
  12058. return e + "</" + t + ">"
  12059. }, "");
  12060. this.formatting_ = [], this[this.mode_](e, t)
  12061. }
  12062. }, me.prototype.popOn = function(e, t) {
  12063. var i = this.nonDisplayed_[this.row_];
  12064. i += t, this.nonDisplayed_[this.row_] = i
  12065. }, me.prototype.rollUp = function(e, t) {
  12066. var i = this.displayed_[this.row_];
  12067. i += t, this.displayed_[this.row_] = i
  12068. }, me.prototype.shiftRowsUp_ = function() {
  12069. var e;
  12070. for (e = 0; e < this.topRow_; e++) this.displayed_[e] = "";
  12071. for (e = this.row_ + 1; e < 15; e++) this.displayed_[e] = "";
  12072. for (e = this.topRow_; e < this.row_; e++) this.displayed_[e] = this.displayed_[e + 1];
  12073. this.displayed_[this.row_] = ""
  12074. }, me.prototype.paintOn = function(e, t) {
  12075. var i = this.displayed_[this.row_];
  12076. i += t, this.displayed_[this.row_] = i
  12077. };
  12078. var ge = {
  12079. CaptionStream: de,
  12080. Cea608Stream: me
  12081. },
  12082. ve = {
  12083. H264_STREAM_TYPE: 27,
  12084. ADTS_STREAM_TYPE: 15,
  12085. METADATA_STREAM_TYPE: 21
  12086. },
  12087. ye = function(e, t) {
  12088. var i = 1;
  12089. for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i;
  12090. return e
  12091. },
  12092. _e = function e(t) {
  12093. var i, r;
  12094. e.prototype.init.call(this), this.type_ = t, this.push = function(e) {
  12095. e.type === this.type_ && (void 0 === r && (r = e.dts), e.dts = ye(e.dts, r), e.pts = ye(e.pts, r),
  12096. i = e.dts, this.trigger("data", e))
  12097. }, this.flush = function() {
  12098. r = i, this.trigger("done")
  12099. }, this.discontinuity = function() {
  12100. r = void 0, i = void 0
  12101. }
  12102. };
  12103. _e.prototype = new Y;
  12104. var be, we = _e,
  12105. Ee = function(e, t, i) {
  12106. var r, n = "";
  12107. for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2);
  12108. return n
  12109. },
  12110. Te = function(e, t, i) {
  12111. return decodeURIComponent(Ee(e, t, i))
  12112. },
  12113. Se = function(e) {
  12114. return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
  12115. },
  12116. Ae = {
  12117. TXXX: function(e) {
  12118. var t;
  12119. if (3 === e.data[0]) {
  12120. for (t = 1; t < e.data.length; t++)
  12121. if (0 === e.data[t]) {
  12122. e.description = Te(e.data, 1, t), e.value = Te(e.data, t + 1, e.data.length).replace(/\0*$/,
  12123. "");
  12124. break
  12125. } e.data = e.value
  12126. }
  12127. },
  12128. WXXX: function(e) {
  12129. var t;
  12130. if (3 === e.data[0])
  12131. for (t = 1; t < e.data.length; t++)
  12132. if (0 === e.data[t]) {
  12133. e.description = Te(e.data, 1, t), e.url = Te(e.data, t + 1, e.data.length);
  12134. break
  12135. }
  12136. },
  12137. PRIV: function(e) {
  12138. var t, i;
  12139. for (t = 0; t < e.data.length; t++)
  12140. if (0 === e.data[t]) {
  12141. e.owner = (i = e.data, unescape(Ee(i, 0, t)));
  12142. break
  12143. } e.privateData = e.data.subarray(t + 1), e.data = e.privateData
  12144. }
  12145. };
  12146. (be = function(e) {
  12147. var t, i = {
  12148. debug: !(!e || !e.debug),
  12149. descriptor: e && e.descriptor
  12150. },
  12151. r = 0,
  12152. n = [],
  12153. a = 0;
  12154. if (be.prototype.init.call(this), this.dispatchType = ve.METADATA_STREAM_TYPE.toString(16), i
  12155. .descriptor)
  12156. for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString(16))
  12157. .slice(-2);
  12158. this.push = function(e) {
  12159. var t, s, o, u, l;
  12160. if ("timed-metadata" === e.type)
  12161. if (e.dataAlignmentIndicator && (a = 0, n.length = 0), 0 === n.length && (e.data.length < 10 || e
  12162. .data[0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !== "3"
  12163. .charCodeAt(0))) i.debug && console.log("Skipping unrecognized metadata packet");
  12164. else if (n.push(e), a += e.data.byteLength, 1 === n.length && (r = Se(e.data.subarray(6, 10)),
  12165. r += 10), !(a < r)) {
  12166. for (t = {
  12167. data: new Uint8Array(r),
  12168. frames: [],
  12169. pts: n[0].pts,
  12170. dts: n[0].dts
  12171. }, l = 0; l < r;) t.data.set(n[0].data.subarray(0, r - l), l), l += n[0].data.byteLength, a -=
  12172. n[0].data.byteLength, n.shift();
  12173. s = 10, 64 & t.data[5] && (s += 4, s += Se(t.data.subarray(10, 14)), r -= Se(t.data.subarray(16,
  12174. 20)));
  12175. do {
  12176. if ((o = Se(t.data.subarray(s + 4, s + 8))) < 1) return console.log(
  12177. "Malformed ID3 frame encountered. Skipping metadata parsing.");
  12178. if ((u = {
  12179. id: String.fromCharCode(t.data[s], t.data[s + 1], t.data[s + 2], t.data[s + 3]),
  12180. data: t.data.subarray(s + 10, s + o + 10)
  12181. }).key = u.id, Ae[u.id] && (Ae[u.id](u), "com.apple.streaming.transportStreamTimestamp" === u
  12182. .owner)) {
  12183. var d = u.data,
  12184. c = (1 & d[3]) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;
  12185. c *= 4, c += 3 & d[7], u.timeStamp = c, void 0 === t.pts && void 0 === t.dts && (t.pts = u
  12186. .timeStamp, t.dts = u.timeStamp), this.trigger("timestamp", u)
  12187. }
  12188. t.frames.push(u), s += 10, s += o
  12189. } while (s < r);
  12190. this.trigger("data", t)
  12191. }
  12192. }
  12193. }).prototype = new Y;
  12194. var ke, Re, Me, Oe = be,
  12195. Ce = we;
  12196. (ke = function() {
  12197. var e = new Uint8Array(188),
  12198. t = 0;
  12199. ke.prototype.init.call(this), this.push = function(i) {
  12200. var r, n = 0,
  12201. a = 188;
  12202. for (t ? ((r = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), r.set(i, t), t = 0) : r =
  12203. i; a < r.byteLength;) 71 !== r[n] || 71 !== r[a] ? (n++, a++) : (this.trigger("data", r.subarray(
  12204. n, a)), n += 188, a += 188);
  12205. n < r.byteLength && (e.set(r.subarray(n), 0), t = r.byteLength - n)
  12206. }, this.flush = function() {
  12207. 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done")
  12208. }
  12209. }).prototype = new Y, (Re = function() {
  12210. var e, t, i, r;
  12211. Re.prototype.init.call(this), r = this, this.packetsWaitingForPmt = [], this.programMapTable = void 0,
  12212. e = function(e, r) {
  12213. var n = 0;
  12214. r.payloadUnitStartIndicator && (n += e[n] + 1), "pat" === r.type ? t(e.subarray(n), r) : i(e
  12215. .subarray(n), r)
  12216. }, t = function(e, t) {
  12217. t.section_number = e[7], t.last_section_number = e[8], r.pmtPid = (31 & e[10]) << 8 | e[11], t
  12218. .pmtPid = r.pmtPid
  12219. }, i = function(e, t) {
  12220. var i, n;
  12221. if (1 & e[5]) {
  12222. for (r.programMapTable = {
  12223. video: null,
  12224. audio: null,
  12225. "timed-metadata": {}
  12226. }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, n = 12 + ((15 & e[10]) << 8 | e[11]); n < i;) {
  12227. var a = e[n],
  12228. s = (31 & e[n + 1]) << 8 | e[n + 2];
  12229. a === ve.H264_STREAM_TYPE && null === r.programMapTable.video ? r.programMapTable.video = s :
  12230. a === ve.ADTS_STREAM_TYPE && null === r.programMapTable.audio ? r.programMapTable.audio =
  12231. s : a === ve.METADATA_STREAM_TYPE && (r.programMapTable["timed-metadata"][s] = a), n += 5 +
  12232. ((15 & e[n + 3]) << 8 | e[n + 4])
  12233. }
  12234. t.programMapTable = r.programMapTable
  12235. }
  12236. }, this.push = function(t) {
  12237. var i = {},
  12238. r = 4;
  12239. if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[2], (
  12240. 48 & t[3]) >>> 4 > 1 && (r += t[r] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(r), i),
  12241. this.trigger("data", i);
  12242. else if (i.pid === this.pmtPid)
  12243. for (i.type = "pmt", e(t.subarray(r), i), this.trigger("data", i); this.packetsWaitingForPmt
  12244. .length;) this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  12245. else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, r, i]) : this
  12246. .processPes_(t, r, i)
  12247. }, this.processPes_ = function(e, t, i) {
  12248. i.pid === this.programMapTable.video ? i.streamType = ve.H264_STREAM_TYPE : i.pid === this
  12249. .programMapTable.audio ? i.streamType = ve.ADTS_STREAM_TYPE : i.streamType = this
  12250. .programMapTable["timed-metadata"][i.pid], i.type = "pes", i.data = e.subarray(t), this.trigger(
  12251. "data", i)
  12252. }
  12253. }).prototype = new Y, Re.STREAM_TYPES = {
  12254. h264: 27,
  12255. adts: 15
  12256. }, (Me = function() {
  12257. var e = this,
  12258. t = {
  12259. data: [],
  12260. size: 0
  12261. },
  12262. i = {
  12263. data: [],
  12264. size: 0
  12265. },
  12266. r = {
  12267. data: [],
  12268. size: 0
  12269. },
  12270. n = function(t, i, r) {
  12271. var n, a, s = new Uint8Array(t.size),
  12272. o = {
  12273. type: i
  12274. },
  12275. u = 0,
  12276. l = 0;
  12277. if (t.data.length && !(t.size < 9)) {
  12278. for (o.trackId = t.data[0].pid, u = 0; u < t.data.length; u++) a = t.data[u], s.set(a.data, l),
  12279. l += a.data.byteLength;
  12280. var d, c, h;
  12281. d = s, (c = o).packetLength = 6 + (d[4] << 8 | d[5]), c.dataAlignmentIndicator = 0 != (4 & d[
  12282. 6]), 192 & (h = d[7]) && (c.pts = (14 & d[9]) << 27 | (255 & d[10]) << 20 | (254 & d[11]) <<
  12283. 12 | (255 & d[12]) << 5 | (254 & d[13]) >>> 3, c.pts *= 4, c.pts += (6 & d[13]) >>> 1, c
  12284. .dts = c.pts, 64 & h && (c.dts = (14 & d[14]) << 27 | (255 & d[15]) << 20 | (254 & d[16]) <<
  12285. 12 | (255 & d[17]) << 5 | (254 & d[18]) >>> 3, c.dts *= 4, c.dts += (6 & d[18]) >>> 1)), c
  12286. .data = d.subarray(9 + d[8]), n = "video" === i || o.packetLength <= t.size, (r || n) && (t
  12287. .size = 0, t.data.length = 0), n && e.trigger("data", o)
  12288. }
  12289. };
  12290. Me.prototype.init.call(this), this.push = function(a) {
  12291. ({
  12292. pat: function() {},
  12293. pes: function() {
  12294. var e, s;
  12295. switch (a.streamType) {
  12296. case ve.H264_STREAM_TYPE:
  12297. case ve.H264_STREAM_TYPE:
  12298. e = t, s = "video";
  12299. break;
  12300. case ve.ADTS_STREAM_TYPE:
  12301. e = i, s = "audio";
  12302. break;
  12303. case ve.METADATA_STREAM_TYPE:
  12304. e = r, s = "timed-metadata";
  12305. break;
  12306. default:
  12307. return
  12308. }
  12309. a.payloadUnitStartIndicator && n(e, s, !0), e.data.push(a), e.size += a.data.byteLength
  12310. },
  12311. pmt: function() {
  12312. var t = {
  12313. type: "metadata",
  12314. tracks: []
  12315. },
  12316. i = a.programMapTable;
  12317. null !== i.video && t.tracks.push({
  12318. timelineStartInfo: {
  12319. baseMediaDecodeTime: 0
  12320. },
  12321. id: +i.video,
  12322. codec: "avc",
  12323. type: "video"
  12324. }), null !== i.audio && t.tracks.push({
  12325. timelineStartInfo: {
  12326. baseMediaDecodeTime: 0
  12327. },
  12328. id: +i.audio,
  12329. codec: "adts",
  12330. type: "audio"
  12331. }), e.trigger("data", t)
  12332. }
  12333. })[a.type]()
  12334. }, this.flush = function() {
  12335. n(t, "video"), n(i, "audio"), n(r, "timed-metadata"), this.trigger("done")
  12336. }
  12337. }).prototype = new Y;
  12338. var De = {
  12339. PAT_PID: 0,
  12340. MP2T_PACKET_LENGTH: 188,
  12341. TransportPacketStream: ke,
  12342. TransportParseStream: Re,
  12343. ElementaryStream: Me,
  12344. TimestampRolloverStream: Ce,
  12345. CaptionStream: ge.CaptionStream,
  12346. Cea608Stream: ge.Cea608Stream,
  12347. MetadataStream: Oe
  12348. };
  12349. for (var Ie in ve) ve.hasOwnProperty(Ie) && (De[Ie] = ve[Ie]);
  12350. var Le, xe = De,
  12351. Pe = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  12352. (Le = function() {
  12353. var e;
  12354. Le.prototype.init.call(this), this.push = function(t) {
  12355. var i, r, n, a, s, o, u = 0,
  12356. l = 0;
  12357. if ("audio" === t.type)
  12358. for (e ? (a = e, (e = new Uint8Array(a.byteLength + t.data.byteLength)).set(a), e.set(t.data, a
  12359. .byteLength)) : e = t.data; u + 5 < e.length;)
  12360. if (255 === e[u] && 240 == (246 & e[u + 1])) {
  12361. if (r = 2 * (1 & ~e[u + 1]), i = (3 & e[u + 3]) << 11 | e[u + 4] << 3 | (224 & e[u + 5]) >> 5,
  12362. o = 9e4 * (s = 1024 * (1 + (3 & e[u + 6]))) / Pe[(60 & e[u + 2]) >>> 2], n = u + i, e
  12363. .byteLength < n) return;
  12364. if (this.trigger("data", {
  12365. pts: t.pts + l * o,
  12366. dts: t.dts + l * o,
  12367. sampleCount: s,
  12368. audioobjecttype: 1 + (e[u + 2] >>> 6 & 3),
  12369. channelcount: (1 & e[u + 2]) << 2 | (192 & e[u + 3]) >>> 6,
  12370. samplerate: Pe[(60 & e[u + 2]) >>> 2],
  12371. samplingfrequencyindex: (60 & e[u + 2]) >>> 2,
  12372. samplesize: 16,
  12373. data: e.subarray(u + 7 + r, n)
  12374. }), e.byteLength === n) return void(e = void 0);
  12375. l++, e = e.subarray(n)
  12376. } else u++
  12377. }, this.flush = function() {
  12378. this.trigger("done")
  12379. }
  12380. }).prototype = new Y;
  12381. var Ue, Ne, Be, Fe = Le,
  12382. je = function(e) {
  12383. var t = e.byteLength,
  12384. i = 0,
  12385. r = 0;
  12386. this.length = function() {
  12387. return 8 * t
  12388. }, this.bitsAvailable = function() {
  12389. return 8 * t + r
  12390. }, this.loadWord = function() {
  12391. var n = e.byteLength - t,
  12392. a = new Uint8Array(4),
  12393. s = Math.min(4, t);
  12394. if (0 === s) throw new Error("no bytes available");
  12395. a.set(e.subarray(n, n + s)), i = new DataView(a.buffer).getUint32(0), r = 8 * s, t -= s
  12396. }, this.skipBits = function(e) {
  12397. var n;
  12398. r > e ? (i <<= e, r -= e) : (e -= r, e -= 8 * (n = Math.floor(e / 8)), t -= n, this.loadWord(),
  12399. i <<= e, r -= e)
  12400. }, this.readBits = function(e) {
  12401. var n = Math.min(r, e),
  12402. a = i >>> 32 - n;
  12403. return (r -= n) > 0 ? i <<= n : t > 0 && this.loadWord(), (n = e - n) > 0 ? a << n | this.readBits(
  12404. n) : a
  12405. }, this.skipLeadingZeros = function() {
  12406. var e;
  12407. for (e = 0; e < r; ++e)
  12408. if (0 != (i & 2147483648 >>> e)) return i <<= e, r -= e, e;
  12409. return this.loadWord(), e + this.skipLeadingZeros()
  12410. }, this.skipUnsignedExpGolomb = function() {
  12411. this.skipBits(1 + this.skipLeadingZeros())
  12412. }, this.skipExpGolomb = function() {
  12413. this.skipBits(1 + this.skipLeadingZeros())
  12414. }, this.readUnsignedExpGolomb = function() {
  12415. var e = this.skipLeadingZeros();
  12416. return this.readBits(e + 1) - 1
  12417. }, this.readExpGolomb = function() {
  12418. var e = this.readUnsignedExpGolomb();
  12419. return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
  12420. }, this.readBoolean = function() {
  12421. return 1 === this.readBits(1)
  12422. }, this.readUnsignedByte = function() {
  12423. return this.readBits(8)
  12424. }, this.loadWord()
  12425. };
  12426. (Ne = function() {
  12427. var e, t, i = 0;
  12428. Ne.prototype.init.call(this), this.push = function(r) {
  12429. var n;
  12430. for (t ? ((n = new Uint8Array(t.byteLength + r.data.byteLength)).set(t), n.set(r.data, t
  12431. .byteLength), t = n) : t = r.data; i < t.byteLength - 3; i++)
  12432. if (1 === t[i + 2]) {
  12433. e = i + 5;
  12434. break
  12435. } for (; e < t.byteLength;) switch (t[e]) {
  12436. case 0:
  12437. if (0 !== t[e - 1]) {
  12438. e += 2;
  12439. break
  12440. }
  12441. if (0 !== t[e - 2]) {
  12442. e++;
  12443. break
  12444. }
  12445. i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2));
  12446. do {
  12447. e++
  12448. } while (1 !== t[e] && e < t.length);
  12449. i = e - 2, e += 3;
  12450. break;
  12451. case 1:
  12452. if (0 !== t[e - 1] || 0 !== t[e - 2]) {
  12453. e += 3;
  12454. break
  12455. }
  12456. this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3;
  12457. break;
  12458. default:
  12459. e += 3
  12460. }
  12461. t = t.subarray(i), e -= i, i = 0
  12462. }, this.flush = function() {
  12463. t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger(
  12464. "done")
  12465. }
  12466. }).prototype = new Y, Be = {
  12467. 100: !0,
  12468. 110: !0,
  12469. 122: !0,
  12470. 244: !0,
  12471. 44: !0,
  12472. 83: !0,
  12473. 86: !0,
  12474. 118: !0,
  12475. 128: !0,
  12476. 138: !0,
  12477. 139: !0,
  12478. 134: !0
  12479. }, (Ue = function() {
  12480. var e, t, i, r, n, a, s, o = new Ne;
  12481. Ue.prototype.init.call(this), e = this, this.push = function(e) {
  12482. "video" === e.type && (t = e.trackId, i = e.pts, r = e.dts, o.push(e))
  12483. }, o.on("data", function(s) {
  12484. var o = {
  12485. trackId: t,
  12486. pts: i,
  12487. dts: r,
  12488. data: s
  12489. };
  12490. switch (31 & s[0]) {
  12491. case 5:
  12492. o.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  12493. break;
  12494. case 6:
  12495. o.nalUnitType = "sei_rbsp", o.escapedRBSP = n(s.subarray(1));
  12496. break;
  12497. case 7:
  12498. o.nalUnitType = "seq_parameter_set_rbsp", o.escapedRBSP = n(s.subarray(1)), o.config = a(o
  12499. .escapedRBSP);
  12500. break;
  12501. case 8:
  12502. o.nalUnitType = "pic_parameter_set_rbsp";
  12503. break;
  12504. case 9:
  12505. o.nalUnitType = "access_unit_delimiter_rbsp"
  12506. }
  12507. e.trigger("data", o)
  12508. }), o.on("done", function() {
  12509. e.trigger("done")
  12510. }), this.flush = function() {
  12511. o.flush()
  12512. }, s = function(e, t) {
  12513. var i, r = 8,
  12514. n = 8;
  12515. for (i = 0; i < e; i++) 0 !== n && (n = (r + t.readExpGolomb() + 256) % 256), r = 0 === n ? r : n
  12516. }, n = function(e) {
  12517. for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 ===
  12518. e[a + 2] ? (n.push(a + 2), a += 2) : a++;
  12519. if (0 === n.length) return e;
  12520. t = r - n.length, i = new Uint8Array(t);
  12521. var s = 0;
  12522. for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s];
  12523. return i
  12524. }, a = function(e) {
  12525. var t, i, r, n, a, o, u, l, d, c, h, f, p, m = 0,
  12526. g = 0,
  12527. v = 0,
  12528. y = 0,
  12529. _ = 1;
  12530. if (i = (t = new je(e)).readUnsignedByte(), n = t.readUnsignedByte(), r = t.readUnsignedByte(), t
  12531. .skipUnsignedExpGolomb(), Be[i] && (3 === (a = t.readUnsignedExpGolomb()) && t.skipBits(1), t
  12532. .skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean()))
  12533. for (h = 3 !== a ? 8 : 12, p = 0; p < h; p++) t.readBoolean() && s(p < 6 ? 16 : 64, t);
  12534. if (t.skipUnsignedExpGolomb(), 0 === (o = t.readUnsignedExpGolomb())) t.readUnsignedExpGolomb();
  12535. else if (1 === o)
  12536. for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), u = t.readUnsignedExpGolomb(), p =
  12537. 0; p < u; p++) t.skipExpGolomb();
  12538. if (t.skipUnsignedExpGolomb(), t.skipBits(1), l = t.readUnsignedExpGolomb(), d = t
  12539. .readUnsignedExpGolomb(), 0 === (c = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t
  12540. .readBoolean() && (m = t.readUnsignedExpGolomb(), g = t.readUnsignedExpGolomb(), v = t
  12541. .readUnsignedExpGolomb(), y = t.readUnsignedExpGolomb()), t.readBoolean() && t.readBoolean()
  12542. ) {
  12543. switch (t.readUnsignedByte()) {
  12544. case 1:
  12545. f = [1, 1];
  12546. break;
  12547. case 2:
  12548. f = [12, 11];
  12549. break;
  12550. case 3:
  12551. f = [10, 11];
  12552. break;
  12553. case 4:
  12554. f = [16, 11];
  12555. break;
  12556. case 5:
  12557. f = [40, 33];
  12558. break;
  12559. case 6:
  12560. f = [24, 11];
  12561. break;
  12562. case 7:
  12563. f = [20, 11];
  12564. break;
  12565. case 8:
  12566. f = [32, 11];
  12567. break;
  12568. case 9:
  12569. f = [80, 33];
  12570. break;
  12571. case 10:
  12572. f = [18, 11];
  12573. break;
  12574. case 11:
  12575. f = [15, 11];
  12576. break;
  12577. case 12:
  12578. f = [64, 33];
  12579. break;
  12580. case 13:
  12581. f = [160, 99];
  12582. break;
  12583. case 14:
  12584. f = [4, 3];
  12585. break;
  12586. case 15:
  12587. f = [3, 2];
  12588. break;
  12589. case 16:
  12590. f = [2, 1];
  12591. break;
  12592. case 255:
  12593. f = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t
  12594. .readUnsignedByte()
  12595. ]
  12596. }
  12597. f && (_ = f[0] / f[1])
  12598. }
  12599. return {
  12600. profileIdc: i,
  12601. levelIdc: r,
  12602. profileCompatibility: n,
  12603. width: Math.ceil((16 * (l + 1) - 2 * m - 2 * g) * _),
  12604. height: (2 - c) * (d + 1) * 16 - 2 * v - 2 * y
  12605. }
  12606. }
  12607. }).prototype = new Y;
  12608. var He, Ge = {
  12609. H264Stream: Ue,
  12610. NalByteStream: Ne
  12611. };
  12612. (He = function() {
  12613. var e = new Uint8Array,
  12614. t = 0;
  12615. He.prototype.init.call(this), this.setTimestamp = function(e) {
  12616. t = e
  12617. }, this.parseId3TagSize = function(e, t) {
  12618. var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
  12619. return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10
  12620. }, this.parseAdtsSize = function(e, t) {
  12621. var i = (224 & e[t + 5]) >> 5,
  12622. r = e[t + 4] << 3;
  12623. return 6144 & e[t + 3] | r | i
  12624. }, this.push = function(i) {
  12625. var r, n, a, s, o = 0,
  12626. u = 0;
  12627. for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e.set(
  12628. i, s)) : e = i; e.length - u >= 3;)
  12629. if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3".charCodeAt(
  12630. 0))
  12631. if (!0 & e[u] && 240 == (240 & e[u + 1])) {
  12632. if (e.length - u < 7) break;
  12633. if ((o = this.parseAdtsSize(e, u)) > e.length) break;
  12634. a = {
  12635. type: "audio",
  12636. data: e.subarray(u, u + o),
  12637. pts: t,
  12638. dts: t
  12639. }, this.trigger("data", a), u += o
  12640. } else u++;
  12641. else {
  12642. if (e.length - u < 10) break;
  12643. if ((o = this.parseId3TagSize(e, u)) > e.length) break;
  12644. n = {
  12645. type: "timed-metadata",
  12646. data: e.subarray(u, u + o)
  12647. }, this.trigger("data", n), u += o
  12648. }
  12649. r = e.length - u, e = r > 0 ? e.subarray(u) : new Uint8Array
  12650. }
  12651. }).prototype = new Y;
  12652. var Ve, We, qe, Xe, ze, Ke, Ye, Qe, Je, Ze, $e, et, tt = He,
  12653. it = [33, 16, 5, 32, 164, 27],
  12654. rt = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252],
  12655. nt = function(e) {
  12656. for (var t = []; e--;) t.push(0);
  12657. return t
  12658. },
  12659. at = {
  12660. 96000: [it, [227, 64], nt(154), [56]],
  12661. 88200: [it, [231], nt(170), [56]],
  12662. 64000: [it, [248, 192], nt(240), [56]],
  12663. 48000: [it, [255, 192], nt(268), [55, 148, 128], nt(54), [112]],
  12664. 44100: [it, [255, 192], nt(268), [55, 163, 128], nt(84), [112]],
  12665. 32000: [it, [255, 192], nt(268), [55, 234], nt(226), [112]],
  12666. 24000: [it, [255, 192], nt(268), [55, 255, 128], nt(268), [111, 112], nt(126), [224]],
  12667. 16000: [it, [255, 192], nt(268), [55, 255, 128], nt(268), [111, 255], nt(269), [223, 108], nt(195), [1,
  12668. 192
  12669. ]],
  12670. 12000: [rt, nt(268), [3, 127, 248], nt(268), [6, 255, 240], nt(268), [13, 255, 224], nt(268), [27, 253,
  12671. 128
  12672. ], nt(259), [56]],
  12673. 11025: [rt, nt(268), [3, 127, 248], nt(268), [6, 255, 240], nt(268), [13, 255, 224], nt(268), [27, 255,
  12674. 192
  12675. ], nt(268), [55, 175, 128], nt(108), [112]],
  12676. 8000: [rt, nt(268), [3, 121, 16], nt(47), [7]]
  12677. },
  12678. st = (Ve = at, Object.keys(Ve).reduce(function(e, t) {
  12679. return e[t] = new Uint8Array(Ve[t].reduce(function(e, t) {
  12680. return e.concat(t)
  12681. }, [])), e
  12682. }, {})),
  12683. ot = (We = function(e) {
  12684. return 9e4 * e
  12685. }, qe = function(e, t) {
  12686. return e * t
  12687. }, Xe = function(e) {
  12688. return e / 9e4
  12689. }, ze = function(e, t) {
  12690. return e / t
  12691. }, function(e, t) {
  12692. return We(ze(e, t))
  12693. }),
  12694. ut = function(e, t) {
  12695. return qe(Xe(e), t)
  12696. },
  12697. lt = Ge.H264Stream,
  12698. dt = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"],
  12699. ct = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility"];
  12700. Ze = function(e) {
  12701. return e[0] === "I".charCodeAt(0) && e[1] === "D".charCodeAt(0) && e[2] === "3".charCodeAt(0)
  12702. }, $e = function(e, t) {
  12703. var i;
  12704. if (e.length !== t.length) return !1;
  12705. for (i = 0; i < e.length; i++)
  12706. if (e[i] !== t[i]) return !1;
  12707. return !0
  12708. }, et = function(e) {
  12709. var t, i = 0;
  12710. for (t = 0; t < e.length; t++) i += e[t].data.byteLength;
  12711. return i
  12712. }, (Ye = function(e, t) {
  12713. var i = [],
  12714. r = 0,
  12715. n = 0,
  12716. a = 0,
  12717. s = 1 / 0;
  12718. t = t || {}, Ye.prototype.init.call(this), this.push = function(t) {
  12719. ne(e, t), e && dt.forEach(function(i) {
  12720. e[i] = t[i]
  12721. }), i.push(t)
  12722. }, this.setEarliestDts = function(t) {
  12723. n = t - e.timelineStartInfo.baseMediaDecodeTime
  12724. }, this.setVideoBaseMediaDecodeTime = function(e) {
  12725. s = e
  12726. }, this.setAudioAppendStart = function(e) {
  12727. a = e
  12728. }, this.flush = function() {
  12729. var n, a, s, o;
  12730. 0 !== i.length ? (n = this.trimAdtsFramesByEarliestDts_(i), e.baseMediaDecodeTime = re(e, t
  12731. .keepOriginalTimestamps), this.prefixWithSilence_(e, n), e.samples = this
  12732. .generateSampleTable_(n), s = q.mdat(this.concatenateFrameData_(n)), i = [], a = q.moof(r, [
  12733. e]), o = new Uint8Array(a.byteLength + s.byteLength), r++, o.set(a), o.set(s, a.byteLength),
  12734. ie(e), this.trigger("data", {
  12735. track: e,
  12736. boxes: o
  12737. }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done", "AudioSegmentStream")
  12738. }, this.prefixWithSilence_ = function(e, t) {
  12739. var i, r, n, o, u = 0,
  12740. l = 0,
  12741. d = 0;
  12742. if (t.length && (i = ot(e.baseMediaDecodeTime, e.samplerate), r = Math.ceil(9e4 / (e.samplerate /
  12743. 1024)), a && s && (u = i - Math.max(a, s), d = (l = Math.floor(u / r)) * r), !(l < 1 || d >
  12744. 45e3))) {
  12745. for ((n = st[e.samplerate]) || (n = t[0].data), o = 0; o < l; o++) t.splice(o, 0, {
  12746. data: n
  12747. });
  12748. e.baseMediaDecodeTime -= Math.floor(ut(d, e.samplerate))
  12749. }
  12750. }, this.trimAdtsFramesByEarliestDts_ = function(t) {
  12751. return e.minSegmentDts >= n ? t : (e.minSegmentDts = 1 / 0, t.filter(function(t) {
  12752. return t.dts >= n && (e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), e
  12753. .minSegmentPts = e.minSegmentDts, !0)
  12754. }))
  12755. }, this.generateSampleTable_ = function(e) {
  12756. var t, i, r = [];
  12757. for (t = 0; t < e.length; t++) i = e[t], r.push({
  12758. size: i.data.byteLength,
  12759. duration: 1024
  12760. });
  12761. return r
  12762. }, this.concatenateFrameData_ = function(e) {
  12763. var t, i, r = 0,
  12764. n = new Uint8Array(et(e));
  12765. for (t = 0; t < e.length; t++) i = e[t], n.set(i.data, r), r += i.data.byteLength;
  12766. return n
  12767. }
  12768. }).prototype = new Y, (Ke = function(e, t) {
  12769. var i, r, n = 0,
  12770. a = [],
  12771. s = [];
  12772. t = t || {}, Ke.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push = function(
  12773. t) {
  12774. ne(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config, e.sps = [t.data], ct
  12775. .forEach(function(t) {
  12776. e[t] = i[t]
  12777. }, this)), "pic_parameter_set_rbsp" !== t.nalUnitType || r || (r = t.data, e.pps = [t.data]),
  12778. a.push(t)
  12779. }, this.flush = function() {
  12780. for (var i, r, o, u, l, d; a.length && "access_unit_delimiter_rbsp" !== a[0].nalUnitType;) a
  12781. .shift();
  12782. if (0 === a.length) return this.resetStream_(), void this.trigger("done", "VideoSegmentStream");
  12783. if (i = J(a), (o = Z(i))[0][0].keyFrame || ((r = this.getGopForFusion_(a[0], e)) ? (o.unshift(r),
  12784. o.byteLength += r.byteLength, o.nalCount += r.nalCount, o.pts = r.pts, o.dts = r.dts, o
  12785. .duration += r.duration) : o = $(o)), s.length) {
  12786. var c;
  12787. if (!(c = t.alignGopsAtEnd ? this.alignGopsAtEnd_(o) : this.alignGopsAtStart_(o))) return this
  12788. .gopCache_.unshift({
  12789. gop: o.pop(),
  12790. pps: e.pps,
  12791. sps: e.sps
  12792. }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.resetStream_(),
  12793. void this.trigger("done", "VideoSegmentStream");
  12794. ie(e), o = c
  12795. }
  12796. ne(e, o), e.samples = ee(o), l = q.mdat(te(o)), e.baseMediaDecodeTime = re(e, t
  12797. .keepOriginalTimestamps), this.trigger("processedGopsInfo", o.map(function(e) {
  12798. return {
  12799. pts: e.pts,
  12800. dts: e.dts,
  12801. byteLength: e.byteLength
  12802. }
  12803. })), this.gopCache_.unshift({
  12804. gop: o.pop(),
  12805. pps: e.pps,
  12806. sps: e.sps
  12807. }), this.gopCache_.length = Math.min(6, this.gopCache_.length), a = [], this.trigger(
  12808. "baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e
  12809. .timelineStartInfo), u = q.moof(n, [e]), d = new Uint8Array(u.byteLength + l.byteLength), n++,
  12810. d.set(u), d.set(l, u.byteLength), this.trigger("data", {
  12811. track: e,
  12812. boxes: d
  12813. }), this.resetStream_(), this.trigger("done", "VideoSegmentStream")
  12814. }, this.resetStream_ = function() {
  12815. ie(e), i = void 0, r = void 0
  12816. }, this.getGopForFusion_ = function(t) {
  12817. var i, r, n, a, s, o = 1 / 0;
  12818. for (s = 0; s < this.gopCache_.length; s++) n = (a = this.gopCache_[s]).gop, e.pps && $e(e.pps[0],
  12819. a.pps[0]) && e.sps && $e(e.sps[0], a.sps[0]) && (n.dts < e.timelineStartInfo.dts || (i = t
  12820. .dts - n.dts - n.duration) >= -1e4 && i <= 45e3 && (!r || o > i) && (r = a, o = i));
  12821. return r ? r.gop : null
  12822. }, this.alignGopsAtStart_ = function(e) {
  12823. var t, i, r, n, a, o, u, l;
  12824. for (a = e.byteLength, o = e.nalCount, u = e.duration, t = i = 0; t < s.length && i < e.length &&
  12825. (r = s[t], n = e[i], r.pts !== n.pts);) n.pts > r.pts ? t++ : (i++, a -= n.byteLength, o -= n
  12826. .nalCount, u -= n.duration);
  12827. return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u, l
  12828. .nalCount = o, l.pts = l[0].pts, l.dts = l[0].dts, l)
  12829. }, this.alignGopsAtEnd_ = function(e) {
  12830. var t, i, r, n, a, o, u;
  12831. for (t = s.length - 1, i = e.length - 1, a = null, o = !1; t >= 0 && i >= 0;) {
  12832. if (r = s[t], n = e[i], r.pts === n.pts) {
  12833. o = !0;
  12834. break
  12835. }
  12836. r.pts > n.pts ? t-- : (t === s.length - 1 && (a = i), i--)
  12837. }
  12838. if (!o && null === a) return null;
  12839. if (0 === (u = o ? i : a)) return e;
  12840. var l = e.slice(u),
  12841. d = l.reduce(function(e, t) {
  12842. return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount, e
  12843. }, {
  12844. byteLength: 0,
  12845. duration: 0,
  12846. nalCount: 0
  12847. });
  12848. return l.byteLength = d.byteLength, l.duration = d.duration, l.nalCount = d.nalCount, l.pts = l[0]
  12849. .pts, l.dts = l[0].dts, l
  12850. }, this.alignGopsWith = function(e) {
  12851. s = e
  12852. }
  12853. }).prototype = new Y, (Je = function(e, t) {
  12854. this.numberOfTracks = 0, this.metadataStream = t, void 0 !== e.remux ? this.remuxTracks = !!e.remux :
  12855. this.remuxTracks = !0, this.pendingTracks = [], this.videoTrack = null, this.pendingBoxes = [], this
  12856. .pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0, this.emittedTracks = 0, Je
  12857. .prototype.init.call(this), this.push = function(e) {
  12858. return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this
  12859. .pendingTracks.push(e.track), this.pendingBoxes.push(e.boxes), this.pendingBytes += e.boxes
  12860. .byteLength, "video" === e.track.type && (this.videoTrack = e.track), void("audio" === e.track
  12861. .type && (this.audioTrack = e.track)))
  12862. }
  12863. }).prototype = new Y, Je.prototype.flush = function(e) {
  12864. var t, i, r, n, a = 0,
  12865. s = {
  12866. captions: [],
  12867. captionStreams: {},
  12868. metadata: [],
  12869. info: {}
  12870. },
  12871. o = 0;
  12872. if (this.pendingTracks.length < this.numberOfTracks) {
  12873. if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return;
  12874. if (this.remuxTracks) return;
  12875. if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this
  12876. .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0))
  12877. }
  12878. for (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, ct.forEach(function(e) {
  12879. s.info[e] = this.videoTrack[e]
  12880. }, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, dt.forEach(function(e) {
  12881. s.info[e] = this.audioTrack[e]
  12882. }, this)), 1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type =
  12883. "combined", this.emittedTracks += this.pendingTracks.length, r = q.initSegment(this.pendingTracks), s
  12884. .initSegment = new Uint8Array(r.byteLength), s.initSegment.set(r), s.data = new Uint8Array(this
  12885. .pendingBytes), n = 0; n < this.pendingBoxes.length; n++) s.data.set(this.pendingBoxes[n], a), a +=
  12886. this.pendingBoxes[n].byteLength;
  12887. for (n = 0; n < this.pendingCaptions.length; n++)(t = this.pendingCaptions[n]).startTime = t.startPts -
  12888. o, t.startTime /= 9e4, t.endTime = t.endPts - o, t.endTime /= 9e4, s.captionStreams[t.stream] = !0, s
  12889. .captions.push(t);
  12890. for (n = 0; n < this.pendingMetadata.length; n++)(i = this.pendingMetadata[n]).cueTime = i.pts - o, i
  12891. .cueTime /= 9e4, s.metadata.push(i);
  12892. s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this
  12893. .videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this.pendingBytes =
  12894. 0, this.pendingMetadata.length = 0, this.trigger("data", s), this.emittedTracks >= this
  12895. .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0)
  12896. }, (Qe = function(e) {
  12897. var t, i, r = this,
  12898. n = !0;
  12899. Qe.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0, this
  12900. .transmuxPipeline_ = {}, this.setupAacPipeline = function() {
  12901. var t = {};
  12902. this.transmuxPipeline_ = t, t.type = "aac", t.metadataStream = new xe.MetadataStream, t
  12903. .aacStream = new tt, t.audioTimestampRolloverStream = new xe.TimestampRolloverStream("audio"), t
  12904. .timedMetadataTimestampRolloverStream = new xe.TimestampRolloverStream("timed-metadata"), t
  12905. .adtsStream = new Fe, t.coalesceStream = new Je(e, t.metadataStream), t.headOfPipeline = t
  12906. .aacStream, t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream), t.aacStream
  12907. .pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream), t
  12908. .metadataStream.on("timestamp", function(e) {
  12909. t.aacStream.setTimestamp(e.timeStamp)
  12910. }), t.aacStream.on("data", function(n) {
  12911. "timed-metadata" !== n.type || t.audioSegmentStream || (i = i || {
  12912. timelineStartInfo: {
  12913. baseMediaDecodeTime: r.baseMediaDecodeTime
  12914. },
  12915. codec: "adts",
  12916. type: "audio"
  12917. }, t.coalesceStream.numberOfTracks++, t.audioSegmentStream = new Ye(i, e), t.adtsStream
  12918. .pipe(t.audioSegmentStream).pipe(t.coalesceStream))
  12919. }), t.coalesceStream.on("data", this.trigger.bind(this, "data")), t.coalesceStream.on("done",
  12920. this.trigger.bind(this, "done"))
  12921. }, this.setupTsPipeline = function() {
  12922. var n = {};
  12923. this.transmuxPipeline_ = n, n.type = "ts", n.metadataStream = new xe.MetadataStream, n
  12924. .packetStream = new xe.TransportPacketStream, n.parseStream = new xe.TransportParseStream, n
  12925. .elementaryStream = new xe.ElementaryStream, n.videoTimestampRolloverStream = new xe
  12926. .TimestampRolloverStream("video"), n.audioTimestampRolloverStream = new xe
  12927. .TimestampRolloverStream("audio"), n.timedMetadataTimestampRolloverStream = new xe
  12928. .TimestampRolloverStream("timed-metadata"), n.adtsStream = new Fe, n.h264Stream = new lt, n
  12929. .captionStream = new xe.CaptionStream, n.coalesceStream = new Je(e, n.metadataStream), n
  12930. .headOfPipeline = n.packetStream, n.packetStream.pipe(n.parseStream).pipe(n.elementaryStream), n
  12931. .elementaryStream.pipe(n.videoTimestampRolloverStream).pipe(n.h264Stream), n.elementaryStream
  12932. .pipe(n.audioTimestampRolloverStream).pipe(n.adtsStream), n.elementaryStream.pipe(n
  12933. .timedMetadataTimestampRolloverStream).pipe(n.metadataStream).pipe(n.coalesceStream), n
  12934. .h264Stream.pipe(n.captionStream).pipe(n.coalesceStream), n.elementaryStream.on("data",
  12935. function(a) {
  12936. var s;
  12937. if ("metadata" === a.type) {
  12938. for (s = a.tracks.length; s--;) t || "video" !== a.tracks[s].type ? i || "audio" !== a
  12939. .tracks[s].type || ((i = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r
  12940. .baseMediaDecodeTime) : (t = a.tracks[s]).timelineStartInfo.baseMediaDecodeTime = r
  12941. .baseMediaDecodeTime;
  12942. t && !n.videoSegmentStream && (n.coalesceStream.numberOfTracks++, n.videoSegmentStream =
  12943. new Ke(t, e), n.videoSegmentStream.on("timelineStartInfo", function(e) {
  12944. i && (i.timelineStartInfo = e, n.audioSegmentStream.setEarliestDts(e.dts))
  12945. }), n.videoSegmentStream.on("processedGopsInfo", r.trigger.bind(r, "gopInfo")), n
  12946. .videoSegmentStream.on("baseMediaDecodeTime", function(e) {
  12947. i && n.audioSegmentStream.setVideoBaseMediaDecodeTime(e)
  12948. }), n.h264Stream.pipe(n.videoSegmentStream).pipe(n.coalesceStream)), i && !n
  12949. .audioSegmentStream && (n.coalesceStream.numberOfTracks++, n.audioSegmentStream =
  12950. new Ye(i, e), n.adtsStream.pipe(n.audioSegmentStream).pipe(n.coalesceStream))
  12951. }
  12952. }), n.coalesceStream.on("data", this.trigger.bind(this, "data")), n.coalesceStream.on("done",
  12953. this.trigger.bind(this, "done"))
  12954. }, this.setBaseMediaDecodeTime = function(e) {
  12955. var r = this.transmuxPipeline_;
  12956. this.baseMediaDecodeTime = e, i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo.pts =
  12957. void 0, ie(i), i.timelineStartInfo.baseMediaDecodeTime = e, r.audioTimestampRolloverStream &&
  12958. r.audioTimestampRolloverStream.discontinuity()), t && (r.videoSegmentStream && (r
  12959. .videoSegmentStream.gopCache_ = [], r.videoTimestampRolloverStream.discontinuity()), t
  12960. .timelineStartInfo.dts = void 0, t.timelineStartInfo.pts = void 0, ie(t), r.captionStream
  12961. .reset(), t.timelineStartInfo.baseMediaDecodeTime = e), r
  12962. .timedMetadataTimestampRolloverStream && r.timedMetadataTimestampRolloverStream.discontinuity()
  12963. }, this.setAudioAppendStart = function(e) {
  12964. i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)
  12965. }, this.alignGopsWith = function(e) {
  12966. t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream
  12967. .alignGopsWith(e)
  12968. }, this.push = function(e) {
  12969. if (n) {
  12970. var t = Ze(e);
  12971. t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this
  12972. .transmuxPipeline_.type || this.setupTsPipeline(), n = !1
  12973. }
  12974. this.transmuxPipeline_.headOfPipeline.push(e)
  12975. }, this.flush = function() {
  12976. n = !0, this.transmuxPipeline_.headOfPipeline.flush()
  12977. }, this.resetCaptions = function() {
  12978. this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset()
  12979. }
  12980. }).prototype = new Y;
  12981. var ht, ft, pt = {
  12982. Transmuxer: Qe,
  12983. VideoSegmentStream: Ke,
  12984. AudioSegmentStream: Ye,
  12985. AUDIO_PROPERTIES: dt,
  12986. VIDEO_PROPERTIES: ct
  12987. },
  12988. mt = z.parseType,
  12989. gt = function(e) {
  12990. return new Date(1e3 * e - 20828448e5)
  12991. },
  12992. vt = function(e) {
  12993. return {
  12994. isLeading: (12 & e[0]) >>> 2,
  12995. dependsOn: 3 & e[0],
  12996. isDependedOn: (192 & e[1]) >>> 6,
  12997. hasRedundancy: (48 & e[1]) >>> 4,
  12998. paddingValue: (14 & e[1]) >>> 1,
  12999. isNonSyncSample: 1 & e[1],
  13000. degradationPriority: e[2] << 8 | e[3]
  13001. }
  13002. },
  13003. yt = {
  13004. avc1: function(e) {
  13005. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  13006. return {
  13007. dataReferenceIndex: t.getUint16(6),
  13008. width: t.getUint16(24),
  13009. height: t.getUint16(26),
  13010. horizresolution: t.getUint16(28) + t.getUint16(30) / 16,
  13011. vertresolution: t.getUint16(32) + t.getUint16(34) / 16,
  13012. frameCount: t.getUint16(40),
  13013. depth: t.getUint16(74),
  13014. config: ht(e.subarray(78, e.byteLength))
  13015. }
  13016. },
  13017. avcC: function(e) {
  13018. var t, i, r, n, a = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13019. s = {
  13020. configurationVersion: e[0],
  13021. avcProfileIndication: e[1],
  13022. profileCompatibility: e[2],
  13023. avcLevelIndication: e[3],
  13024. lengthSizeMinusOne: 3 & e[4],
  13025. sps: [],
  13026. pps: []
  13027. },
  13028. o = 31 & e[5];
  13029. for (r = 6, n = 0; n < o; n++) i = a.getUint16(r), r += 2, s.sps.push(new Uint8Array(e.subarray(r,
  13030. r + i))), r += i;
  13031. for (t = e[r], r++, n = 0; n < t; n++) i = a.getUint16(r), r += 2, s.pps.push(new Uint8Array(e
  13032. .subarray(r, r + i))), r += i;
  13033. return s
  13034. },
  13035. btrt: function(e) {
  13036. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  13037. return {
  13038. bufferSizeDB: t.getUint32(0),
  13039. maxBitrate: t.getUint32(4),
  13040. avgBitrate: t.getUint32(8)
  13041. }
  13042. },
  13043. esds: function(e) {
  13044. return {
  13045. version: e[0],
  13046. flags: new Uint8Array(e.subarray(1, 4)),
  13047. esId: e[6] << 8 | e[7],
  13048. streamPriority: 31 & e[8],
  13049. decoderConfig: {
  13050. objectProfileIndication: e[11],
  13051. streamType: e[12] >>> 2 & 63,
  13052. bufferSize: e[13] << 16 | e[14] << 8 | e[15],
  13053. maxBitrate: e[16] << 24 | e[17] << 16 | e[18] << 8 | e[19],
  13054. avgBitrate: e[20] << 24 | e[21] << 16 | e[22] << 8 | e[23],
  13055. decoderConfigDescriptor: {
  13056. tag: e[24],
  13057. length: e[25],
  13058. audioObjectType: e[26] >>> 3 & 31,
  13059. samplingFrequencyIndex: (7 & e[26]) << 1 | e[27] >>> 7 & 1,
  13060. channelConfiguration: e[27] >>> 3 & 15
  13061. }
  13062. }
  13063. }
  13064. },
  13065. ftyp: function(e) {
  13066. for (var t = new DataView(e.buffer, e.byteOffset, e.byteLength), i = {
  13067. majorBrand: mt(e.subarray(0, 4)),
  13068. minorVersion: t.getUint32(4),
  13069. compatibleBrands: []
  13070. }, r = 8; r < e.byteLength;) i.compatibleBrands.push(mt(e.subarray(r, r + 4))), r += 4;
  13071. return i
  13072. },
  13073. dinf: function(e) {
  13074. return {
  13075. boxes: ht(e)
  13076. }
  13077. },
  13078. dref: function(e) {
  13079. return {
  13080. version: e[0],
  13081. flags: new Uint8Array(e.subarray(1, 4)),
  13082. dataReferences: ht(e.subarray(8))
  13083. }
  13084. },
  13085. hdlr: function(e) {
  13086. var t = {
  13087. version: new DataView(e.buffer, e.byteOffset, e.byteLength).getUint8(0),
  13088. flags: new Uint8Array(e.subarray(1, 4)),
  13089. handlerType: mt(e.subarray(8, 12)),
  13090. name: ""
  13091. },
  13092. i = 8;
  13093. for (i = 24; i < e.byteLength; i++) {
  13094. if (0 === e[i]) {
  13095. i++;
  13096. break
  13097. }
  13098. t.name += String.fromCharCode(e[i])
  13099. }
  13100. return t.name = decodeURIComponent(escape(t.name)), t
  13101. },
  13102. mdat: function(e) {
  13103. return {
  13104. byteLength: e.byteLength,
  13105. nals: function(e) {
  13106. var t, i, r = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13107. n = [];
  13108. for (t = 0; t + 4 < e.length; t += i)
  13109. if (i = r.getUint32(t), t += 4, i <= 0) n.push(
  13110. "<span style='color:red;'>MALFORMED DATA</span>");
  13111. else switch (31 & e[t]) {
  13112. case 1:
  13113. n.push("slice_layer_without_partitioning_rbsp");
  13114. break;
  13115. case 5:
  13116. n.push("slice_layer_without_partitioning_rbsp_idr");
  13117. break;
  13118. case 6:
  13119. n.push("sei_rbsp");
  13120. break;
  13121. case 7:
  13122. n.push("seq_parameter_set_rbsp");
  13123. break;
  13124. case 8:
  13125. n.push("pic_parameter_set_rbsp");
  13126. break;
  13127. case 9:
  13128. n.push("access_unit_delimiter_rbsp");
  13129. break;
  13130. default:
  13131. n.push("UNKNOWN NAL - " + e[t] & 31)
  13132. }
  13133. return n
  13134. }(e)
  13135. }
  13136. },
  13137. mdhd: function(e) {
  13138. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13139. r = 4,
  13140. n = {
  13141. version: i.getUint8(0),
  13142. flags: new Uint8Array(e.subarray(1, 4)),
  13143. language: ""
  13144. };
  13145. return 1 === n.version ? (r += 4, n.creationTime = gt(i.getUint32(r)), r += 8, n.modificationTime =
  13146. gt(i.getUint32(r)), r += 4, n.timescale = i.getUint32(r), r += 8, n.duration = i.getUint32(r)) :
  13147. (n.creationTime = gt(i.getUint32(r)), r += 4, n.modificationTime = gt(i.getUint32(r)), r += 4, n
  13148. .timescale = i.getUint32(r), r += 4, n.duration = i.getUint32(r)), r += 4, t = i.getUint16(r), n
  13149. .language += String.fromCharCode(96 + (t >> 10)), n.language += String.fromCharCode(96 + ((992 &
  13150. t) >> 5)), n.language += String.fromCharCode(96 + (31 & t)), n
  13151. },
  13152. mdia: function(e) {
  13153. return {
  13154. boxes: ht(e)
  13155. }
  13156. },
  13157. mfhd: function(e) {
  13158. return {
  13159. version: e[0],
  13160. flags: new Uint8Array(e.subarray(1, 4)),
  13161. sequenceNumber: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]
  13162. }
  13163. },
  13164. minf: function(e) {
  13165. return {
  13166. boxes: ht(e)
  13167. }
  13168. },
  13169. mp4a: function(e) {
  13170. var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13171. i = {
  13172. dataReferenceIndex: t.getUint16(6),
  13173. channelcount: t.getUint16(16),
  13174. samplesize: t.getUint16(18),
  13175. samplerate: t.getUint16(24) + t.getUint16(26) / 65536
  13176. };
  13177. return e.byteLength > 28 && (i.streamDescriptor = ht(e.subarray(28))[0]), i
  13178. },
  13179. moof: function(e) {
  13180. return {
  13181. boxes: ht(e)
  13182. }
  13183. },
  13184. moov: function(e) {
  13185. return {
  13186. boxes: ht(e)
  13187. }
  13188. },
  13189. mvex: function(e) {
  13190. return {
  13191. boxes: ht(e)
  13192. }
  13193. },
  13194. mvhd: function(e) {
  13195. var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13196. i = 4,
  13197. r = {
  13198. version: t.getUint8(0),
  13199. flags: new Uint8Array(e.subarray(1, 4))
  13200. };
  13201. return 1 === r.version ? (i += 4, r.creationTime = gt(t.getUint32(i)), i += 8, r.modificationTime =
  13202. gt(t.getUint32(i)), i += 4, r.timescale = t.getUint32(i), i += 8, r.duration = t.getUint32(i)) :
  13203. (r.creationTime = gt(t.getUint32(i)), i += 4, r.modificationTime = gt(t.getUint32(i)), i += 4, r
  13204. .timescale = t.getUint32(i), i += 4, r.duration = t.getUint32(i)), i += 4, r.rate = t.getUint16(
  13205. i) + t.getUint16(i + 2) / 16, i += 4, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2,
  13206. i += 2, i += 8, r.matrix = new Uint32Array(e.subarray(i, i + 36)), i += 36, i += 24, r
  13207. .nextTrackId = t.getUint32(i), r
  13208. },
  13209. pdin: function(e) {
  13210. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  13211. return {
  13212. version: t.getUint8(0),
  13213. flags: new Uint8Array(e.subarray(1, 4)),
  13214. rate: t.getUint32(4),
  13215. initialDelay: t.getUint32(8)
  13216. }
  13217. },
  13218. sdtp: function(e) {
  13219. var t, i = {
  13220. version: e[0],
  13221. flags: new Uint8Array(e.subarray(1, 4)),
  13222. samples: []
  13223. };
  13224. for (t = 4; t < e.byteLength; t++) i.samples.push({
  13225. dependsOn: (48 & e[t]) >> 4,
  13226. isDependedOn: (12 & e[t]) >> 2,
  13227. hasRedundancy: 3 & e[t]
  13228. });
  13229. return i
  13230. },
  13231. sidx: function(e) {
  13232. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13233. r = {
  13234. version: e[0],
  13235. flags: new Uint8Array(e.subarray(1, 4)),
  13236. references: [],
  13237. referenceId: i.getUint32(4),
  13238. timescale: i.getUint32(8),
  13239. earliestPresentationTime: i.getUint32(12),
  13240. firstOffset: i.getUint32(16)
  13241. },
  13242. n = i.getUint16(22);
  13243. for (t = 24; n; t += 12, n--) r.references.push({
  13244. referenceType: (128 & e[t]) >>> 7,
  13245. referencedSize: 2147483647 & i.getUint32(t),
  13246. subsegmentDuration: i.getUint32(t + 4),
  13247. startsWithSap: !!(128 & e[t + 8]),
  13248. sapType: (112 & e[t + 8]) >>> 4,
  13249. sapDeltaTime: 268435455 & i.getUint32(t + 8)
  13250. });
  13251. return r
  13252. },
  13253. smhd: function(e) {
  13254. return {
  13255. version: e[0],
  13256. flags: new Uint8Array(e.subarray(1, 4)),
  13257. balance: e[4] + e[5] / 256
  13258. }
  13259. },
  13260. stbl: function(e) {
  13261. return {
  13262. boxes: ht(e)
  13263. }
  13264. },
  13265. stco: function(e) {
  13266. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13267. r = {
  13268. version: e[0],
  13269. flags: new Uint8Array(e.subarray(1, 4)),
  13270. chunkOffsets: []
  13271. },
  13272. n = i.getUint32(4);
  13273. for (t = 8; n; t += 4, n--) r.chunkOffsets.push(i.getUint32(t));
  13274. return r
  13275. },
  13276. stsc: function(e) {
  13277. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13278. r = i.getUint32(4),
  13279. n = {
  13280. version: e[0],
  13281. flags: new Uint8Array(e.subarray(1, 4)),
  13282. sampleToChunks: []
  13283. };
  13284. for (t = 8; r; t += 12, r--) n.sampleToChunks.push({
  13285. firstChunk: i.getUint32(t),
  13286. samplesPerChunk: i.getUint32(t + 4),
  13287. sampleDescriptionIndex: i.getUint32(t + 8)
  13288. });
  13289. return n
  13290. },
  13291. stsd: function(e) {
  13292. return {
  13293. version: e[0],
  13294. flags: new Uint8Array(e.subarray(1, 4)),
  13295. sampleDescriptions: ht(e.subarray(8))
  13296. }
  13297. },
  13298. stsz: function(e) {
  13299. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13300. r = {
  13301. version: e[0],
  13302. flags: new Uint8Array(e.subarray(1, 4)),
  13303. sampleSize: i.getUint32(4),
  13304. entries: []
  13305. };
  13306. for (t = 12; t < e.byteLength; t += 4) r.entries.push(i.getUint32(t));
  13307. return r
  13308. },
  13309. stts: function(e) {
  13310. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13311. r = {
  13312. version: e[0],
  13313. flags: new Uint8Array(e.subarray(1, 4)),
  13314. timeToSamples: []
  13315. },
  13316. n = i.getUint32(4);
  13317. for (t = 8; n; t += 8, n--) r.timeToSamples.push({
  13318. sampleCount: i.getUint32(t),
  13319. sampleDelta: i.getUint32(t + 4)
  13320. });
  13321. return r
  13322. },
  13323. styp: function(e) {
  13324. return yt.ftyp(e)
  13325. },
  13326. tfdt: function(e) {
  13327. var t = {
  13328. version: e[0],
  13329. flags: new Uint8Array(e.subarray(1, 4)),
  13330. baseMediaDecodeTime: e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7]
  13331. };
  13332. return 1 === t.version && (t.baseMediaDecodeTime *= Math.pow(2, 32), t.baseMediaDecodeTime += e[
  13333. 8] << 24 | e[9] << 16 | e[10] << 8 | e[11]), t
  13334. },
  13335. tfhd: function(e) {
  13336. var t, i = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13337. r = {
  13338. version: e[0],
  13339. flags: new Uint8Array(e.subarray(1, 4)),
  13340. trackId: i.getUint32(4)
  13341. },
  13342. n = 1 & r.flags[2],
  13343. a = 2 & r.flags[2],
  13344. s = 8 & r.flags[2],
  13345. o = 16 & r.flags[2],
  13346. u = 32 & r.flags[2],
  13347. l = 65536 & r.flags[0],
  13348. d = 131072 & r.flags[0];
  13349. return t = 8, n && (t += 4, r.baseDataOffset = i.getUint32(12), t += 4), a && (r
  13350. .sampleDescriptionIndex = i.getUint32(t), t += 4), s && (r.defaultSampleDuration = i.getUint32(
  13351. t), t += 4), o && (r.defaultSampleSize = i.getUint32(t), t += 4), u && (r.defaultSampleFlags = i
  13352. .getUint32(t)), l && (r.durationIsEmpty = !0), !n && d && (r.baseDataOffsetIsMoof = !0), r
  13353. },
  13354. tkhd: function(e) {
  13355. var t = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13356. i = 4,
  13357. r = {
  13358. version: t.getUint8(0),
  13359. flags: new Uint8Array(e.subarray(1, 4))
  13360. };
  13361. return 1 === r.version ? (i += 4, r.creationTime = gt(t.getUint32(i)), i += 8, r.modificationTime =
  13362. gt(t.getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 8, r.duration = t
  13363. .getUint32(i)) : (r.creationTime = gt(t.getUint32(i)), i += 4, r.modificationTime = gt(t
  13364. .getUint32(i)), i += 4, r.trackId = t.getUint32(i), i += 4, i += 4, r.duration = t.getUint32(
  13365. i)), i += 4, i += 8, r.layer = t.getUint16(i), i += 2, r.alternateGroup = t.getUint16(i), i +=
  13366. 2, r.volume = t.getUint8(i) + t.getUint8(i + 1) / 8, i += 2, i += 2, r.matrix = new Uint32Array(e
  13367. .subarray(i, i + 36)), i += 36, r.width = t.getUint16(i) + t.getUint16(i + 2) / 16, i += 4, r
  13368. .height = t.getUint16(i) + t.getUint16(i + 2) / 16, r
  13369. },
  13370. traf: function(e) {
  13371. return {
  13372. boxes: ht(e)
  13373. }
  13374. },
  13375. trak: function(e) {
  13376. return {
  13377. boxes: ht(e)
  13378. }
  13379. },
  13380. trex: function(e) {
  13381. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  13382. return {
  13383. version: e[0],
  13384. flags: new Uint8Array(e.subarray(1, 4)),
  13385. trackId: t.getUint32(4),
  13386. defaultSampleDescriptionIndex: t.getUint32(8),
  13387. defaultSampleDuration: t.getUint32(12),
  13388. defaultSampleSize: t.getUint32(16),
  13389. sampleDependsOn: 3 & e[20],
  13390. sampleIsDependedOn: (192 & e[21]) >> 6,
  13391. sampleHasRedundancy: (48 & e[21]) >> 4,
  13392. samplePaddingValue: (14 & e[21]) >> 1,
  13393. sampleIsDifferenceSample: !!(1 & e[21]),
  13394. sampleDegradationPriority: t.getUint16(22)
  13395. }
  13396. },
  13397. trun: function(e) {
  13398. var t, i = {
  13399. version: e[0],
  13400. flags: new Uint8Array(e.subarray(1, 4)),
  13401. samples: []
  13402. },
  13403. r = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13404. n = 1 & i.flags[2],
  13405. a = 4 & i.flags[2],
  13406. s = 1 & i.flags[1],
  13407. o = 2 & i.flags[1],
  13408. u = 4 & i.flags[1],
  13409. l = 8 & i.flags[1],
  13410. d = r.getUint32(4),
  13411. c = 8;
  13412. for (n && (i.dataOffset = r.getInt32(c), c += 4), a && d && (t = {
  13413. flags: vt(e.subarray(c, c + 4))
  13414. }, c += 4, s && (t.duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4),
  13415. l && (t.compositionTimeOffset = r.getUint32(c), c += 4), i.samples.push(t), d--); d--;) t = {},
  13416. s && (t.duration = r.getUint32(c), c += 4), o && (t.size = r.getUint32(c), c += 4), u && (t
  13417. .flags = vt(e.subarray(c, c + 4)), c += 4), l && (t.compositionTimeOffset = r.getUint32(c), c +=
  13418. 4), i.samples.push(t);
  13419. return i
  13420. },
  13421. "url ": function(e) {
  13422. return {
  13423. version: e[0],
  13424. flags: new Uint8Array(e.subarray(1, 4))
  13425. }
  13426. },
  13427. vmhd: function(e) {
  13428. var t = new DataView(e.buffer, e.byteOffset, e.byteLength);
  13429. return {
  13430. version: e[0],
  13431. flags: new Uint8Array(e.subarray(1, 4)),
  13432. graphicsmode: t.getUint16(4),
  13433. opcolor: new Uint16Array([t.getUint16(6), t.getUint16(8), t.getUint16(10)])
  13434. }
  13435. }
  13436. },
  13437. _t = {
  13438. inspect: ht = function(e) {
  13439. for (var t, i, r, n, a, s = 0, o = [], u = new ArrayBuffer(e.length), l = new Uint8Array(u), d =
  13440. 0; d < e.length; ++d) l[d] = e[d];
  13441. for (t = new DataView(u); s < e.byteLength;) i = t.getUint32(s), r = mt(e.subarray(s + 4, s + 8)),
  13442. n = i > 1 ? s + i : e.byteLength, (a = (yt[r] || function(e) {
  13443. return {
  13444. data: e
  13445. }
  13446. })(e.subarray(s + 8, n))).size = i, a.type = r, o.push(a), s = n;
  13447. return o
  13448. },
  13449. textify: ft = function(e, t) {
  13450. var i;
  13451. return t = t || 0, i = new Array(2 * t + 1).join(" "), e.map(function(e, r) {
  13452. return i + e.type + "\n" + Object.keys(e).filter(function(e) {
  13453. return "type" !== e && "boxes" !== e
  13454. }).map(function(t) {
  13455. var r = i + " " + t + ": ",
  13456. n = e[t];
  13457. if (n instanceof Uint8Array || n instanceof Uint32Array) {
  13458. var a = Array.prototype.slice.call(new Uint8Array(n.buffer, n.byteOffset, n
  13459. .byteLength)).map(function(e) {
  13460. return " " + ("00" + e.toString(16)).slice(-2)
  13461. }).join("").match(/.{1,24}/g);
  13462. return a ? 1 === a.length ? r + "<" + a.join("").slice(1) + ">" : r + "<\n" + a.map(
  13463. function(e) {
  13464. return i + " " + e
  13465. }).join("\n") + "\n" + i + " >" : r + "<>"
  13466. }
  13467. return r + JSON.stringify(n, null, 2).split("\n").map(function(e, t) {
  13468. return 0 === t ? e : i + " " + e
  13469. }).join("\n")
  13470. }).join("\n") + (e.boxes ? "\n" + ft(e.boxes, t + 1) : "")
  13471. }).join("\n")
  13472. },
  13473. parseTfdt: yt.tfdt,
  13474. parseHdlr: yt.hdlr,
  13475. parseTfhd: yt.tfhd,
  13476. parseTrun: yt.trun
  13477. },
  13478. bt = ue,
  13479. wt = ge.CaptionStream,
  13480. Et = function(e, t) {
  13481. for (var i = e, r = 0; r < t.length; r++) {
  13482. var n = t[r];
  13483. if (i < n.size) return n;
  13484. i -= n.size
  13485. }
  13486. return null
  13487. },
  13488. Tt = function(e, t) {
  13489. var i = z.findBox(e, ["moof", "traf"]),
  13490. r = {},
  13491. n = [];
  13492. return z.findBox(e, ["mdat"]).forEach(function(e, t) {
  13493. var r = i[t];
  13494. n.push({
  13495. mdat: e,
  13496. traf: r
  13497. })
  13498. }), n.forEach(function(e) {
  13499. var i, n = e.mdat,
  13500. a = e.traf,
  13501. s = z.findBox(a, ["tfhd"]),
  13502. o = _t.parseTfhd(s[0]),
  13503. u = o.trackId,
  13504. l = z.findBox(a, ["tfdt"]),
  13505. d = l.length > 0 ? _t.parseTfdt(l[0]).baseMediaDecodeTime : 0,
  13506. c = z.findBox(a, ["trun"]);
  13507. t === u && c.length > 0 && (i = function(e, t, i) {
  13508. var r, n, a, s, o = new DataView(e.buffer, e.byteOffset, e.byteLength),
  13509. u = [];
  13510. for (n = 0; n + 4 < e.length; n += a)
  13511. if (a = o.getUint32(n), n += 4, !(a <= 0)) switch (31 & e[n]) {
  13512. case 6:
  13513. var l = e.subarray(n + 1, n + 1 + a),
  13514. d = Et(n, t);
  13515. r = {
  13516. nalUnitType: "sei_rbsp",
  13517. size: a,
  13518. data: l,
  13519. escapedRBSP: bt(l),
  13520. trackId: i
  13521. }, d ? (r.pts = d.pts, r.dts = d.dts, s = d) : (r.pts = s.pts, r.dts = s.dts), u
  13522. .push(r)
  13523. }
  13524. return u
  13525. }(n, function(e, t, i) {
  13526. var r = t,
  13527. n = i.defaultSampleDuration || 0,
  13528. a = i.defaultSampleSize || 0,
  13529. s = i.trackId,
  13530. o = [];
  13531. return e.forEach(function(e) {
  13532. var t = _t.parseTrun(e).samples;
  13533. t.forEach(function(e) {
  13534. void 0 === e.duration && (e.duration = n), void 0 === e.size && (e.size = a),
  13535. e.trackId = s, e.dts = r, void 0 === e.compositionTimeOffset && (e
  13536. .compositionTimeOffset = 0), e.pts = r + e.compositionTimeOffset, r += e
  13537. .duration
  13538. }), o = o.concat(t)
  13539. }), o
  13540. }(c, d, o), u), r[u] || (r[u] = []), r[u] = r[u].concat(i))
  13541. }), r
  13542. },
  13543. St = {
  13544. generator: q,
  13545. probe: z,
  13546. Transmuxer: pt.Transmuxer,
  13547. AudioSegmentStream: pt.AudioSegmentStream,
  13548. VideoSegmentStream: pt.VideoSegmentStream,
  13549. CaptionParser: function() {
  13550. var e, t, i, r, n, a = !1;
  13551. this.isInitialized = function() {
  13552. return a
  13553. }, this.init = function() {
  13554. e = new wt, a = !0, e.on("data", function(e) {
  13555. e.startTime = e.startPts / r, e.endTime = e.endPts / r, n.captions.push(e), n
  13556. .captionStreams[e.stream] = !0
  13557. })
  13558. }, this.isNewInit = function(e, t) {
  13559. return !(e && 0 === e.length || t && "object" === (void 0 === t ? "undefined" : v(t)) && 0 ===
  13560. Object.keys(t).length || i === e[0] && r === t[i])
  13561. }, this.parse = function(e, a, s) {
  13562. var o;
  13563. if (!this.isInitialized()) return null;
  13564. if (!a || !s) return null;
  13565. if (this.isNewInit(a, s)) i = a[0], r = s[i];
  13566. else if (!i || !r) return t.push(e), null;
  13567. for (; t.length > 0;) {
  13568. var u = t.shift();
  13569. this.parse(u, a, s)
  13570. }
  13571. return null !== (o = function(e, t, i) {
  13572. return t ? {
  13573. seiNals: Tt(e, t)[t],
  13574. timescale: i
  13575. } : null
  13576. }(e, i, r)) && o.seiNals ? (this.pushNals(o.seiNals), this.flushStream(), n) : null
  13577. }, this.pushNals = function(t) {
  13578. if (!this.isInitialized() || !t || 0 === t.length) return null;
  13579. t.forEach(function(t) {
  13580. e.push(t)
  13581. })
  13582. }, this.flushStream = function() {
  13583. if (!this.isInitialized()) return null;
  13584. e.flush()
  13585. }, this.clearParsedCaptions = function() {
  13586. n.captions = [], n.captionStreams = {}
  13587. }, this.resetCaptionStream = function() {
  13588. if (!this.isInitialized()) return null;
  13589. e.reset()
  13590. }, this.clearAllCaptions = function() {
  13591. this.clearParsedCaptions(), this.resetCaptionStream()
  13592. }, this.reset = function() {
  13593. t = [], i = null, r = null, n ? this.clearParsedCaptions() : n = {
  13594. captions: [],
  13595. captionStreams: {}
  13596. }, this.resetCaptionStream()
  13597. }, this.reset()
  13598. }
  13599. },
  13600. At = function(e, t) {
  13601. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  13602. },
  13603. kt = function() {
  13604. function e(e, t) {
  13605. for (var i = 0; i < t.length; i++) {
  13606. var r = t[i];
  13607. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  13608. .defineProperty(e, r.key, r)
  13609. }
  13610. }
  13611. return function(t, i, r) {
  13612. return i && e(t.prototype, i), r && e(t, r), t
  13613. }
  13614. }(),
  13615. Rt = function() {
  13616. function e(t, i) {
  13617. At(this, e), this.options = i || {}, this.self = t, this.init()
  13618. }
  13619. return kt(e, [{
  13620. key: "init",
  13621. value: function() {
  13622. var e, t;
  13623. this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new St.Transmuxer(this
  13624. .options), e = this.self, (t = this.transmuxer).on("data", function(t) {
  13625. var i = t.initSegment;
  13626. t.initSegment = {
  13627. data: i.buffer,
  13628. byteOffset: i.byteOffset,
  13629. byteLength: i.byteLength
  13630. };
  13631. var r = t.data;
  13632. t.data = r.buffer, e.postMessage({
  13633. action: "data",
  13634. segment: t,
  13635. byteOffset: r.byteOffset,
  13636. byteLength: r.byteLength
  13637. }, [t.data])
  13638. }), t.captionStream && t.captionStream.on("data", function(t) {
  13639. e.postMessage({
  13640. action: "caption",
  13641. data: t
  13642. })
  13643. }), t.on("done", function(t) {
  13644. e.postMessage({
  13645. action: "done"
  13646. })
  13647. }), t.on("gopInfo", function(t) {
  13648. e.postMessage({
  13649. action: "gopInfo",
  13650. gopInfo: t
  13651. })
  13652. })
  13653. }
  13654. }, {
  13655. key: "push",
  13656. value: function(e) {
  13657. var t = new Uint8Array(e.data, e.byteOffset, e.byteLength);
  13658. this.transmuxer.push(t)
  13659. }
  13660. }, {
  13661. key: "reset",
  13662. value: function() {
  13663. this.init()
  13664. }
  13665. }, {
  13666. key: "setTimestampOffset",
  13667. value: function(e) {
  13668. var t = e.timestampOffset || 0;
  13669. this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4 * t))
  13670. }
  13671. }, {
  13672. key: "setAudioAppendStart",
  13673. value: function(e) {
  13674. this.transmuxer.setAudioAppendStart(Math.ceil(9e4 * e.appendStart))
  13675. }
  13676. }, {
  13677. key: "flush",
  13678. value: function(e) {
  13679. this.transmuxer.flush()
  13680. }
  13681. }, {
  13682. key: "resetCaptions",
  13683. value: function() {
  13684. this.transmuxer.resetCaptions()
  13685. }
  13686. }, {
  13687. key: "alignGopsWith",
  13688. value: function(e) {
  13689. this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())
  13690. }
  13691. }]), e
  13692. }();
  13693. new function(e) {
  13694. e.onmessage = function(t) {
  13695. "init" === t.data.action && t.data.options ? this.messageHandlers = new Rt(e, t.data.options) : (this
  13696. .messageHandlers || (this.messageHandlers = new Rt(e)), t.data && t.data.action && "init" !== t
  13697. .data.action && this.messageHandlers[t.data.action] && this.messageHandlers[t.data.action](t.data)
  13698. )
  13699. }
  13700. }(i)
  13701. }()
  13702. }),
  13703. nh = {
  13704. videoCodec: "avc1",
  13705. videoObjectTypeIndicator: ".4d400d",
  13706. audioProfile: "2"
  13707. },
  13708. ah = function(e) {
  13709. return e.map(function(e) {
  13710. return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e, t, i) {
  13711. return "avc1." + ("00" + Number(t).toString(16)).slice(-2) + "00" + ("00" + Number(i).toString(16))
  13712. .slice(-2)
  13713. })
  13714. })
  13715. },
  13716. sh = function() {
  13717. var e, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "",
  13718. i = {
  13719. codecCount: 0
  13720. };
  13721. return i.codecCount = t.split(",").length, i.codecCount = i.codecCount || 2, (e = /(^|\s|,)+(avc[13])([^ ,]*)/i
  13722. .exec(t)) && (i.videoCodec = e[2], i.videoObjectTypeIndicator = e[3]), i.audioProfile =
  13723. /(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t), i.audioProfile = i.audioProfile && i.audioProfile[2], i
  13724. },
  13725. oh = function(e, t, i) {
  13726. return e + "/" + t + '; codecs="' + i.filter(function(e) {
  13727. return !!e
  13728. }).join(", ") + '"'
  13729. },
  13730. uh = function(e, t) {
  13731. var i = function(e) {
  13732. return e.segments && e.segments.length && e.segments[0].map ? "mp4" : "mp2t"
  13733. }(t),
  13734. r = function(e) {
  13735. var t = e.attributes || {};
  13736. return t.CODECS ? sh(t.CODECS) : nh
  13737. }(t),
  13738. n = t.attributes || {},
  13739. a = !0,
  13740. s = !1;
  13741. if (!t) return [];
  13742. if (e.mediaGroups.AUDIO && n.AUDIO) {
  13743. var o = e.mediaGroups.AUDIO[n.AUDIO];
  13744. if (o)
  13745. for (var u in s = !0, a = !1, o)
  13746. if (!o[u].uri && !o[u].playlists) {
  13747. a = !0;
  13748. break
  13749. }
  13750. }
  13751. s && !r.audioProfile && (a || (r.audioProfile = function(e, t) {
  13752. if (!e.mediaGroups.AUDIO || !t) return null;
  13753. var i = e.mediaGroups.AUDIO[t];
  13754. if (!i) return null;
  13755. for (var r in i) {
  13756. var n = i[r];
  13757. if (n.default && n.playlists) return sh(n.playlists[0].attributes.CODECS).audioProfile
  13758. }
  13759. return null
  13760. }(e, n.AUDIO)), r.audioProfile || (Ta.log.warn(
  13761. "Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"
  13762. ), r.audioProfile = nh.audioProfile));
  13763. var l = {};
  13764. r.videoCodec && (l.video = "" + r.videoCodec + r.videoObjectTypeIndicator), r.audioProfile && (l.audio =
  13765. "mp4a.40." + r.audioProfile);
  13766. var d = oh("audio", i, [l.audio]),
  13767. c = oh("video", i, [l.video]),
  13768. h = oh("video", i, [l.video, l.audio]);
  13769. return s ? !a && l.video ? [c, d] : a || l.video ? [h, d] : [d, d] : l.video ? [h] : [d]
  13770. },
  13771. lh = function(e) {
  13772. return /mp4a\.\d+.\d+/i.test(e)
  13773. },
  13774. dh = function(e) {
  13775. return /avc1\.[\da-f]+/i.test(e)
  13776. },
  13777. ch = function(e, t, i) {
  13778. var r = null,
  13779. n = null,
  13780. a = 0,
  13781. s = [],
  13782. o = [];
  13783. if (!e && !t) return Ta.createTimeRange();
  13784. if (!e) return t.buffered;
  13785. if (!t) return e.buffered;
  13786. if (i) return e.buffered;
  13787. if (0 === e.buffered.length && 0 === t.buffered.length) return Ta.createTimeRange();
  13788. for (var u = e.buffered, l = t.buffered, d = u.length; d--;) s.push({
  13789. time: u.start(d),
  13790. type: "start"
  13791. }), s.push({
  13792. time: u.end(d),
  13793. type: "end"
  13794. });
  13795. for (d = l.length; d--;) s.push({
  13796. time: l.start(d),
  13797. type: "start"
  13798. }), s.push({
  13799. time: l.end(d),
  13800. type: "end"
  13801. });
  13802. for (s.sort(function(e, t) {
  13803. return e.time - t.time
  13804. }), d = 0; d < s.length; d++) "start" === s[d].type ? 2 === ++a && (r = s[d].time) : "end" === s[d].type &&
  13805. 1 === --a && (n = s[d].time), null !== r && null !== n && (o.push([r, n]), r = null, n = null);
  13806. return Ta.createTimeRanges(o)
  13807. },
  13808. hh = function(e) {
  13809. function t(e, i) {
  13810. Zd(this, t);
  13811. var r = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, Ta.EventTarget));
  13812. r.timestampOffset_ = 0, r.pendingBuffers_ = [], r.bufferUpdating_ = !1, r.mediaSource_ = e, r.codecs_ = i, r
  13813. .audioCodec_ = null, r.videoCodec_ = null, r.audioDisabled_ = !1, r.appendAudioInitSegment_ = !0, r
  13814. .gopBuffer_ = [], r.timeMapping_ = 0, r.safeAppend_ = Ta.browser.IE_VERSION >= 11;
  13815. var n = {
  13816. remux: !1,
  13817. alignGopsAtEnd: r.safeAppend_
  13818. };
  13819. return r.codecs_.forEach(function(e) {
  13820. lh(e) ? r.audioCodec_ = e : dh(e) && (r.videoCodec_ = e)
  13821. }), r.transmuxer_ = new rh, r.transmuxer_.postMessage({
  13822. action: "init",
  13823. options: n
  13824. }), r.transmuxer_.onmessage = function(e) {
  13825. return "data" === e.data.action ? r.data_(e) : "done" === e.data.action ? r.done_(e) : "gopInfo" === e
  13826. .data.action ? r.appendGopInfo_(e) : void 0
  13827. }, Object.defineProperty(r, "timestampOffset", {
  13828. get: function() {
  13829. return this.timestampOffset_
  13830. },
  13831. set: function(e) {
  13832. "number" == typeof e && e >= 0 && (this.timestampOffset_ = e, this.appendAudioInitSegment_ = !0,
  13833. this.gopBuffer_.length = 0, this.timeMapping_ = 0, this.transmuxer_.postMessage({
  13834. action: "setTimestampOffset",
  13835. timestampOffset: e
  13836. }))
  13837. }
  13838. }), Object.defineProperty(r, "appendWindowStart", {
  13839. get: function() {
  13840. return (this.videoBuffer_ || this.audioBuffer_).appendWindowStart
  13841. },
  13842. set: function(e) {
  13843. this.videoBuffer_ && (this.videoBuffer_.appendWindowStart = e), this.audioBuffer_ && (this
  13844. .audioBuffer_.appendWindowStart = e)
  13845. }
  13846. }), Object.defineProperty(r, "updating", {
  13847. get: function() {
  13848. return !!(this.bufferUpdating_ || !this.audioDisabled_ && this.audioBuffer_ && this.audioBuffer_
  13849. .updating || this.videoBuffer_ && this.videoBuffer_.updating)
  13850. }
  13851. }), Object.defineProperty(r, "buffered", {
  13852. get: function() {
  13853. return ch(this.videoBuffer_, this.audioBuffer_, this.audioDisabled_)
  13854. }
  13855. }), r
  13856. }
  13857. return ec(t, e), $d(t, [{
  13858. key: "data_",
  13859. value: function(e) {
  13860. var t = e.data.segment;
  13861. t.data = new Uint8Array(t.data, e.data.byteOffset, e.data.byteLength), t.initSegment =
  13862. new Uint8Array(t.initSegment.data, t.initSegment.byteOffset, t.initSegment.byteLength),
  13863. function(e, t, i) {
  13864. var r = t.player_;
  13865. if (i.captions && i.captions.length)
  13866. for (var n in e.inbandTextTracks_ || (e.inbandTextTracks_ = {}), i.captionStreams)
  13867. if (!e.inbandTextTracks_[n]) {
  13868. r.tech_.trigger({
  13869. type: "usage",
  13870. name: "hls-608"
  13871. });
  13872. var a = r.textTracks().getTrackById(n);
  13873. e.inbandTextTracks_[n] = a || r.addRemoteTextTrack({
  13874. kind: "captions",
  13875. id: n,
  13876. label: n
  13877. }, !1).track
  13878. } i.metadata && i.metadata.length && !e.metadataTrack_ && (e.metadataTrack_ = r
  13879. .addRemoteTextTrack({
  13880. kind: "metadata",
  13881. label: "Timed Metadata"
  13882. }, !1).track, e.metadataTrack_.inBandMetadataTrackDispatchType = i.metadata.dispatchType)
  13883. }(this, this.mediaSource_, t), this.pendingBuffers_.push(t)
  13884. }
  13885. }, {
  13886. key: "done_",
  13887. value: function(e) {
  13888. "closed" !== this.mediaSource_.readyState ? this.processPendingSegments_() : this.pendingBuffers_
  13889. .length = 0
  13890. }
  13891. }, {
  13892. key: "createRealSourceBuffers_",
  13893. value: function() {
  13894. var e = this,
  13895. t = ["audio", "video"];
  13896. t.forEach(function(i) {
  13897. if (e[i + "Codec_"] && !e[i + "Buffer_"]) {
  13898. var r = null;
  13899. if (e.mediaSource_[i + "Buffer_"])(r = e.mediaSource_[i + "Buffer_"]).updating = !1;
  13900. else {
  13901. var n = i + '/mp4;codecs="' + e[i + "Codec_"] + '"';
  13902. r = function(e, t) {
  13903. var i = e.addSourceBuffer(t),
  13904. r = Object.create(null);
  13905. r.updating = !1, r.realBuffer_ = i;
  13906. var n = function(e) {
  13907. "function" == typeof i[e] ? r[e] = function() {
  13908. return i[e].apply(i, arguments)
  13909. } : void 0 === r[e] && Object.defineProperty(r, e, {
  13910. get: function() {
  13911. return i[e]
  13912. },
  13913. set: function(t) {
  13914. return i[e] = t
  13915. }
  13916. })
  13917. };
  13918. for (var a in i) n(a);
  13919. return r
  13920. }(e.mediaSource_.nativeMediaSource_, n), e.mediaSource_[i + "Buffer_"] = r
  13921. }
  13922. e[i + "Buffer_"] = r, ["update", "updatestart", "updateend"].forEach(function(n) {
  13923. r.addEventListener(n, function() {
  13924. if ("audio" !== i || !e.audioDisabled_) return "updateend" === n && (e[i +
  13925. "Buffer_"].updating = !1), t.every(function(t) {
  13926. return !("audio" !== t || !e.audioDisabled_) || (i === t || !e[t +
  13927. "Buffer_"] || !e[t + "Buffer_"].updating)
  13928. }) ? e.trigger(n) : void 0
  13929. })
  13930. })
  13931. }
  13932. })
  13933. }
  13934. }, {
  13935. key: "appendBuffer",
  13936. value: function(e) {
  13937. if (this.bufferUpdating_ = !0, this.audioBuffer_ && this.audioBuffer_.buffered.length) {
  13938. var t = this.audioBuffer_.buffered;
  13939. this.transmuxer_.postMessage({
  13940. action: "setAudioAppendStart",
  13941. appendStart: t.end(t.length - 1)
  13942. })
  13943. }
  13944. this.videoBuffer_ && this.transmuxer_.postMessage({
  13945. action: "alignGopsWith",
  13946. gopsToAlignWith: function(e, t, i) {
  13947. if (void 0 === t || null === t || !e.length) return [];
  13948. var r = Math.ceil(9e4 * (t - i + 3)),
  13949. n = void 0;
  13950. for (n = 0; n < e.length && !(e[n].pts > r); n++);
  13951. return e.slice(n)
  13952. }(this.gopBuffer_, this.mediaSource_.player_ ? this.mediaSource_.player_.currentTime() :
  13953. null, this.timeMapping_)
  13954. }), this.transmuxer_.postMessage({
  13955. action: "push",
  13956. data: e.buffer,
  13957. byteOffset: e.byteOffset,
  13958. byteLength: e.byteLength
  13959. }, [e.buffer]), this.transmuxer_.postMessage({
  13960. action: "flush"
  13961. })
  13962. }
  13963. }, {
  13964. key: "appendGopInfo_",
  13965. value: function(e) {
  13966. this.gopBuffer_ = function(e, t, i) {
  13967. if (!t.length) return e;
  13968. if (i) return t.slice();
  13969. for (var r = t[0].pts, n = 0; n < e.length && !(e[n].pts >= r); n++);
  13970. return e.slice(0, n).concat(t)
  13971. }(this.gopBuffer_, e.data.gopInfo, this.safeAppend_)
  13972. }
  13973. }, {
  13974. key: "remove",
  13975. value: function(e, t) {
  13976. if (this.videoBuffer_ && (this.videoBuffer_.updating = !0, this.videoBuffer_.remove(e, t), this
  13977. .gopBuffer_ = function(e, t, i, r) {
  13978. for (var n = Math.ceil(9e4 * (t - r)), a = Math.ceil(9e4 * (i - r)), s = e.slice(), o = e
  13979. .length; o-- && !(e[o].pts <= a););
  13980. if (-1 === o) return s;
  13981. for (var u = o + 1; u-- && !(e[u].pts <= n););
  13982. return u = Math.max(u, 0), s.splice(u, o - u + 1), s
  13983. }(this.gopBuffer_, e, t, this.timeMapping_)), !this.audioDisabled_ && this.audioBuffer_ && (this
  13984. .audioBuffer_.updating = !0, this.audioBuffer_.remove(e, t)), Vc(e, t, this.metadataTrack_),
  13985. this.inbandTextTracks_)
  13986. for (var i in this.inbandTextTracks_) Vc(e, t, this.inbandTextTracks_[i])
  13987. }
  13988. }, {
  13989. key: "processPendingSegments_",
  13990. value: function() {
  13991. var e = {
  13992. video: {
  13993. segments: [],
  13994. bytes: 0
  13995. },
  13996. audio: {
  13997. segments: [],
  13998. bytes: 0
  13999. },
  14000. captions: [],
  14001. metadata: []
  14002. };
  14003. e = this.pendingBuffers_.reduce(function(e, t) {
  14004. var i = t.type,
  14005. r = t.data,
  14006. n = t.initSegment;
  14007. return e[i].segments.push(r), e[i].bytes += r.byteLength, e[i].initSegment = n, t.captions &&
  14008. (e.captions = e.captions.concat(t.captions)), t.info && (e[i].info = t.info), t.metadata &&
  14009. (e.metadata = e.metadata.concat(t.metadata)), e
  14010. }, e), this.videoBuffer_ || this.audioBuffer_ || (0 === e.video.bytes && (this.videoCodec_ =
  14011. null), 0 === e.audio.bytes && (this.audioCodec_ = null), this.createRealSourceBuffers_()), e
  14012. .audio.info && this.mediaSource_.trigger({
  14013. type: "audioinfo",
  14014. info: e.audio.info
  14015. }), e.video.info && this.mediaSource_.trigger({
  14016. type: "videoinfo",
  14017. info: e.video.info
  14018. }), this.appendAudioInitSegment_ && (!this.audioDisabled_ && this.audioBuffer_ && (e.audio
  14019. .segments.unshift(e.audio.initSegment), e.audio.bytes += e.audio.initSegment.byteLength), this
  14020. .appendAudioInitSegment_ = !1);
  14021. var t = !1;
  14022. this.videoBuffer_ && e.video.bytes ? (e.video.segments.unshift(e.video.initSegment), e.video
  14023. .bytes += e.video.initSegment.byteLength, this.concatAndAppendSegments_(e.video, this
  14024. .videoBuffer_), qc(this, e.captions, e.metadata)) : !this.videoBuffer_ || !this
  14025. .audioDisabled_ && this.audioBuffer_ || (t = !0), !this.audioDisabled_ && this.audioBuffer_ &&
  14026. this.concatAndAppendSegments_(e.audio, this.audioBuffer_), this.pendingBuffers_.length = 0, t &&
  14027. this.trigger("updateend"), this.bufferUpdating_ = !1
  14028. }
  14029. }, {
  14030. key: "concatAndAppendSegments_",
  14031. value: function(e, t) {
  14032. var i = 0,
  14033. r = void 0;
  14034. if (e.bytes) {
  14035. r = new Uint8Array(e.bytes), e.segments.forEach(function(e) {
  14036. r.set(e, i), i += e.byteLength
  14037. });
  14038. try {
  14039. t.updating = !0, t.appendBuffer(r)
  14040. } catch (e) {
  14041. this.mediaSource_.player_ && this.mediaSource_.player_.error({
  14042. code: -3,
  14043. type: "APPEND_BUFFER_ERR",
  14044. message: e.message,
  14045. originalError: e
  14046. })
  14047. }
  14048. }
  14049. }
  14050. }, {
  14051. key: "abort",
  14052. value: function() {
  14053. this.videoBuffer_ && this.videoBuffer_.abort(), !this.audioDisabled_ && this.audioBuffer_ && this
  14054. .audioBuffer_.abort(), this.transmuxer_ && this.transmuxer_.postMessage({
  14055. action: "reset"
  14056. }), this.pendingBuffers_.length = 0, this.bufferUpdating_ = !1
  14057. }
  14058. }]), t
  14059. }(Ta.EventTarget),
  14060. fh = function(e) {
  14061. function t() {
  14062. Zd(this, t);
  14063. var e = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)),
  14064. i = void 0;
  14065. for (i in e.nativeMediaSource_ = new n.MediaSource, e.nativeMediaSource_) i in t.prototype || "function" !=
  14066. typeof e.nativeMediaSource_[i] || (e[i] = e.nativeMediaSource_[i].bind(e.nativeMediaSource_));
  14067. return e.duration_ = NaN, Object.defineProperty(e, "duration", {
  14068. get: function() {
  14069. return this.duration_ === 1 / 0 ? this.duration_ : this.nativeMediaSource_.duration
  14070. },
  14071. set: function(e) {
  14072. this.duration_ = e, e === 1 / 0 || (this.nativeMediaSource_.duration = e)
  14073. }
  14074. }), Object.defineProperty(e, "seekable", {
  14075. get: function() {
  14076. return this.duration_ === 1 / 0 ? Ta.createTimeRanges([
  14077. [0, this.nativeMediaSource_.duration]
  14078. ]) : this.nativeMediaSource_.seekable
  14079. }
  14080. }), Object.defineProperty(e, "readyState", {
  14081. get: function() {
  14082. return this.nativeMediaSource_.readyState
  14083. }
  14084. }), Object.defineProperty(e, "activeSourceBuffers", {
  14085. get: function() {
  14086. return this.activeSourceBuffers_
  14087. }
  14088. }), e.sourceBuffers = [], e.activeSourceBuffers_ = [], e.updateActiveSourceBuffers_ = function() {
  14089. if (e.activeSourceBuffers_.length = 0, 1 === e.sourceBuffers.length) {
  14090. var t = e.sourceBuffers[0];
  14091. return t.appendAudioInitSegment_ = !0, t.audioDisabled_ = !t.audioCodec_, void e.activeSourceBuffers_
  14092. .push(t)
  14093. }
  14094. for (var i = !1, r = !0, n = 0; n < e.player_.audioTracks().length; n++) {
  14095. var a = e.player_.audioTracks()[n];
  14096. if (a.enabled && "main" !== a.kind) {
  14097. i = !0, r = !1;
  14098. break
  14099. }
  14100. }
  14101. e.sourceBuffers.forEach(function(t, n) {
  14102. if (t.appendAudioInitSegment_ = !0, t.videoCodec_ && t.audioCodec_) t.audioDisabled_ = i;
  14103. else if (t.videoCodec_ && !t.audioCodec_) t.audioDisabled_ = !0, r = !1;
  14104. else if (!t.videoCodec_ && t.audioCodec_ && (t.audioDisabled_ = n ? r : !r, t.audioDisabled_))
  14105. return;
  14106. e.activeSourceBuffers_.push(t)
  14107. })
  14108. }, e.onPlayerMediachange_ = function() {
  14109. e.sourceBuffers.forEach(function(e) {
  14110. e.appendAudioInitSegment_ = !0
  14111. })
  14112. }, e.onHlsReset_ = function() {
  14113. e.sourceBuffers.forEach(function(e) {
  14114. e.transmuxer_ && e.transmuxer_.postMessage({
  14115. action: "resetCaptions"
  14116. })
  14117. })
  14118. }, e.onHlsSegmentTimeMapping_ = function(t) {
  14119. e.sourceBuffers.forEach(function(e) {
  14120. return e.timeMapping_ = t.mapping
  14121. })
  14122. }, ["sourceopen", "sourceclose", "sourceended"].forEach(function(e) {
  14123. this.nativeMediaSource_.addEventListener(e, this.trigger.bind(this))
  14124. }, e), e.on("sourceopen", function(t) {
  14125. var i = l.querySelector('[src="' + e.url_ + '"]');
  14126. i && (e.player_ = Ta(i.parentNode), e.player_.tech_.on("hls-reset", e.onHlsReset_), e.player_.tech_.on(
  14127. "hls-segment-time-mapping", e.onHlsSegmentTimeMapping_), e.player_.audioTracks && e.player_
  14128. .audioTracks() && (e.player_.audioTracks().on("change", e.updateActiveSourceBuffers_), e.player_
  14129. .audioTracks().on("addtrack", e.updateActiveSourceBuffers_), e.player_.audioTracks().on(
  14130. "removetrack", e.updateActiveSourceBuffers_)), e.player_.on("mediachange", e
  14131. .onPlayerMediachange_))
  14132. }), e.on("sourceended", function(t) {
  14133. for (var i = Wc(e.duration), r = 0; r < e.sourceBuffers.length; r++) {
  14134. var n = e.sourceBuffers[r],
  14135. a = n.metadataTrack_ && n.metadataTrack_.cues;
  14136. a && a.length && (a[a.length - 1].endTime = i)
  14137. }
  14138. }), e.on("sourceclose", function(e) {
  14139. this.sourceBuffers.forEach(function(e) {
  14140. e.transmuxer_ && e.transmuxer_.terminate()
  14141. }), this.sourceBuffers.length = 0, this.player_ && (this.player_.audioTracks && this.player_
  14142. .audioTracks() && (this.player_.audioTracks().off("change", this.updateActiveSourceBuffers_), this
  14143. .player_.audioTracks().off("addtrack", this.updateActiveSourceBuffers_), this.player_
  14144. .audioTracks().off("removetrack", this.updateActiveSourceBuffers_)), this.player_.el_ && (this
  14145. .player_.off("mediachange", this.onPlayerMediachange_), this.player_.tech_.off("hls-reset", this
  14146. .onHlsReset_), this.player_.tech_.off("hls-segment-time-mapping", this.onHlsSegmentTimeMapping_)
  14147. ))
  14148. }), e
  14149. }
  14150. return ec(t, e), $d(t, [{
  14151. key: "addSeekableRange_",
  14152. value: function(e, t) {
  14153. var i = void 0;
  14154. if (this.duration !== 1 / 0) throw (i = new Error(
  14155. "MediaSource.addSeekableRange() can only be invoked when the duration is Infinity")).name =
  14156. "InvalidStateError", i.code = 11, i;
  14157. (t > this.nativeMediaSource_.duration || isNaN(this.nativeMediaSource_.duration)) && (this
  14158. .nativeMediaSource_.duration = t)
  14159. }
  14160. }, {
  14161. key: "addSourceBuffer",
  14162. value: function(e) {
  14163. var t = void 0,
  14164. i = function(e) {
  14165. var t = {
  14166. type: "",
  14167. parameters: {}
  14168. },
  14169. i = e.trim().split(";");
  14170. return t.type = i.shift().trim(), i.forEach(function(e) {
  14171. var i = e.trim().split("=");
  14172. if (i.length > 1) {
  14173. var r = i[0].replace(/"/g, "").trim(),
  14174. n = i[1].replace(/"/g, "").trim();
  14175. t.parameters[r] = n
  14176. }
  14177. }), t
  14178. }(e);
  14179. if (/^(video|audio)\/mp2t$/i.test(i.type)) {
  14180. var r = [];
  14181. i.parameters && i.parameters.codecs && (r = i.parameters.codecs.split(","), r = (r = ah(r))
  14182. .filter(function(e) {
  14183. return lh(e) || dh(e)
  14184. })), 0 === r.length && (r = ["avc1.4d400d", "mp4a.40.2"]), t = new hh(this, r), 0 !== this
  14185. .sourceBuffers.length && (this.sourceBuffers[0].createRealSourceBuffers_(), t
  14186. .createRealSourceBuffers_(), this.sourceBuffers[0].audioDisabled_ = !0)
  14187. } else t = this.nativeMediaSource_.addSourceBuffer(e);
  14188. return this.sourceBuffers.push(t), t
  14189. }
  14190. }]), t
  14191. }(Ta.EventTarget),
  14192. ph = 0;
  14193. Ta.mediaSources = {};
  14194. var mh = function(e, t) {
  14195. var i = Ta.mediaSources[e];
  14196. if (!i) throw new Error("Media Source not found (Video.js)");
  14197. i.trigger({
  14198. type: "sourceopen",
  14199. swfId: t
  14200. })
  14201. },
  14202. gh = function() {
  14203. return !!n.MediaSource && !!n.MediaSource.isTypeSupported && n.MediaSource.isTypeSupported(
  14204. 'video/mp4;codecs="avc1.4d400d,mp4a.40.2"')
  14205. },
  14206. vh = function() {
  14207. if (this.MediaSource = {
  14208. open: mh,
  14209. supportsNativeMediaSources: gh
  14210. }, gh()) return new fh;
  14211. throw new Error("Cannot use create a virtual MediaSource for this video")
  14212. };
  14213. vh.open = mh, vh.supportsNativeMediaSources = gh;
  14214. var yh = {
  14215. createObjectURL: function(e) {
  14216. var t = void 0;
  14217. return e instanceof fh ? (t = n.URL.createObjectURL(e.nativeMediaSource_), e.url_ = t, t) :
  14218. e instanceof fh ? (t = "blob:vjs-media-source/" + ph, ph++, Ta.mediaSources[t] = e, t) : (t = n.URL
  14219. .createObjectURL(e), e.url_ = t, t)
  14220. }
  14221. };
  14222. Ta.MediaSource = vh, Ta.URL = yh;
  14223. var _h = Ta.EventTarget,
  14224. bh = Ta.mergeOptions,
  14225. wh = function(e, t) {
  14226. for (var i = bh(e, {
  14227. duration: t.duration,
  14228. minimumUpdatePeriod: t.minimumUpdatePeriod
  14229. }), r = 0; r < t.playlists.length; r++) {
  14230. var n = oc(i, t.playlists[r]);
  14231. n && (i = n)
  14232. }
  14233. return sc(t, function(e, t, r, n) {
  14234. if (e.playlists && e.playlists.length) {
  14235. var a = e.playlists[0].uri,
  14236. s = oc(i, e.playlists[0]);
  14237. s && ((i = s).mediaGroups[t][r][n].playlists[0] = i.playlists[a])
  14238. }
  14239. }), i
  14240. },
  14241. Eh = function(e) {
  14242. function t(e, i, r, a) {
  14243. Zd(this, t);
  14244. var s = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
  14245. if (s.hls_ = i, s.withCredentials = r, !e) throw new Error(
  14246. "A non-empty playlist URL or playlist is required");
  14247. return s.on("minimumUpdatePeriod", function() {
  14248. s.refreshXml_()
  14249. }), s.on("mediaupdatetimeout", function() {
  14250. s.refreshMedia_()
  14251. }), "string" == typeof e ? (s.srcUrl = e, s.state = "HAVE_NOTHING", tc(s)) : (s.masterPlaylistLoader_ = a, s
  14252. .state = "HAVE_METADATA", s.started = !0, s.media(e), n.setTimeout(function() {
  14253. s.trigger("loadedmetadata")
  14254. }, 0), s)
  14255. }
  14256. return ec(t, _h), $d(t, [{
  14257. key: "dispose",
  14258. value: function() {
  14259. this.stopRequest(), n.clearTimeout(this.mediaUpdateTimeout)
  14260. }
  14261. }, {
  14262. key: "stopRequest",
  14263. value: function() {
  14264. if (this.request) {
  14265. var e = this.request;
  14266. this.request = null, e.onreadystatechange = null, e.abort()
  14267. }
  14268. }
  14269. }, {
  14270. key: "media",
  14271. value: function(e) {
  14272. if (!e) return this.media_;
  14273. if ("HAVE_NOTHING" === this.state) throw new Error("Cannot switch media playlist from " + this
  14274. .state);
  14275. var t = this.state;
  14276. if ("string" == typeof e) {
  14277. if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e);
  14278. e = this.master.playlists[e]
  14279. }
  14280. var i = !this.media_ || e.uri !== this.media_.uri;
  14281. this.state = "HAVE_METADATA", i && (this.media_ && this.trigger("mediachanging"), this.media_ = e,
  14282. this.refreshMedia_(), "HAVE_MASTER" !== t && this.trigger("mediachange"))
  14283. }
  14284. }, {
  14285. key: "pause",
  14286. value: function() {
  14287. this.stopRequest(), "HAVE_NOTHING" === this.state && (this.started = !1)
  14288. }
  14289. }, {
  14290. key: "load",
  14291. value: function() {
  14292. this.started ? this.trigger("loadedplaylist") : this.start()
  14293. }
  14294. }, {
  14295. key: "parseMasterXml",
  14296. value: function() {
  14297. var e = so(this.masterXml_, {
  14298. manifestUri: this.srcUrl,
  14299. clientOffset: this.clientOffset_
  14300. });
  14301. e.uri = this.srcUrl;
  14302. for (var t = 0; t < e.playlists.length; t++) {
  14303. var i = "placeholder-uri-" + t;
  14304. e.playlists[t].uri = i, e.playlists[i] = e.playlists[t]
  14305. }
  14306. return sc(e, function(t, i, r, n) {
  14307. if (t.playlists && t.playlists.length) {
  14308. var a = "placeholder-uri-" + i + "-" + r + "-" + n;
  14309. t.playlists[0].uri = a, e.playlists[a] = t.playlists[0]
  14310. }
  14311. }), uc(e), lc(e), e
  14312. }
  14313. }, {
  14314. key: "start",
  14315. value: function() {
  14316. var e = this;
  14317. this.started = !0, this.request = this.hls_.xhr({
  14318. uri: this.srcUrl,
  14319. withCredentials: this.withCredentials
  14320. }, function(t, i) {
  14321. if (e.request) {
  14322. if (e.request = null, t) return e.error = {
  14323. status: i.status,
  14324. message: "DASH playlist request error at URL: " + e.srcUrl,
  14325. responseText: i.responseText,
  14326. code: 2
  14327. }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error");
  14328. e.masterXml_ = i.responseText, i.responseHeaders && i.responseHeaders.date ? e
  14329. .masterLoaded_ = Date.parse(i.responseHeaders.date) : e.masterLoaded_ = Date.now(), e
  14330. .syncClientServerClock_(e.onClientServerClockSync_.bind(e))
  14331. }
  14332. })
  14333. }
  14334. }, {
  14335. key: "syncClientServerClock_",
  14336. value: function(e) {
  14337. var t = this,
  14338. i = oo(this.masterXml_);
  14339. return null === i ? (this.clientOffset_ = this.masterLoaded_ - Date.now(), e()) : "DIRECT" === i
  14340. .method ? (this.clientOffset_ = i.value - Date.now(), e()) : void(this.request = this.hls_.xhr({
  14341. uri: Jd(this.srcUrl, i.value),
  14342. method: i.method,
  14343. withCredentials: this.withCredentials
  14344. }, function(r, n) {
  14345. if (t.request) {
  14346. if (r) return t.clientOffset_ = t.masterLoaded_ - Date.now(), e();
  14347. var a = void 0;
  14348. a = "HEAD" === i.method ? n.responseHeaders && n.responseHeaders.date ? Date.parse(n
  14349. .responseHeaders.date) : t.masterLoaded_ : Date.parse(n.responseText), t
  14350. .clientOffset_ = a - Date.now(), e()
  14351. }
  14352. }))
  14353. }
  14354. }, {
  14355. key: "onClientServerClockSync_",
  14356. value: function() {
  14357. var e = this;
  14358. this.master = this.parseMasterXml(), this.state = "HAVE_MASTER", this.trigger("loadedplaylist"),
  14359. this.media_ || this.media(this.master.playlists[0]), n.setTimeout(function() {
  14360. e.trigger("loadedmetadata")
  14361. }, 0), this.master.minimumUpdatePeriod && n.setTimeout(function() {
  14362. e.trigger("minimumUpdatePeriod")
  14363. }, this.master.minimumUpdatePeriod)
  14364. }
  14365. }, {
  14366. key: "refreshXml_",
  14367. value: function() {
  14368. var e = this;
  14369. this.request = this.hls_.xhr({
  14370. uri: this.srcUrl,
  14371. withCredentials: this.withCredentials
  14372. }, function(t, i) {
  14373. if (e.request) {
  14374. if (e.request = null, t) return e.error = {
  14375. status: i.status,
  14376. message: "DASH playlist request error at URL: " + e.srcUrl,
  14377. responseText: i.responseText,
  14378. code: 2
  14379. }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error");
  14380. e.masterXml_ = i.responseText;
  14381. var r = e.parseMasterXml();
  14382. e.master = wh(e.master, r), n.setTimeout(function() {
  14383. e.trigger("minimumUpdatePeriod")
  14384. }, e.master.minimumUpdatePeriod)
  14385. }
  14386. })
  14387. }
  14388. }, {
  14389. key: "refreshMedia_",
  14390. value: function() {
  14391. var e = this,
  14392. t = void 0,
  14393. i = void 0;
  14394. this.masterPlaylistLoader_ ? (t = this.masterPlaylistLoader_.master, i = this.masterPlaylistLoader_
  14395. .parseMasterXml()) : (t = this.master, i = this.parseMasterXml());
  14396. var r = wh(t, i);
  14397. r ? (this.masterPlaylistLoader_ ? this.masterPlaylistLoader_.master = r : this.master = r, this
  14398. .media_ = r.playlists[this.media_.uri]) : this.trigger("playlistunchanged"), this.media()
  14399. .endList || (this.mediaUpdateTimeout = n.setTimeout(function() {
  14400. e.trigger("mediaupdatetimeout")
  14401. }, dc(this.media(), !!r))), this.trigger("loadedplaylist")
  14402. }
  14403. }]), t
  14404. }(),
  14405. Th = function(e) {
  14406. return Ta.log.debug ? Ta.log.debug.bind(Ta, "VHS:", e + " >") : function() {}
  14407. };
  14408. function Sh() {}
  14409. var Ah = function() {
  14410. function e(t, i, r, n) {
  14411. Zd(this, e), this.callbacks_ = [], this.pendingCallback_ = null, this.timestampOffset_ = 0, this.mediaSource =
  14412. t, this.processedAppend_ = !1, this.type_ = r, this.mimeType_ = i, this.logger_ = Th("SourceUpdater[" + r +
  14413. "][" + i + "]"), "closed" === t.readyState ? t.addEventListener("sourceopen", this.createSourceBuffer_
  14414. .bind(this, i, n)) : this.createSourceBuffer_(i, n)
  14415. }
  14416. return $d(e, [{
  14417. key: "createSourceBuffer_",
  14418. value: function(e, t) {
  14419. var i = this;
  14420. this.sourceBuffer_ = this.mediaSource.addSourceBuffer(e), this.logger_("created SourceBuffer"), t &&
  14421. (t.trigger("sourcebufferadded"), this.mediaSource.sourceBuffers.length < 2) ? t.on(
  14422. "sourcebufferadded",
  14423. function() {
  14424. i.start_()
  14425. }) : this.start_()
  14426. }
  14427. }, {
  14428. key: "start_",
  14429. value: function() {
  14430. var e = this;
  14431. this.started_ = !0, this.onUpdateendCallback_ = function() {
  14432. var t = e.pendingCallback_;
  14433. e.pendingCallback_ = null, e.logger_("buffered [" + Hc(e.buffered()) + "]"), t && t(), e
  14434. .runCallback_()
  14435. }, this.sourceBuffer_.addEventListener("updateend", this.onUpdateendCallback_), this
  14436. .runCallback_()
  14437. }
  14438. }, {
  14439. key: "abort",
  14440. value: function(e) {
  14441. var t = this;
  14442. this.processedAppend_ && this.queueCallback_(function() {
  14443. t.sourceBuffer_.abort()
  14444. }, e)
  14445. }
  14446. }, {
  14447. key: "appendBuffer",
  14448. value: function(e, t) {
  14449. var i = this;
  14450. this.processedAppend_ = !0, this.queueCallback_(function() {
  14451. i.sourceBuffer_.appendBuffer(e)
  14452. }, t)
  14453. }
  14454. }, {
  14455. key: "buffered",
  14456. value: function() {
  14457. return this.sourceBuffer_ ? this.sourceBuffer_.buffered : Ta.createTimeRanges()
  14458. }
  14459. }, {
  14460. key: "remove",
  14461. value: function(e, t) {
  14462. var i = this,
  14463. r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : Sh;
  14464. this.processedAppend_ && this.queueCallback_(function() {
  14465. i.logger_("remove [" + e + " => " + t + "]"), i.sourceBuffer_.remove(e, t)
  14466. }, r)
  14467. }
  14468. }, {
  14469. key: "updating",
  14470. value: function() {
  14471. return !this.sourceBuffer_ || this.sourceBuffer_.updating || this.pendingCallback_
  14472. }
  14473. }, {
  14474. key: "timestampOffset",
  14475. value: function(e) {
  14476. var t = this;
  14477. return void 0 !== e && (this.queueCallback_(function() {
  14478. t.sourceBuffer_.timestampOffset = e
  14479. }), this.timestampOffset_ = e), this.timestampOffset_
  14480. }
  14481. }, {
  14482. key: "queueCallback_",
  14483. value: function(e, t) {
  14484. this.callbacks_.push([e.bind(this), t]), this.runCallback_()
  14485. }
  14486. }, {
  14487. key: "runCallback_",
  14488. value: function() {
  14489. var e = void 0;
  14490. !this.updating() && this.callbacks_.length && this.started_ && (e = this.callbacks_.shift(), this
  14491. .pendingCallback_ = e[1], e[0]())
  14492. }
  14493. }, {
  14494. key: "dispose",
  14495. value: function() {
  14496. this.sourceBuffer_.removeEventListener("updateend", this.onUpdateendCallback_), this
  14497. .sourceBuffer_ && "open" === this.mediaSource.readyState && this.sourceBuffer_.abort()
  14498. }
  14499. }]), e
  14500. }(),
  14501. kh = {
  14502. GOAL_BUFFER_LENGTH: 30,
  14503. MAX_GOAL_BUFFER_LENGTH: 60,
  14504. GOAL_BUFFER_LENGTH_RATE: 1,
  14505. BANDWIDTH_VARIANCE: 1.2,
  14506. BUFFER_LOW_WATER_LINE: 0,
  14507. MAX_BUFFER_LOW_WATER_LINE: 30,
  14508. BUFFER_LOW_WATER_LINE_RATE: 1
  14509. },
  14510. Rh = 2,
  14511. Mh = -101,
  14512. Oh = -102,
  14513. Ch = function(e) {
  14514. var t, i, r = {};
  14515. return e.byterange && (r.Range = (t = e.byterange, i = t.offset + t.length - 1, "bytes=" + t.offset + "-" + i)),
  14516. r
  14517. },
  14518. Dh = function(e) {
  14519. e.forEach(function(e) {
  14520. e.abort()
  14521. })
  14522. },
  14523. Ih = function(e, t) {
  14524. return t.timedout ? {
  14525. status: t.status,
  14526. message: "HLS request timed-out at URL: " + t.uri,
  14527. code: Mh,
  14528. xhr: t
  14529. } : t.aborted ? {
  14530. status: t.status,
  14531. message: "HLS request aborted at URL: " + t.uri,
  14532. code: Oh,
  14533. xhr: t
  14534. } : e ? {
  14535. status: t.status,
  14536. message: "HLS request errored at URL: " + t.uri,
  14537. code: Rh,
  14538. xhr: t
  14539. } : null
  14540. },
  14541. Lh = function(e, t, i) {
  14542. var r = [],
  14543. n = 0;
  14544. return function(a, s) {
  14545. if (a && (Dh(e), r.push(a)), (n += 1) === e.length) {
  14546. if (s.endOfAllRequests = Date.now(), r.length > 0) {
  14547. var o = function(e) {
  14548. return e.reduce(function(e, t) {
  14549. return t.code > e.code ? t : e
  14550. })
  14551. }(r);
  14552. return i(o, s)
  14553. }
  14554. return s.encryptedBytes ? function(e, t, i) {
  14555. e.addEventListener("message", function r(n) {
  14556. if (n.data.source === t.requestId) {
  14557. e.removeEventListener("message", r);
  14558. var a = n.data.decrypted;
  14559. return t.bytes = new Uint8Array(a.bytes, a.byteOffset, a.byteLength), i(null, t)
  14560. }
  14561. }), e.postMessage(xc({
  14562. source: t.requestId,
  14563. encrypted: t.encryptedBytes,
  14564. key: t.key.bytes,
  14565. iv: t.key.iv
  14566. }), [t.encryptedBytes.buffer, t.key.bytes.buffer])
  14567. }(t, s, i) : i(null, s)
  14568. }
  14569. }
  14570. },
  14571. xh = function(e, t) {
  14572. return function(i) {
  14573. var r, n, a;
  14574. return e.stats = Ta.mergeOptions(e.stats, (n = (r = i).target, (a = {
  14575. bandwidth: 1 / 0,
  14576. bytesReceived: 0,
  14577. roundTripTime: Date.now() - n.requestTime || 0
  14578. }).bytesReceived = r.loaded, a.bandwidth = Math.floor(a.bytesReceived / a.roundTripTime * 8 * 1e3), a)), !
  14579. e.stats.firstBytesReceivedAt && e.stats.bytesReceived && (e.stats.firstBytesReceivedAt = Date.now()), t(i,
  14580. e)
  14581. }
  14582. },
  14583. Ph = function(e, t, i, r, n, a, s) {
  14584. var o = [],
  14585. u = Lh(o, i, s);
  14586. if (n.key) {
  14587. var l = e(Ta.mergeOptions(t, {
  14588. uri: n.key.resolvedUri,
  14589. responseType: "arraybuffer"
  14590. }), function(e, t) {
  14591. return function(i, r) {
  14592. var n = r.response,
  14593. a = Ih(i, r);
  14594. if (a) return t(a, e);
  14595. if (16 !== n.byteLength) return t({
  14596. status: r.status,
  14597. message: "Invalid HLS key at URL: " + r.uri,
  14598. code: Rh,
  14599. xhr: r
  14600. }, e);
  14601. var s = new DataView(n);
  14602. return e.key.bytes = new Uint32Array([s.getUint32(0), s.getUint32(4), s.getUint32(8), s.getUint32(
  14603. 12)]), t(null, e)
  14604. }
  14605. }(n, u));
  14606. o.push(l)
  14607. }
  14608. if (n.map && !n.map.bytes) {
  14609. var d = e(Ta.mergeOptions(t, {
  14610. uri: n.map.resolvedUri,
  14611. responseType: "arraybuffer",
  14612. headers: Ch(n.map)
  14613. }), function(e, t, i) {
  14614. return function(r, n) {
  14615. var a = n.response,
  14616. s = Ih(r, n);
  14617. return s ? i(s, e) : 0 === a.byteLength ? i({
  14618. status: n.status,
  14619. message: "Empty HLS segment content at URL: " + n.uri,
  14620. code: Rh,
  14621. xhr: n
  14622. }, e) : (e.map.bytes = new Uint8Array(n.response), t.isInitialized() || t.init(), e.map
  14623. .timescales = fo.timescale(e.map.bytes), e.map.videoTrackIds = fo.videoTrackIds(e.map.bytes), i(
  14624. null, e))
  14625. }
  14626. }(n, r, u));
  14627. o.push(d)
  14628. }
  14629. var c = e(Ta.mergeOptions(t, {
  14630. uri: n.resolvedUri,
  14631. responseType: "arraybuffer",
  14632. headers: Ch(n)
  14633. }), function(e, t, i) {
  14634. return function(r, n) {
  14635. var a = n.response,
  14636. s = Ih(r, n),
  14637. o = void 0;
  14638. return s ? i(s, e) : 0 === a.byteLength ? i({
  14639. status: n.status,
  14640. message: "Empty HLS segment content at URL: " + n.uri,
  14641. code: Rh,
  14642. xhr: n
  14643. }, e) : (e.stats = function(e) {
  14644. return {
  14645. bandwidth: e.bandwidth,
  14646. bytesReceived: e.bytesReceived || 0,
  14647. roundTripTime: e.roundTripTime || 0
  14648. }
  14649. }(n), e.key ? e.encryptedBytes = new Uint8Array(n.response) : e.bytes = new Uint8Array(n
  14650. .response), e.map && e.map.bytes && (t.isInitialized() || t.init(), (o = t.parse(e.bytes, e.map
  14651. .videoTrackIds, e.map.timescales)) && o.captions && (e.captionStreams = o.captionStreams, e
  14652. .fmp4Captions = o.captions)), i(null, e))
  14653. }
  14654. }(n, r, u));
  14655. return c.addEventListener("progress", xh(n, a)), o.push(c),
  14656. function() {
  14657. return Dh(o)
  14658. }
  14659. },
  14660. Uh = function(e, t) {
  14661. var i;
  14662. return e && (i = n.getComputedStyle(e)) ? i[t] : ""
  14663. },
  14664. Nh = function(e, t) {
  14665. var i = e.slice();
  14666. e.sort(function(e, r) {
  14667. var n = t(e, r);
  14668. return 0 === n ? i.indexOf(e) - i.indexOf(r) : n
  14669. })
  14670. },
  14671. Bh = function(e, t) {
  14672. var i = void 0,
  14673. r = void 0;
  14674. return e.attributes.BANDWIDTH && (i = e.attributes.BANDWIDTH), i = i || n.Number.MAX_VALUE, t.attributes
  14675. .BANDWIDTH && (r = t.attributes.BANDWIDTH), i - (r = r || n.Number.MAX_VALUE)
  14676. },
  14677. Fh = function(e, t, i) {
  14678. if (!e || !t) return !1;
  14679. var r = i === e.segments.length;
  14680. return e.endList && "open" === t.readyState && r
  14681. },
  14682. jh = function(e) {
  14683. return "number" == typeof e && isFinite(e)
  14684. },
  14685. Hh = function(e) {
  14686. function t(e) {
  14687. Zd(this, t);
  14688. var i = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
  14689. if (!e) throw new TypeError("Initialization settings are required");
  14690. if ("function" != typeof e.currentTime) throw new TypeError("No currentTime getter specified");
  14691. if (!e.mediaSource) throw new TypeError("No MediaSource specified");
  14692. return i.bandwidth = e.bandwidth, i.throughput = {
  14693. rate: 0,
  14694. count: 0
  14695. }, i.roundTrip = NaN, i.resetStats_(), i.mediaIndex = null, i.hasPlayed_ = e.hasPlayed, i.currentTime_ = e
  14696. .currentTime, i.seekable_ = e.seekable, i.seeking_ = e.seeking, i.duration_ = e.duration, i.mediaSource_ = e
  14697. .mediaSource, i.hls_ = e.hls, i.loaderType_ = e.loaderType, i.startingMedia_ = void 0, i
  14698. .segmentMetadataTrack_ = e.segmentMetadataTrack, i.goalBufferLength_ = e.goalBufferLength, i.sourceType_ = e
  14699. .sourceType, i.inbandTextTracks_ = e.inbandTextTracks, i.state_ = "INIT", i.checkBufferTimeout_ = null, i
  14700. .error_ = void 0, i.currentTimeline_ = -1, i.pendingSegment_ = null, i.mimeType_ = null, i.sourceUpdater_ =
  14701. null, i.xhrOptions_ = null, i.activeInitSegmentId_ = null, i.initSegments_ = {}, i.captionParser_ = new ld,
  14702. i.decrypter_ = e.decrypter, i.syncController_ = e.syncController, i.syncPoint_ = {
  14703. segmentIndex: 0,
  14704. time: 0
  14705. }, i.syncController_.on("syncinfoupdate", function() {
  14706. return i.trigger("syncinfoupdate")
  14707. }), i.mediaSource_.addEventListener("sourceopen", function() {
  14708. return i.ended_ = !1
  14709. }), i.fetchAtBuffer_ = !1, i.logger_ = Th("SegmentLoader[" + i.loaderType_ + "]"), Object.defineProperty(i,
  14710. "state", {
  14711. get: function() {
  14712. return this.state_
  14713. },
  14714. set: function(e) {
  14715. e !== this.state_ && (this.logger_(this.state_ + " -> " + e), this.state_ = e)
  14716. }
  14717. }), i
  14718. }
  14719. return ec(t, e), $d(t, [{
  14720. key: "resetStats_",
  14721. value: function() {
  14722. this.mediaBytesTransferred = 0, this.mediaRequests = 0, this.mediaRequestsAborted = 0, this
  14723. .mediaRequestsTimedout = 0, this.mediaRequestsErrored = 0, this.mediaTransferDuration = 0, this
  14724. .mediaSecondsLoaded = 0
  14725. }
  14726. }, {
  14727. key: "dispose",
  14728. value: function() {
  14729. this.state = "DISPOSED", this.pause(), this.abort_(), this.sourceUpdater_ && this.sourceUpdater_
  14730. .dispose(), this.resetStats_(), this.captionParser_.reset()
  14731. }
  14732. }, {
  14733. key: "abort",
  14734. value: function() {
  14735. "WAITING" === this.state ? (this.abort_(), this.state = "READY", this.paused() || this
  14736. .monitorBuffer_()) : this.pendingSegment_ && (this.pendingSegment_ = null)
  14737. }
  14738. }, {
  14739. key: "abort_",
  14740. value: function() {
  14741. this.pendingSegment_ && this.pendingSegment_.abortRequests(), this.pendingSegment_ = null
  14742. }
  14743. }, {
  14744. key: "error",
  14745. value: function(e) {
  14746. return void 0 !== e && (this.error_ = e), this.pendingSegment_ = null, this.error_
  14747. }
  14748. }, {
  14749. key: "endOfStream",
  14750. value: function() {
  14751. this.ended_ = !0, this.pause(), this.trigger("ended")
  14752. }
  14753. }, {
  14754. key: "buffered_",
  14755. value: function() {
  14756. return this.sourceUpdater_ ? this.sourceUpdater_.buffered() : Ta.createTimeRanges()
  14757. }
  14758. }, {
  14759. key: "initSegment",
  14760. value: function(e) {
  14761. var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  14762. if (!e) return null;
  14763. var i = Pc(e),
  14764. r = this.initSegments_[i];
  14765. return t && !r && e.bytes && (this.initSegments_[i] = r = {
  14766. resolvedUri: e.resolvedUri,
  14767. byterange: e.byterange,
  14768. bytes: e.bytes,
  14769. timescales: e.timescales,
  14770. videoTrackIds: e.videoTrackIds
  14771. }), r || e
  14772. }
  14773. }, {
  14774. key: "couldBeginLoading_",
  14775. value: function() {
  14776. return this.playlist_ && (this.sourceUpdater_ || this.mimeType_ && "INIT" === this.state) && !this
  14777. .paused()
  14778. }
  14779. }, {
  14780. key: "load",
  14781. value: function() {
  14782. if (this.monitorBuffer_(), this.playlist_) {
  14783. if (this.syncController_.setDateTimeMapping(this.playlist_), "INIT" === this.state && this
  14784. .couldBeginLoading_()) return this.init_();
  14785. !this.couldBeginLoading_() || "READY" !== this.state && "INIT" !== this.state || (this.state =
  14786. "READY")
  14787. }
  14788. }
  14789. }, {
  14790. key: "init_",
  14791. value: function() {
  14792. return this.state = "READY", this.sourceUpdater_ = new Ah(this.mediaSource_, this.mimeType_, this
  14793. .loaderType_, this.sourceBufferEmitter_), this.resetEverything(), this.monitorBuffer_()
  14794. }
  14795. }, {
  14796. key: "playlist",
  14797. value: function(e) {
  14798. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  14799. if (e) {
  14800. var i = this.playlist_,
  14801. r = this.pendingSegment_;
  14802. this.playlist_ = e, this.xhrOptions_ = t, this.hasPlayed_() || (e.syncInfo = {
  14803. mediaSequence: e.mediaSequence,
  14804. time: 0
  14805. });
  14806. var n = i ? i.id : null;
  14807. if (this.logger_("playlist update [" + n + " => " + e.id + "]"), this.trigger("syncinfoupdate"),
  14808. "INIT" === this.state && this.couldBeginLoading_()) return this.init_();
  14809. if (i && i.uri === e.uri) {
  14810. var a = e.mediaSequence - i.mediaSequence;
  14811. this.logger_("live window shift [" + a + "]"), null !== this.mediaIndex && (this.mediaIndex -=
  14812. a), r && (r.mediaIndex -= a, r.mediaIndex >= 0 && (r.segment = e.segments[r.mediaIndex])),
  14813. this.syncController_.saveExpiredSegmentInfo(i, e)
  14814. } else null !== this.mediaIndex && this.resyncLoader()
  14815. }
  14816. }
  14817. }, {
  14818. key: "pause",
  14819. value: function() {
  14820. this.checkBufferTimeout_ && (n.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ =
  14821. null)
  14822. }
  14823. }, {
  14824. key: "paused",
  14825. value: function() {
  14826. return null === this.checkBufferTimeout_
  14827. }
  14828. }, {
  14829. key: "mimeType",
  14830. value: function(e, t) {
  14831. this.mimeType_ || (this.mimeType_ = e, this.sourceBufferEmitter_ = t, "INIT" === this.state && this
  14832. .couldBeginLoading_() && this.init_())
  14833. }
  14834. }, {
  14835. key: "resetEverything",
  14836. value: function(e) {
  14837. this.ended_ = !1, this.resetLoader(), this.remove(0, this.duration_(), e), this.captionParser_
  14838. .clearAllCaptions(), this.trigger("reseteverything")
  14839. }
  14840. }, {
  14841. key: "resetLoader",
  14842. value: function() {
  14843. this.fetchAtBuffer_ = !1, this.resyncLoader()
  14844. }
  14845. }, {
  14846. key: "resyncLoader",
  14847. value: function() {
  14848. this.mediaIndex = null, this.syncPoint_ = null, this.abort()
  14849. }
  14850. }, {
  14851. key: "remove",
  14852. value: function(e, t, i) {
  14853. if (this.sourceUpdater_ && this.sourceUpdater_.remove(e, t, i), Vc(e, t, this
  14854. .segmentMetadataTrack_), this.inbandTextTracks_)
  14855. for (var r in this.inbandTextTracks_) Vc(e, t, this.inbandTextTracks_[r])
  14856. }
  14857. }, {
  14858. key: "monitorBuffer_",
  14859. value: function() {
  14860. this.checkBufferTimeout_ && n.clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = n
  14861. .setTimeout(this.monitorBufferTick_.bind(this), 1)
  14862. }
  14863. }, {
  14864. key: "monitorBufferTick_",
  14865. value: function() {
  14866. "READY" === this.state && this.fillBuffer_(), this.checkBufferTimeout_ && n.clearTimeout(this
  14867. .checkBufferTimeout_), this.checkBufferTimeout_ = n.setTimeout(this.monitorBufferTick_.bind(
  14868. this), 500)
  14869. }
  14870. }, {
  14871. key: "fillBuffer_",
  14872. value: function() {
  14873. if (!this.sourceUpdater_.updating()) {
  14874. this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this
  14875. .duration_(), this.currentTimeline_, this.currentTime_()));
  14876. var e = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(),
  14877. this.currentTime_(), this.syncPoint_);
  14878. if (e) Fh(this.playlist_, this.mediaSource_, e.mediaIndex) ? this.endOfStream() : (e
  14879. .mediaIndex !== this.playlist_.segments.length - 1 || "ended" !== this.mediaSource_
  14880. .readyState || this.seeking_()) && ((e.timeline !== this.currentTimeline_ || null !== e
  14881. .startOfSegment && e.startOfSegment < this.sourceUpdater_.timestampOffset()) && (this
  14882. .syncController_.reset(), e.timestampOffset = e.startOfSegment, this.captionParser_
  14883. .clearAllCaptions()), this.loadSegment_(e))
  14884. }
  14885. }
  14886. }, {
  14887. key: "checkBuffer_",
  14888. value: function(e, t, i, r, n, a) {
  14889. var s = 0,
  14890. o = void 0;
  14891. e.length && (s = e.end(e.length - 1));
  14892. var u = Math.max(0, s - n);
  14893. if (!t.segments.length) return null;
  14894. if (u >= this.goalBufferLength_()) return null;
  14895. if (!r && u >= 1) return null;
  14896. if (null === a) return i = this.getSyncSegmentCandidate_(t), this.generateSegmentInfo_(t, i, null, !
  14897. 0);
  14898. if (null !== i) {
  14899. var l = t.segments[i];
  14900. return o = l && l.end ? l.end : s, this.generateSegmentInfo_(t, i + 1, o, !1)
  14901. }
  14902. if (this.fetchAtBuffer_) {
  14903. var d = Rc.getMediaInfoForTime(t, s, a.segmentIndex, a.time);
  14904. i = d.mediaIndex, o = d.startTime
  14905. } else {
  14906. var c = Rc.getMediaInfoForTime(t, n, a.segmentIndex, a.time);
  14907. i = c.mediaIndex, o = c.startTime
  14908. }
  14909. return this.generateSegmentInfo_(t, i, o, !1)
  14910. }
  14911. }, {
  14912. key: "getSyncSegmentCandidate_",
  14913. value: function(e) {
  14914. var t = this;
  14915. if (-1 === this.currentTimeline_) return 0;
  14916. var i = e.segments.map(function(e, t) {
  14917. return {
  14918. timeline: e.timeline,
  14919. segmentIndex: t
  14920. }
  14921. }).filter(function(e) {
  14922. return e.timeline === t.currentTimeline_
  14923. });
  14924. return i.length ? i[Math.min(i.length - 1, 1)].segmentIndex : Math.max(e.segments.length - 1, 0)
  14925. }
  14926. }, {
  14927. key: "generateSegmentInfo_",
  14928. value: function(e, t, i, r) {
  14929. if (t < 0 || t >= e.segments.length) return null;
  14930. var n = e.segments[t];
  14931. return {
  14932. requestId: "segment-loader-" + Math.random(),
  14933. uri: n.resolvedUri,
  14934. mediaIndex: t,
  14935. isSyncRequest: r,
  14936. startOfSegment: i,
  14937. playlist: e,
  14938. bytes: null,
  14939. encryptedBytes: null,
  14940. timestampOffset: null,
  14941. timeline: n.timeline,
  14942. duration: n.duration,
  14943. segment: n
  14944. }
  14945. }
  14946. }, {
  14947. key: "abortRequestEarly_",
  14948. value: function(e) {
  14949. if (this.hls_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH)
  14950. return !1;
  14951. if (Date.now() - (e.firstBytesReceivedAt || Date.now()) < 1e3) return !1;
  14952. var t = this.currentTime_(),
  14953. i = e.bandwidth,
  14954. r = this.pendingSegment_.duration,
  14955. n = Rc.estimateSegmentRequestTime(r, i, this.playlist_, e.bytesReceived),
  14956. a = function(e, t) {
  14957. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1;
  14958. return ((e.length ? e.end(e.length - 1) : 0) - t) / i
  14959. }(this.buffered_(), t, this.hls_.tech_.playbackRate()) - 1;
  14960. if (n <= a) return !1;
  14961. var s = function(e) {
  14962. var t = e.master,
  14963. i = e.currentTime,
  14964. r = e.bandwidth,
  14965. n = e.duration,
  14966. a = e.segmentDuration,
  14967. s = e.timeUntilRebuffer,
  14968. o = e.currentTimeline,
  14969. u = e.syncController,
  14970. l = t.playlists.filter(function(e) {
  14971. return !Rc.isIncompatible(e)
  14972. }),
  14973. d = l.filter(Rc.isEnabled);
  14974. d.length || (d = l.filter(function(e) {
  14975. return !Rc.isDisabled(e)
  14976. }));
  14977. var c = d.filter(Rc.hasAttribute.bind(null, "BANDWIDTH")).map(function(e) {
  14978. var t = u.getSyncPoint(e, n, o, i) ? 1 : 2;
  14979. return {
  14980. playlist: e,
  14981. rebufferingImpact: Rc.estimateSegmentRequestTime(a, r, e) * t - s
  14982. }
  14983. }),
  14984. h = c.filter(function(e) {
  14985. return e.rebufferingImpact <= 0
  14986. });
  14987. return Nh(h, function(e, t) {
  14988. return Bh(t.playlist, e.playlist)
  14989. }), h.length ? h[0] : (Nh(c, function(e, t) {
  14990. return e.rebufferingImpact - t.rebufferingImpact
  14991. }), c[0] || null)
  14992. }({
  14993. master: this.hls_.playlists.master,
  14994. currentTime: t,
  14995. bandwidth: i,
  14996. duration: this.duration_(),
  14997. segmentDuration: r,
  14998. timeUntilRebuffer: a,
  14999. currentTimeline: this.currentTimeline_,
  15000. syncController: this.syncController_
  15001. });
  15002. if (s) {
  15003. var o = n - a - s.rebufferingImpact,
  15004. u = .5;
  15005. return a <= 1 / 30 && (u = 1), !s.playlist || s.playlist.uri === this.playlist_.uri || o < u ? !
  15006. 1 : (this.bandwidth = s.playlist.attributes.BANDWIDTH * kh.BANDWIDTH_VARIANCE + 1, this.abort(),
  15007. this.trigger("earlyabort"), !0)
  15008. }
  15009. }
  15010. }, {
  15011. key: "handleProgress_",
  15012. value: function(e, t) {
  15013. this.pendingSegment_ && t.requestId === this.pendingSegment_.requestId && !this.abortRequestEarly_(t
  15014. .stats) && this.trigger("progress")
  15015. }
  15016. }, {
  15017. key: "loadSegment_",
  15018. value: function(e) {
  15019. this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), e.abortRequests = Ph(this
  15020. .hls_.xhr, this.xhrOptions_, this.decrypter_, this.captionParser_, this
  15021. .createSimplifiedSegmentObj_(e), this.handleProgress_.bind(this), this.segmentRequestFinished_
  15022. .bind(this))
  15023. }
  15024. }, {
  15025. key: "trimBackBuffer_",
  15026. value: function(e) {
  15027. var t = function(e, t, i) {
  15028. var r = void 0;
  15029. return r = e.length && e.start(0) > 0 && e.start(0) < t ? e.start(0) : t - 30, Math.min(r, t -
  15030. i)
  15031. }(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  15032. t > 0 && this.remove(0, t)
  15033. }
  15034. }, {
  15035. key: "createSimplifiedSegmentObj_",
  15036. value: function(e) {
  15037. var t = e.segment,
  15038. i = {
  15039. resolvedUri: t.resolvedUri,
  15040. byterange: t.byterange,
  15041. requestId: e.requestId
  15042. };
  15043. if (t.key) {
  15044. var r = t.key.iv || new Uint32Array([0, 0, 0, e.mediaIndex + e.playlist.mediaSequence]);
  15045. i.key = {
  15046. resolvedUri: t.key.resolvedUri,
  15047. iv: r
  15048. }
  15049. }
  15050. return t.map && (i.map = this.initSegment(t.map)), i
  15051. }
  15052. }, {
  15053. key: "segmentRequestFinished_",
  15054. value: function(e, t) {
  15055. if (this.mediaRequests += 1, t.stats && (this.mediaBytesTransferred += t.stats.bytesReceived, this
  15056. .mediaTransferDuration += t.stats.roundTripTime), this.pendingSegment_) {
  15057. if (t.requestId === this.pendingSegment_.requestId) {
  15058. if (e) return this.pendingSegment_ = null, this.state = "READY", e.code === Oh ? void(this
  15059. .mediaRequestsAborted += 1) : (this.pause(), e.code === Mh ? (this
  15060. .mediaRequestsTimedout += 1, this.bandwidth = 1, this.roundTrip = NaN, void this
  15061. .trigger("bandwidthupdate")) : (this.mediaRequestsErrored += 1, this.error(e), void this
  15062. .trigger("error")));
  15063. this.bandwidth = t.stats.bandwidth, this.roundTrip = t.stats.roundTripTime, t.map && (t.map =
  15064. this.initSegment(t.map, !0)), this.processSegmentResponse_(t)
  15065. }
  15066. } else this.mediaRequestsAborted += 1
  15067. }
  15068. }, {
  15069. key: "processSegmentResponse_",
  15070. value: function(e) {
  15071. var t = this.pendingSegment_;
  15072. t.bytes = e.bytes, e.map && (t.segment.map.bytes = e.map.bytes), t.endOfAllRequests = e
  15073. .endOfAllRequests, e.fmp4Captions && (! function(e, t, i) {
  15074. for (var r in i)
  15075. if (!e[r]) {
  15076. t.trigger({
  15077. type: "usage",
  15078. name: "hls-608"
  15079. });
  15080. var n = t.textTracks().getTrackById(r);
  15081. e[r] = n || t.addRemoteTextTrack({
  15082. kind: "captions",
  15083. id: r,
  15084. label: r
  15085. }, !1).track
  15086. }
  15087. }(this.inbandTextTracks_, this.hls_.tech_, e.captionStreams), function(e) {
  15088. var t = e.inbandTextTracks,
  15089. i = e.captionArray,
  15090. r = e.timestampOffset;
  15091. if (i) {
  15092. var n = window.WebKitDataCue || window.VTTCue;
  15093. i.forEach(function(e) {
  15094. var i = e.stream,
  15095. a = e.startTime,
  15096. s = e.endTime;
  15097. t[i] && (a += r, s += r, t[i].addCue(new n(a, s, e.text)))
  15098. })
  15099. }
  15100. }({
  15101. inbandTextTracks: this.inbandTextTracks_,
  15102. captionArray: e.fmp4Captions,
  15103. timestampOffset: 0
  15104. }), this.captionParser_.clearParsedCaptions()), this.handleSegment_()
  15105. }
  15106. }, {
  15107. key: "handleSegment_",
  15108. value: function() {
  15109. var e = this;
  15110. if (this.pendingSegment_) {
  15111. var t = this.pendingSegment_,
  15112. i = t.segment,
  15113. r = this.syncController_.probeSegmentInfo(t);
  15114. void 0 === this.startingMedia_ && r && (r.containsAudio || r.containsVideo) && (this
  15115. .startingMedia_ = {
  15116. containsAudio: r.containsAudio,
  15117. containsVideo: r.containsVideo
  15118. });
  15119. var n, a, s, o = (n = this.loaderType_, a = this.startingMedia_, s = r, "main" === n && a && s ? s
  15120. .containsAudio || s.containsVideo ? a.containsVideo && !s.containsVideo ?
  15121. "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest." :
  15122. !a.containsVideo && s.containsVideo ?
  15123. "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest." :
  15124. null : "Neither audio nor video found in segment." : null);
  15125. if (o) return this.error({
  15126. message: o,
  15127. blacklistDuration: 1 / 0
  15128. }), void this.trigger("error");
  15129. if (t.isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ = null, void(this
  15130. .state = "READY");
  15131. null !== t.timestampOffset && t.timestampOffset !== this.sourceUpdater_.timestampOffset() && (this
  15132. .sourceUpdater_.timestampOffset(t.timestampOffset), this.trigger("timestampoffset"));
  15133. var u = this.syncController_.mappingForTimeline(t.timeline);
  15134. if (null !== u && this.trigger({
  15135. type: "segmenttimemapping",
  15136. mapping: u
  15137. }), this.state = "APPENDING", i.map) {
  15138. var l = Pc(i.map);
  15139. if (!this.activeInitSegmentId_ || this.activeInitSegmentId_ !== l) {
  15140. var d = this.initSegment(i.map);
  15141. this.sourceUpdater_.appendBuffer(d.bytes, function() {
  15142. e.activeInitSegmentId_ = l
  15143. })
  15144. }
  15145. }
  15146. t.byteLength = t.bytes.byteLength, "number" == typeof i.start && "number" == typeof i.end ? this
  15147. .mediaSecondsLoaded += i.end - i.start : this.mediaSecondsLoaded += i.duration, this.logger_(
  15148. function(e) {
  15149. var t = e.segment,
  15150. i = t.start,
  15151. r = t.end,
  15152. n = e.playlist,
  15153. a = n.mediaSequence,
  15154. s = n.id,
  15155. o = n.segments,
  15156. u = void 0 === o ? [] : o,
  15157. l = e.mediaIndex,
  15158. d = e.timeline;
  15159. return ["appending [" + l + "] of [" + a + ", " + (a + u.length) + "] from playlist [" + s +
  15160. "]", "[" + i + " => " + r + "] in timeline [" + d + "]"
  15161. ].join(" ")
  15162. }(t)), this.sourceUpdater_.appendBuffer(t.bytes, this.handleUpdateEnd_.bind(this))
  15163. } else this.state = "READY"
  15164. }
  15165. }, {
  15166. key: "handleUpdateEnd_",
  15167. value: function() {
  15168. if (!this.pendingSegment_) return this.state = "READY", void(this.paused() || this
  15169. .monitorBuffer_());
  15170. var e = this.pendingSegment_,
  15171. t = e.segment,
  15172. i = null !== this.mediaIndex;
  15173. (this.pendingSegment_ = null, this.recordThroughput_(e), this.addSegmentMetadataCue_(e), this
  15174. .state = "READY", this.mediaIndex = e.mediaIndex, this.fetchAtBuffer_ = !0, this
  15175. .currentTimeline_ = e.timeline, this.trigger("syncinfoupdate"), t.end && this.currentTime_() - t
  15176. .end > 3 * e.playlist.targetDuration) ? this.resetEverything(): (i && this.trigger(
  15177. "bandwidthupdate"), this.trigger("progress"), Fh(e.playlist, this.mediaSource_, e.mediaIndex +
  15178. 1) && this.endOfStream(), this.paused() || this.monitorBuffer_())
  15179. }
  15180. }, {
  15181. key: "recordThroughput_",
  15182. value: function(e) {
  15183. var t = this.throughput.rate,
  15184. i = Date.now() - e.endOfAllRequests + 1,
  15185. r = Math.floor(e.byteLength / i * 8 * 1e3);
  15186. this.throughput.rate += (r - t) / ++this.throughput.count
  15187. }
  15188. }, {
  15189. key: "addSegmentMetadataCue_",
  15190. value: function(e) {
  15191. if (this.segmentMetadataTrack_) {
  15192. var t = e.segment,
  15193. i = t.start,
  15194. r = t.end;
  15195. if (jh(i) && jh(r)) {
  15196. Vc(i, r, this.segmentMetadataTrack_);
  15197. var a = n.WebKitDataCue || n.VTTCue,
  15198. s = {
  15199. bandwidth: e.playlist.attributes.BANDWIDTH,
  15200. resolution: e.playlist.attributes.RESOLUTION,
  15201. codecs: e.playlist.attributes.CODECS,
  15202. byteLength: e.byteLength,
  15203. uri: e.uri,
  15204. timeline: e.timeline,
  15205. playlist: e.playlist.uri,
  15206. start: i,
  15207. end: r
  15208. },
  15209. o = new a(i, r, JSON.stringify(s));
  15210. o.value = s, this.segmentMetadataTrack_.addCue(o)
  15211. }
  15212. }
  15213. }
  15214. }]), t
  15215. }(Ta.EventTarget),
  15216. Gh = function(e) {
  15217. return decodeURIComponent(escape(String.fromCharCode.apply(null, e)))
  15218. },
  15219. Vh = new Uint8Array("\n\n".split("").map(function(e) {
  15220. return e.charCodeAt(0)
  15221. })),
  15222. Wh = function(e) {
  15223. function t(e) {
  15224. var i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
  15225. Zd(this, t);
  15226. var r = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, i));
  15227. return r.mediaSource_ = null, r.subtitlesTrack_ = null, r
  15228. }
  15229. return ec(t, Hh), $d(t, [{
  15230. key: "buffered_",
  15231. value: function() {
  15232. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length) return Ta.createTimeRanges();
  15233. var e = this.subtitlesTrack_.cues,
  15234. t = e[0].startTime,
  15235. i = e[e.length - 1].startTime;
  15236. return Ta.createTimeRanges([
  15237. [t, i]
  15238. ])
  15239. }
  15240. }, {
  15241. key: "initSegment",
  15242. value: function(e) {
  15243. var t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
  15244. if (!e) return null;
  15245. var i = Pc(e),
  15246. r = this.initSegments_[i];
  15247. if (t && !r && e.bytes) {
  15248. var n = Vh.byteLength + e.bytes.byteLength,
  15249. a = new Uint8Array(n);
  15250. a.set(e.bytes), a.set(Vh, e.bytes.byteLength), this.initSegments_[i] = r = {
  15251. resolvedUri: e.resolvedUri,
  15252. byterange: e.byterange,
  15253. bytes: a
  15254. }
  15255. }
  15256. return r || e
  15257. }
  15258. }, {
  15259. key: "couldBeginLoading_",
  15260. value: function() {
  15261. return this.playlist_ && this.subtitlesTrack_ && !this.paused()
  15262. }
  15263. }, {
  15264. key: "init_",
  15265. value: function() {
  15266. return this.state = "READY", this.resetEverything(), this.monitorBuffer_()
  15267. }
  15268. }, {
  15269. key: "track",
  15270. value: function(e) {
  15271. return void 0 === e ? this.subtitlesTrack_ : (this.subtitlesTrack_ = e, "INIT" === this.state &&
  15272. this.couldBeginLoading_() && this.init_(), this.subtitlesTrack_)
  15273. }
  15274. }, {
  15275. key: "remove",
  15276. value: function(e, t) {
  15277. Vc(e, t, this.subtitlesTrack_)
  15278. }
  15279. }, {
  15280. key: "fillBuffer_",
  15281. value: function() {
  15282. var e = this;
  15283. this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this.playlist_, this
  15284. .duration_(), this.currentTimeline_, this.currentTime_()));
  15285. var t = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this.hasPlayed_(), this
  15286. .currentTime_(), this.syncPoint_);
  15287. if (t = this.skipEmptySegments_(t)) {
  15288. if (null === this.syncController_.timestampOffsetForTimeline(t.timeline)) {
  15289. return this.syncController_.one("timestampoffset", function() {
  15290. e.state = "READY", e.paused() || e.monitorBuffer_()
  15291. }), void(this.state = "WAITING_ON_TIMELINE")
  15292. }
  15293. this.loadSegment_(t)
  15294. }
  15295. }
  15296. }, {
  15297. key: "skipEmptySegments_",
  15298. value: function(e) {
  15299. for (; e && e.segment.empty;) e = this.generateSegmentInfo_(e.playlist, e.mediaIndex + 1, e
  15300. .startOfSegment + e.duration, e.isSyncRequest);
  15301. return e
  15302. }
  15303. }, {
  15304. key: "handleSegment_",
  15305. value: function() {
  15306. var e = this;
  15307. if (this.pendingSegment_ && this.subtitlesTrack_) {
  15308. this.state = "APPENDING";
  15309. var t = this.pendingSegment_,
  15310. i = t.segment;
  15311. if ("function" != typeof n.WebVTT && this.subtitlesTrack_ && this.subtitlesTrack_.tech_) {
  15312. var r = function() {
  15313. e.handleSegment_()
  15314. };
  15315. return this.state = "WAITING_ON_VTTJS", this.subtitlesTrack_.tech_.one("vttjsloaded", r),
  15316. void this.subtitlesTrack_.tech_.one("vttjserror", function() {
  15317. e.subtitlesTrack_.tech_.off("vttjsloaded", r), e.error({
  15318. message: "Error loading vtt.js"
  15319. }), e.state = "READY", e.pause(), e.trigger("error")
  15320. })
  15321. }
  15322. i.requested = !0;
  15323. try {
  15324. this.parseVTTCues_(t)
  15325. } catch (e) {
  15326. return this.error({
  15327. message: e.message
  15328. }), this.state = "READY", this.pause(), this.trigger("error")
  15329. }
  15330. if (this.updateTimeMapping_(t, this.syncController_.timelines[t.timeline], this.playlist_), t
  15331. .isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ = null, void(this
  15332. .state = "READY");
  15333. t.byteLength = t.bytes.byteLength, this.mediaSecondsLoaded += i.duration, t.cues.length && this
  15334. .remove(t.cues[0].endTime, t.cues[t.cues.length - 1].endTime), t.cues.forEach(function(t) {
  15335. e.subtitlesTrack_.addCue(t)
  15336. }), this.handleUpdateEnd_()
  15337. } else this.state = "READY"
  15338. }
  15339. }, {
  15340. key: "parseVTTCues_",
  15341. value: function(e) {
  15342. var t = void 0,
  15343. i = !1;
  15344. "function" == typeof n.TextDecoder ? t = new n.TextDecoder("utf8") : (t = n.WebVTT.StringDecoder(),
  15345. i = !0);
  15346. var r = new n.WebVTT.Parser(n, n.vttjs, t);
  15347. if (e.cues = [], e.timestampmap = {
  15348. MPEGTS: 0,
  15349. LOCAL: 0
  15350. }, r.oncue = e.cues.push.bind(e.cues), r.ontimestampmap = function(t) {
  15351. return e.timestampmap = t
  15352. }, r.onparsingerror = function(e) {
  15353. Ta.log.warn("Error encountered when parsing cues: " + e.message)
  15354. }, e.segment.map) {
  15355. var a = e.segment.map.bytes;
  15356. i && (a = Gh(a)), r.parse(a)
  15357. }
  15358. var s = e.bytes;
  15359. i && (s = Gh(s)), r.parse(s), r.flush()
  15360. }
  15361. }, {
  15362. key: "updateTimeMapping_",
  15363. value: function(e, t, i) {
  15364. var r = e.segment;
  15365. if (t)
  15366. if (e.cues.length) {
  15367. var n = e.timestampmap,
  15368. a = n.MPEGTS / 9e4 - n.LOCAL + t.mapping;
  15369. if (e.cues.forEach(function(e) {
  15370. e.startTime += a, e.endTime += a
  15371. }), !i.syncInfo) {
  15372. var s = e.cues[0].startTime,
  15373. o = e.cues[e.cues.length - 1].startTime;
  15374. i.syncInfo = {
  15375. mediaSequence: i.mediaSequence + e.mediaIndex,
  15376. time: Math.min(s, o - r.duration)
  15377. }
  15378. }
  15379. } else r.empty = !0
  15380. }
  15381. }]), t
  15382. }(),
  15383. qh = function(e, t) {
  15384. for (var i = e.cues, r = 0; r < i.length; r++) {
  15385. var n = i[r];
  15386. if (t >= n.adStartTime && t <= n.adEndTime) return n
  15387. }
  15388. return null
  15389. },
  15390. Xh = Fd,
  15391. zh = [{
  15392. name: "VOD",
  15393. run: function(e, t, i, r, n) {
  15394. if (i !== 1 / 0) {
  15395. return {
  15396. time: 0,
  15397. segmentIndex: 0
  15398. }
  15399. }
  15400. return null
  15401. }
  15402. }, {
  15403. name: "ProgramDateTime",
  15404. run: function(e, t, i, r, n) {
  15405. if (!e.datetimeToDisplayTime) return null;
  15406. var a = t.segments || [],
  15407. s = null,
  15408. o = null;
  15409. n = n || 0;
  15410. for (var u = 0; u < a.length; u++) {
  15411. var l = a[u];
  15412. if (l.dateTimeObject) {
  15413. var d = l.dateTimeObject.getTime() / 1e3 + e.datetimeToDisplayTime,
  15414. c = Math.abs(n - d);
  15415. if (null !== o && o < c) break;
  15416. o = c, s = {
  15417. time: d,
  15418. segmentIndex: u
  15419. }
  15420. }
  15421. }
  15422. return s
  15423. }
  15424. }, {
  15425. name: "Segment",
  15426. run: function(e, t, i, r, n) {
  15427. var a = t.segments || [],
  15428. s = null,
  15429. o = null;
  15430. n = n || 0;
  15431. for (var u = 0; u < a.length; u++) {
  15432. var l = a[u];
  15433. if (l.timeline === r && void 0 !== l.start) {
  15434. var d = Math.abs(n - l.start);
  15435. if (null !== o && o < d) break;
  15436. (!s || null === o || o >= d) && (o = d, s = {
  15437. time: l.start,
  15438. segmentIndex: u
  15439. })
  15440. }
  15441. }
  15442. return s
  15443. }
  15444. }, {
  15445. name: "Discontinuity",
  15446. run: function(e, t, i, r, n) {
  15447. var a = null;
  15448. if (n = n || 0, t.discontinuityStarts && t.discontinuityStarts.length)
  15449. for (var s = null, o = 0; o < t.discontinuityStarts.length; o++) {
  15450. var u = t.discontinuityStarts[o],
  15451. l = t.discontinuitySequence + o + 1,
  15452. d = e.discontinuities[l];
  15453. if (d) {
  15454. var c = Math.abs(n - d.time);
  15455. if (null !== s && s < c) break;
  15456. (!a || null === s || s >= c) && (s = c, a = {
  15457. time: d.time,
  15458. segmentIndex: u
  15459. })
  15460. }
  15461. }
  15462. return a
  15463. }
  15464. }, {
  15465. name: "Playlist",
  15466. run: function(e, t, i, r, n) {
  15467. return t.syncInfo ? {
  15468. time: t.syncInfo.time,
  15469. segmentIndex: t.syncInfo.mediaSequence - t.mediaSequence
  15470. } : null
  15471. }
  15472. }],
  15473. Kh = function(e) {
  15474. function t() {
  15475. Zd(this, t);
  15476. var e = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
  15477. return e.inspectCache_ = void 0, e.timelines = [], e.discontinuities = [], e.datetimeToDisplayTime = null, e
  15478. .logger_ = Th("SyncController"), e
  15479. }
  15480. return ec(t, e), $d(t, [{
  15481. key: "getSyncPoint",
  15482. value: function(e, t, i, r) {
  15483. var n = this.runStrategies_(e, t, i, r);
  15484. return n.length ? this.selectSyncPoint_(n, {
  15485. key: "time",
  15486. value: r
  15487. }) : null
  15488. }
  15489. }, {
  15490. key: "getExpiredTime",
  15491. value: function(e, t) {
  15492. if (!e || !e.segments) return null;
  15493. var i = this.runStrategies_(e, t, e.discontinuitySequence, 0);
  15494. if (!i.length) return null;
  15495. var r = this.selectSyncPoint_(i, {
  15496. key: "segmentIndex",
  15497. value: 0
  15498. });
  15499. return r.segmentIndex > 0 && (r.time *= -1), Math.abs(r.time + mc(e, r.segmentIndex, 0))
  15500. }
  15501. }, {
  15502. key: "runStrategies_",
  15503. value: function(e, t, i, r) {
  15504. for (var n = [], a = 0; a < zh.length; a++) {
  15505. var s = zh[a],
  15506. o = s.run(this, e, t, i, r);
  15507. o && (o.strategy = s.name, n.push({
  15508. strategy: s.name,
  15509. syncPoint: o
  15510. }))
  15511. }
  15512. return n
  15513. }
  15514. }, {
  15515. key: "selectSyncPoint_",
  15516. value: function(e, t) {
  15517. for (var i = e[0].syncPoint, r = Math.abs(e[0].syncPoint[t.key] - t.value), n = e[0].strategy, a =
  15518. 1; a < e.length; a++) {
  15519. var s = Math.abs(e[a].syncPoint[t.key] - t.value);
  15520. s < r && (r = s, i = e[a].syncPoint, n = e[a].strategy)
  15521. }
  15522. return this.logger_("syncPoint for [" + t.key + ": " + t.value + "] chosen with strategy [" + n +
  15523. "]: [time:" + i.time + ", segmentIndex:" + i.segmentIndex + "]"), i
  15524. }
  15525. }, {
  15526. key: "saveExpiredSegmentInfo",
  15527. value: function(e, t) {
  15528. for (var i = t.mediaSequence - e.mediaSequence - 1; i >= 0; i--) {
  15529. var r = e.segments[i];
  15530. if (r && void 0 !== r.start) {
  15531. t.syncInfo = {
  15532. mediaSequence: e.mediaSequence + i,
  15533. time: r.start
  15534. }, this.logger_("playlist refresh sync: [time:" + t.syncInfo.time + ", mediaSequence: " + t
  15535. .syncInfo.mediaSequence + "]"), this.trigger("syncinfoupdate");
  15536. break
  15537. }
  15538. }
  15539. }
  15540. }, {
  15541. key: "setDateTimeMapping",
  15542. value: function(e) {
  15543. if (!this.datetimeToDisplayTime && e.segments && e.segments.length && e.segments[0]
  15544. .dateTimeObject) {
  15545. var t = e.segments[0].dateTimeObject.getTime() / 1e3;
  15546. this.datetimeToDisplayTime = -t
  15547. }
  15548. }
  15549. }, {
  15550. key: "reset",
  15551. value: function() {
  15552. this.inspectCache_ = void 0
  15553. }
  15554. }, {
  15555. key: "probeSegmentInfo",
  15556. value: function(e) {
  15557. var t = e.segment,
  15558. i = e.playlist,
  15559. r = void 0;
  15560. return (r = t.map ? this.probeMp4Segment_(e) : this.probeTsSegment_(e)) && this
  15561. .calculateSegmentTimeMapping_(e, r) && (this.saveDiscontinuitySyncInfo_(e), i.syncInfo || (i
  15562. .syncInfo = {
  15563. mediaSequence: i.mediaSequence + e.mediaIndex,
  15564. time: t.start
  15565. })), r
  15566. }
  15567. }, {
  15568. key: "probeMp4Segment_",
  15569. value: function(e) {
  15570. var t = e.segment,
  15571. i = fo.timescale(t.map.bytes),
  15572. r = fo.startTime(i, e.bytes);
  15573. return null !== e.timestampOffset && (e.timestampOffset -= r), {
  15574. start: r,
  15575. end: r + t.duration
  15576. }
  15577. }
  15578. }, {
  15579. key: "probeTsSegment_",
  15580. value: function(e) {
  15581. var t = Xh(e.bytes, this.inspectCache_),
  15582. i = void 0,
  15583. r = void 0;
  15584. return t ? (t.video && 2 === t.video.length ? (this.inspectCache_ = t.video[1].dts, i = t.video[0]
  15585. .dtsTime, r = t.video[1].dtsTime) : t.audio && 2 === t.audio.length && (this.inspectCache_ = t
  15586. .audio[1].dts, i = t.audio[0].dtsTime, r = t.audio[1].dtsTime), {
  15587. start: i,
  15588. end: r,
  15589. containsVideo: t.video && 2 === t.video.length,
  15590. containsAudio: t.audio && 2 === t.audio.length
  15591. }) : null
  15592. }
  15593. }, {
  15594. key: "timestampOffsetForTimeline",
  15595. value: function(e) {
  15596. return void 0 === this.timelines[e] ? null : this.timelines[e].time
  15597. }
  15598. }, {
  15599. key: "mappingForTimeline",
  15600. value: function(e) {
  15601. return void 0 === this.timelines[e] ? null : this.timelines[e].mapping
  15602. }
  15603. }, {
  15604. key: "calculateSegmentTimeMapping_",
  15605. value: function(e, t) {
  15606. var i = e.segment,
  15607. r = this.timelines[e.timeline];
  15608. if (null !== e.timestampOffset) r = {
  15609. time: e.startOfSegment,
  15610. mapping: e.startOfSegment - t.start
  15611. }, this.timelines[e.timeline] = r, this.trigger("timestampoffset"), this.logger_(
  15612. "time mapping for timeline " + e.timeline + ": [time: " + r.time + "] [mapping: " + r.mapping +
  15613. "]"), i.start = e.startOfSegment, i.end = t.end + r.mapping;
  15614. else {
  15615. if (!r) return !1;
  15616. i.start = t.start + r.mapping, i.end = t.end + r.mapping
  15617. }
  15618. return !0
  15619. }
  15620. }, {
  15621. key: "saveDiscontinuitySyncInfo_",
  15622. value: function(e) {
  15623. var t = e.playlist,
  15624. i = e.segment;
  15625. if (i.discontinuity) this.discontinuities[i.timeline] = {
  15626. time: i.start,
  15627. accuracy: 0
  15628. };
  15629. else if (t.discontinuityStarts && t.discontinuityStarts.length)
  15630. for (var r = 0; r < t.discontinuityStarts.length; r++) {
  15631. var n = t.discontinuityStarts[r],
  15632. a = t.discontinuitySequence + r + 1,
  15633. s = n - e.mediaIndex,
  15634. o = Math.abs(s);
  15635. if (!this.discontinuities[a] || this.discontinuities[a].accuracy > o) {
  15636. var u = void 0;
  15637. u = s < 0 ? i.start - mc(t, e.mediaIndex, n) : i.end + mc(t, e.mediaIndex + 1, n), this
  15638. .discontinuities[a] = {
  15639. time: u,
  15640. accuracy: o
  15641. }
  15642. }
  15643. }
  15644. }
  15645. }]), t
  15646. }(Ta.EventTarget),
  15647. Yh = new Zc("./decrypter-worker.worker.js", function(e, t) {
  15648. var i = this;
  15649. ! function() {
  15650. var e = function(e, t) {
  15651. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  15652. },
  15653. t = function() {
  15654. function e(e, t) {
  15655. for (var i = 0; i < t.length; i++) {
  15656. var r = t[i];
  15657. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  15658. .defineProperty(e, r.key, r)
  15659. }
  15660. }
  15661. return function(t, i, r) {
  15662. return i && e(t.prototype, i), r && e(t, r), t
  15663. }
  15664. }(),
  15665. r = function(e, t) {
  15666. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  15667. return !t || "object" !== (void 0 === t ? "undefined" : v(t)) && "function" != typeof t ? e : t
  15668. },
  15669. n = function() {
  15670. var e = [
  15671. [
  15672. [],
  15673. [],
  15674. [],
  15675. [],
  15676. []
  15677. ],
  15678. [
  15679. [],
  15680. [],
  15681. [],
  15682. [],
  15683. []
  15684. ]
  15685. ],
  15686. t = e[0],
  15687. i = e[1],
  15688. r = t[4],
  15689. n = i[4],
  15690. a = void 0,
  15691. s = void 0,
  15692. o = void 0,
  15693. u = [],
  15694. l = [],
  15695. d = void 0,
  15696. c = void 0,
  15697. h = void 0,
  15698. f = void 0,
  15699. p = void 0;
  15700. for (a = 0; a < 256; a++) l[(u[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a;
  15701. for (s = o = 0; !r[s]; s ^= d || 1, o = l[o] || 1)
  15702. for (h = (h = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4) >> 8 ^ 255 & h ^ 99, r[s] = h, n[h] = s, p =
  15703. 16843009 * u[c = u[d = u[s]]] ^ 65537 * c ^ 257 * d ^ 16843008 * s, f = 257 * u[h] ^ 16843008 * h,
  15704. a = 0; a < 4; a++) t[a][s] = f = f << 24 ^ f >>> 8, i[a][h] = p = p << 24 ^ p >>> 8;
  15705. for (a = 0; a < 5; a++) t[a] = t[a].slice(0), i[a] = i[a].slice(0);
  15706. return e
  15707. },
  15708. a = null,
  15709. s = function() {
  15710. function t(i) {
  15711. e(this, t), a || (a = n()), this._tables = [
  15712. [a[0][0].slice(), a[0][1].slice(), a[0][2].slice(), a[0][3].slice(), a[0][4].slice()],
  15713. [a[1][0].slice(), a[1][1].slice(), a[1][2].slice(), a[1][3].slice(), a[1][4].slice()]
  15714. ];
  15715. var r = void 0,
  15716. s = void 0,
  15717. o = void 0,
  15718. u = void 0,
  15719. l = void 0,
  15720. d = this._tables[0][4],
  15721. c = this._tables[1],
  15722. h = i.length,
  15723. f = 1;
  15724. if (4 !== h && 6 !== h && 8 !== h) throw new Error("Invalid aes key size");
  15725. for (u = i.slice(0), l = [], this._key = [u, l], r = h; r < 4 * h + 28; r++) o = u[r - 1], (r % h ==
  15726. 0 || 8 === h && r % h == 4) && (o = d[o >>> 24] << 24 ^ d[o >> 16 & 255] << 16 ^ d[o >> 8 &
  15727. 255] << 8 ^ d[255 & o], r % h == 0 && (o = o << 8 ^ o >>> 24 ^ f << 24, f = f << 1 ^ 283 * (f >>
  15728. 7))), u[r] = u[r - h] ^ o;
  15729. for (s = 0; r; s++, r--) o = u[3 & s ? r : r - 4], l[s] = r <= 4 || s < 4 ? o : c[0][d[o >>> 24]] ^ c[
  15730. 1][d[o >> 16 & 255]] ^ c[2][d[o >> 8 & 255]] ^ c[3][d[255 & o]]
  15731. }
  15732. return t.prototype.decrypt = function(e, t, i, r, n, a) {
  15733. var s = this._key[1],
  15734. o = e ^ s[0],
  15735. u = r ^ s[1],
  15736. l = i ^ s[2],
  15737. d = t ^ s[3],
  15738. c = void 0,
  15739. h = void 0,
  15740. f = void 0,
  15741. p = s.length / 4 - 2,
  15742. m = void 0,
  15743. g = 4,
  15744. v = this._tables[1],
  15745. y = v[0],
  15746. _ = v[1],
  15747. b = v[2],
  15748. w = v[3],
  15749. E = v[4];
  15750. for (m = 0; m < p; m++) c = y[o >>> 24] ^ _[u >> 16 & 255] ^ b[l >> 8 & 255] ^ w[255 & d] ^ s[g],
  15751. h = y[u >>> 24] ^ _[l >> 16 & 255] ^ b[d >> 8 & 255] ^ w[255 & o] ^ s[g + 1], f = y[l >>> 24] ^ _[
  15752. d >> 16 & 255] ^ b[o >> 8 & 255] ^ w[255 & u] ^ s[g + 2], d = y[d >>> 24] ^ _[o >> 16 & 255] ^
  15753. b[u >> 8 & 255] ^ w[255 & l] ^ s[g + 3], g += 4, o = c, u = h, l = f;
  15754. for (m = 0; m < 4; m++) n[(3 & -m) + a] = E[o >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^ E[l >> 8 &
  15755. 255] << 8 ^ E[255 & d] ^ s[g++], c = o, o = u, u = l, l = d, d = c
  15756. }, t
  15757. }(),
  15758. o = function() {
  15759. function t() {
  15760. e(this, t), this.listeners = {}
  15761. }
  15762. return t.prototype.on = function(e, t) {
  15763. this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
  15764. }, t.prototype.off = function(e, t) {
  15765. if (!this.listeners[e]) return !1;
  15766. var i = this.listeners[e].indexOf(t);
  15767. return this.listeners[e].splice(i, 1), i > -1
  15768. }, t.prototype.trigger = function(e) {
  15769. var t = this.listeners[e];
  15770. if (t)
  15771. if (2 === arguments.length)
  15772. for (var i = t.length, r = 0; r < i; ++r) t[r].call(this, arguments[1]);
  15773. else
  15774. for (var n = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s]
  15775. .apply(this, n)
  15776. }, t.prototype.dispose = function() {
  15777. this.listeners = {}
  15778. }, t.prototype.pipe = function(e) {
  15779. this.on("data", function(t) {
  15780. e.push(t)
  15781. })
  15782. }, t
  15783. }(),
  15784. u = function(t) {
  15785. function i() {
  15786. e(this, i);
  15787. var n = r(this, t.call(this, o));
  15788. return n.jobs = [], n.delay = 1, n.timeout_ = null, n
  15789. }
  15790. return function(e, t) {
  15791. if ("function" != typeof t && null !== t) throw new TypeError(
  15792. "Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : v(
  15793. t)));
  15794. e.prototype = Object.create(t && t.prototype, {
  15795. constructor: {
  15796. value: e,
  15797. enumerable: !1,
  15798. writable: !0,
  15799. configurable: !0
  15800. }
  15801. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  15802. }(i, t), i.prototype.processJob_ = function() {
  15803. this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_.bind(this), this
  15804. .delay) : this.timeout_ = null
  15805. }, i.prototype.push = function(e) {
  15806. this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(this), this
  15807. .delay))
  15808. }, i
  15809. }(o),
  15810. l = function(e) {
  15811. return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
  15812. },
  15813. d = function() {
  15814. function i(t, r, n, a) {
  15815. e(this, i);
  15816. var s = i.STEP,
  15817. o = new Int32Array(t.buffer),
  15818. d = new Uint8Array(t.byteLength),
  15819. c = 0;
  15820. for (this.asyncStream_ = new u, this.asyncStream_.push(this.decryptChunk_(o.subarray(c, c + s), r, n,
  15821. d)), c = s; c < o.length; c += s) n = new Uint32Array([l(o[c - 4]), l(o[c - 3]), l(o[c - 2]), l(o[
  15822. c - 1])]), this.asyncStream_.push(this.decryptChunk_(o.subarray(c, c + s), r, n, d));
  15823. this.asyncStream_.push(function() {
  15824. var e;
  15825. a(null, (e = d).subarray(0, e.byteLength - e[e.byteLength - 1]))
  15826. })
  15827. }
  15828. return i.prototype.decryptChunk_ = function(e, t, i, r) {
  15829. return function() {
  15830. var n = function(e, t, i) {
  15831. var r = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2),
  15832. n = new s(Array.prototype.slice.call(t)),
  15833. a = new Uint8Array(e.byteLength),
  15834. o = new Int32Array(a.buffer),
  15835. u = void 0,
  15836. d = void 0,
  15837. c = void 0,
  15838. h = void 0,
  15839. f = void 0,
  15840. p = void 0,
  15841. m = void 0,
  15842. g = void 0,
  15843. v = void 0;
  15844. for (u = i[0], d = i[1], c = i[2], h = i[3], v = 0; v < r.length; v += 4) f = l(r[v]), p =
  15845. l(r[v + 1]), m = l(r[v + 2]), g = l(r[v + 3]), n.decrypt(f, p, m, g, o, v), o[v] = l(o[
  15846. v] ^ u), o[v + 1] = l(o[v + 1] ^ d), o[v + 2] = l(o[v + 2] ^ c), o[v + 3] = l(o[v + 3] ^
  15847. h), u = f, d = p, c = m, h = g;
  15848. return a
  15849. }(e, t, i);
  15850. r.set(n, e.byteOffset)
  15851. }
  15852. }, t(i, null, [{
  15853. key: "STEP",
  15854. get: function() {
  15855. return 32e3
  15856. }
  15857. }]), i
  15858. }();
  15859. new function(e) {
  15860. e.onmessage = function(t) {
  15861. var i = t.data,
  15862. r = new Uint8Array(i.encrypted.bytes, i.encrypted.byteOffset, i.encrypted.byteLength),
  15863. n = new Uint32Array(i.key.bytes, i.key.byteOffset, i.key.byteLength / 4),
  15864. a = new Uint32Array(i.iv.bytes, i.iv.byteOffset, i.iv.byteLength / 4);
  15865. new d(r, n, a, function(t, r) {
  15866. var n, a;
  15867. e.postMessage((n = {
  15868. source: i.source,
  15869. decrypted: r
  15870. }, a = {}, Object.keys(n).forEach(function(e) {
  15871. var t = n[e];
  15872. ArrayBuffer.isView(t) ? a[e] = {
  15873. bytes: t.buffer,
  15874. byteOffset: t.byteOffset,
  15875. byteLength: t.byteLength
  15876. } : a[e] = t
  15877. }), a), [r.buffer])
  15878. })
  15879. }
  15880. }(i)
  15881. }()
  15882. }),
  15883. Qh = function(e) {
  15884. var t = e.default ? "main" : "alternative";
  15885. return e.characteristics && e.characteristics.indexOf("public.accessibility.describes-video") >= 0 && (t =
  15886. "main-desc"), t
  15887. },
  15888. Jh = function(e, t) {
  15889. e.abort(), e.pause(), t && t.activePlaylistLoader && (t.activePlaylistLoader.pause(), t.activePlaylistLoader =
  15890. null)
  15891. },
  15892. Zh = function(e, t) {
  15893. t.activePlaylistLoader = e, e.load()
  15894. },
  15895. $h = {
  15896. AUDIO: function(e, t) {
  15897. return function() {
  15898. var i = t.segmentLoaders[e],
  15899. r = t.mediaTypes[e],
  15900. n = t.blacklistCurrentPlaylist;
  15901. Jh(i, r);
  15902. var a = r.activeTrack(),
  15903. s = r.activeGroup(),
  15904. o = (s.filter(function(e) {
  15905. return e.default
  15906. })[0] || s[0]).id,
  15907. u = r.tracks[o];
  15908. if (a !== u) {
  15909. for (var l in Ta.log.warn(
  15910. "Problem encountered loading the alternate audio track.Switching back to default."), r.tracks) r
  15911. .tracks[l].enabled = r.tracks[l] === u;
  15912. r.onTrackChanged()
  15913. } else n({
  15914. message: "Problem encountered loading the default audio track."
  15915. })
  15916. }
  15917. },
  15918. SUBTITLES: function(e, t) {
  15919. return function() {
  15920. var i = t.segmentLoaders[e],
  15921. r = t.mediaTypes[e];
  15922. Ta.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."), Jh(i, r);
  15923. var n = r.activeTrack();
  15924. n && (n.mode = "disabled"), r.onTrackChanged()
  15925. }
  15926. }
  15927. },
  15928. ef = {
  15929. AUDIO: function(e, t, i) {
  15930. if (t) {
  15931. var r = i.tech,
  15932. n = i.requestOptions,
  15933. a = i.segmentLoaders[e];
  15934. t.on("loadedmetadata", function() {
  15935. var e = t.media();
  15936. a.playlist(e, n), (!r.paused() || e.endList && "none" !== r.preload()) && a.load()
  15937. }), t.on("loadedplaylist", function() {
  15938. a.playlist(t.media(), n), r.paused() || a.load()
  15939. }), t.on("error", $h[e](e, i))
  15940. }
  15941. },
  15942. SUBTITLES: function(e, t, i) {
  15943. var r = i.tech,
  15944. n = i.requestOptions,
  15945. a = i.segmentLoaders[e],
  15946. s = i.mediaTypes[e];
  15947. t.on("loadedmetadata", function() {
  15948. var e = t.media();
  15949. a.playlist(e, n), a.track(s.activeTrack()), (!r.paused() || e.endList && "none" !== r.preload()) && a
  15950. .load()
  15951. }), t.on("loadedplaylist", function() {
  15952. a.playlist(t.media(), n), r.paused() || a.load()
  15953. }), t.on("error", $h[e](e, i))
  15954. }
  15955. },
  15956. tf = function(e, t) {
  15957. return function(i) {
  15958. return i.attributes[e] === t
  15959. }
  15960. },
  15961. rf = function(e) {
  15962. return function(t) {
  15963. return t.resolvedUri === e
  15964. }
  15965. },
  15966. nf = {
  15967. AUDIO: function(e, t) {
  15968. var i = t.hls,
  15969. r = t.sourceType,
  15970. n = t.segmentLoaders[e],
  15971. a = t.requestOptions.withCredentials,
  15972. s = t.master,
  15973. o = s.mediaGroups,
  15974. u = s.playlists,
  15975. l = t.mediaTypes[e],
  15976. d = l.groups,
  15977. c = l.tracks,
  15978. h = t.masterPlaylistLoader;
  15979. for (var f in o[e] && 0 !== Object.keys(o[e]).length || (o[e] = {
  15980. main: {
  15981. default: {
  15982. default: !0
  15983. }
  15984. }
  15985. }), o[e]) {
  15986. d[f] || (d[f] = []);
  15987. var p = u.filter(tf(e, f));
  15988. for (var m in o[e][f]) {
  15989. var g = o[e][f][m];
  15990. p.filter(rf(g.resolvedUri)).length && delete g.resolvedUri;
  15991. var v = void 0;
  15992. if (v = g.resolvedUri ? new cc(g.resolvedUri, i, a) : g.playlists && "dash" === r ? new Eh(g.playlists[
  15993. 0], i, a, h) : null, g = Ta.mergeOptions({
  15994. id: m,
  15995. playlistLoader: v
  15996. }, g), ef[e](e, g.playlistLoader, t), d[f].push(g), void 0 === c[m]) {
  15997. var y = new Ta.AudioTrack({
  15998. id: m,
  15999. kind: Qh(g),
  16000. enabled: !1,
  16001. language: g.language,
  16002. default: g.default,
  16003. label: m
  16004. });
  16005. c[m] = y
  16006. }
  16007. }
  16008. }
  16009. n.on("error", $h[e](e, t))
  16010. },
  16011. SUBTITLES: function(e, t) {
  16012. var i = t.tech,
  16013. r = t.hls,
  16014. n = t.sourceType,
  16015. a = t.segmentLoaders[e],
  16016. s = t.requestOptions.withCredentials,
  16017. o = t.master.mediaGroups,
  16018. u = t.mediaTypes[e],
  16019. l = u.groups,
  16020. d = u.tracks,
  16021. c = t.masterPlaylistLoader;
  16022. for (var h in o[e])
  16023. for (var f in l[h] || (l[h] = []), o[e][h])
  16024. if (!o[e][h][f].forced) {
  16025. var p = o[e][h][f],
  16026. m = void 0;
  16027. if ("hls" === n ? m = new cc(p.resolvedUri, r, s) : "dash" === n && (m = new Eh(p.playlists[0], r, s,
  16028. c)), p = Ta.mergeOptions({
  16029. id: f,
  16030. playlistLoader: m
  16031. }, p), ef[e](e, p.playlistLoader, t), l[h].push(p), void 0 === d[f]) {
  16032. var g = i.addRemoteTextTrack({
  16033. id: f,
  16034. kind: "subtitles",
  16035. enabled: !1,
  16036. language: p.language,
  16037. label: f
  16038. }, !1).track;
  16039. d[f] = g
  16040. }
  16041. } a.on("error", $h[e](e, t))
  16042. },
  16043. "CLOSED-CAPTIONS": function(e, t) {
  16044. var i = t.tech,
  16045. r = t.master.mediaGroups,
  16046. n = t.mediaTypes[e],
  16047. a = n.groups,
  16048. s = n.tracks;
  16049. for (var o in r[e])
  16050. for (var u in a[o] || (a[o] = []), r[e][o]) {
  16051. var l = r[e][o][u];
  16052. if (l.instreamId.match(/CC\d/) && (a[o].push(Ta.mergeOptions({
  16053. id: u
  16054. }, l)), void 0 === s[u])) {
  16055. var d = i.addRemoteTextTrack({
  16056. id: l.instreamId,
  16057. kind: "captions",
  16058. enabled: !1,
  16059. language: l.language,
  16060. label: u
  16061. }, !1).track;
  16062. s[u] = d
  16063. }
  16064. }
  16065. }
  16066. },
  16067. af = {
  16068. AUDIO: function(e, t) {
  16069. return function() {
  16070. var i = t.mediaTypes[e].tracks;
  16071. for (var r in i)
  16072. if (i[r].enabled) return i[r];
  16073. return null
  16074. }
  16075. },
  16076. SUBTITLES: function(e, t) {
  16077. return function() {
  16078. var i = t.mediaTypes[e].tracks;
  16079. for (var r in i)
  16080. if ("showing" === i[r].mode) return i[r];
  16081. return null
  16082. }
  16083. }
  16084. },
  16085. sf = function(e) {
  16086. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) {
  16087. nf[t](t, e)
  16088. });
  16089. var t = e.mediaTypes,
  16090. i = e.masterPlaylistLoader,
  16091. r = e.tech,
  16092. n = e.hls;
  16093. ["AUDIO", "SUBTITLES"].forEach(function(i) {
  16094. t[i].activeGroup = function(e, t) {
  16095. return function(i) {
  16096. var r = t.masterPlaylistLoader,
  16097. n = t.mediaTypes[e].groups,
  16098. a = r.media();
  16099. if (!a) return null;
  16100. var s = null;
  16101. return a.attributes[e] && (s = n[a.attributes[e]]), s = s || n.main, void 0 === i ? s : null ===
  16102. i ? null : s.filter(function(e) {
  16103. return e.id === i.id
  16104. })[0] || null
  16105. }
  16106. }(i, e), t[i].activeTrack = af[i](i, e), t[i].onGroupChanged = function(e, t) {
  16107. return function() {
  16108. var i = t.segmentLoaders,
  16109. r = i[e],
  16110. n = i.main,
  16111. a = t.mediaTypes[e],
  16112. s = a.activeTrack(),
  16113. o = a.activeGroup(s),
  16114. u = a.activePlaylistLoader;
  16115. Jh(r, a), o && (o.playlistLoader ? (r.resyncLoader(), Zh(o.playlistLoader, a)) : u && n
  16116. .resetEverything())
  16117. }
  16118. }(i, e), t[i].onTrackChanged = function(e, t) {
  16119. return function() {
  16120. var i = t.segmentLoaders,
  16121. r = i[e],
  16122. n = i.main,
  16123. a = t.mediaTypes[e],
  16124. s = a.activeTrack(),
  16125. o = a.activeGroup(s),
  16126. u = a.activePlaylistLoader;
  16127. Jh(r, a), o && (o.playlistLoader ? u !== o.playlistLoader ? (r.track && r.track(s), r
  16128. .resetEverything(), Zh(o.playlistLoader, a)) : Zh(o.playlistLoader, a) : n
  16129. .resetEverything())
  16130. }
  16131. }(i, e)
  16132. });
  16133. var a = t.AUDIO.activeGroup(),
  16134. s = (a.filter(function(e) {
  16135. return e.default
  16136. })[0] || a[0]).id;
  16137. t.AUDIO.tracks[s].enabled = !0, t.AUDIO.onTrackChanged(), i.on("mediachange", function() {
  16138. ["AUDIO", "SUBTITLES"].forEach(function(e) {
  16139. return t[e].onGroupChanged()
  16140. })
  16141. });
  16142. var o = function() {
  16143. t.AUDIO.onTrackChanged(), r.trigger({
  16144. type: "usage",
  16145. name: "hls-audio-change"
  16146. })
  16147. };
  16148. for (var u in r.audioTracks().addEventListener("change", o), r.remoteTextTracks().addEventListener("change", t
  16149. .SUBTITLES.onTrackChanged), n.on("dispose", function() {
  16150. r.audioTracks().removeEventListener("change", o), r.remoteTextTracks().removeEventListener("change", t
  16151. .SUBTITLES.onTrackChanged)
  16152. }), r.clearTracks("audio"), t.AUDIO.tracks) r.audioTracks().addTrack(t.AUDIO.tracks[u])
  16153. },
  16154. of = function() {
  16155. var e = {};
  16156. return ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) {
  16157. e[t] = {
  16158. groups: {},
  16159. tracks: {},
  16160. activePlaylistLoader: null,
  16161. activeGroup: Sh,
  16162. activeTrack: Sh,
  16163. onGroupChanged: Sh,
  16164. onTrackChanged: Sh
  16165. }
  16166. }), e
  16167. },
  16168. uf = void 0,
  16169. lf = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored",
  16170. "mediaTransferDuration", "mediaBytesTransferred"
  16171. ],
  16172. df = function(e) {
  16173. return this.audioSegmentLoader_[e] + this.mainSegmentLoader_[e]
  16174. },
  16175. cf = function(e) {
  16176. function t(e) {
  16177. Zd(this, t);
  16178. var i = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)),
  16179. r = e.url,
  16180. n = e.withCredentials,
  16181. a = e.tech,
  16182. s = e.bandwidth,
  16183. o = e.externHls,
  16184. u = e.useCueTags,
  16185. l = e.blacklistDuration,
  16186. d = e.enableLowInitialPlaylist,
  16187. c = e.sourceType,
  16188. h = e.seekTo;
  16189. if (!r) throw new Error("A non-empty playlist URL is required");
  16190. uf = o, i.withCredentials = n, i.tech_ = a, i.hls_ = a.hls, i.seekTo_ = h, i.sourceType_ = c, i.useCueTags_ =
  16191. u, i.blacklistDuration = l, i.enableLowInitialPlaylist = d, i.useCueTags_ && (i.cueTagsTrack_ = i.tech_
  16192. .addTextTrack("metadata", "ad-cues"), i.cueTagsTrack_.inBandMetadataTrackDispatchType = ""), i
  16193. .requestOptions_ = {
  16194. withCredentials: i.withCredentials,
  16195. timeout: null
  16196. }, i.mediaTypes_ = of (), i.mediaSource = new Ta.MediaSource, i.mediaSource.addEventListener("sourceopen", i
  16197. .handleSourceOpen_.bind(i)), i.seekable_ = Ta.createTimeRanges(), i.hasPlayed_ = function() {
  16198. return !1
  16199. }, i.syncController_ = new Kh(e), i.segmentMetadataTrack_ = a.addRemoteTextTrack({
  16200. kind: "metadata",
  16201. label: "segment-metadata"
  16202. }, !1).track, i.decrypter_ = new Yh, i.inbandTextTracks_ = {};
  16203. var f = {
  16204. hls: i.hls_,
  16205. mediaSource: i.mediaSource,
  16206. currentTime: i.tech_.currentTime.bind(i.tech_),
  16207. seekable: function() {
  16208. return i.seekable()
  16209. },
  16210. seeking: function() {
  16211. return i.tech_.seeking()
  16212. },
  16213. duration: function() {
  16214. return i.mediaSource.duration
  16215. },
  16216. hasPlayed: function() {
  16217. return i.hasPlayed_()
  16218. },
  16219. goalBufferLength: function() {
  16220. return i.goalBufferLength()
  16221. },
  16222. bandwidth: s,
  16223. syncController: i.syncController_,
  16224. decrypter: i.decrypter_,
  16225. sourceType: i.sourceType_,
  16226. inbandTextTracks: i.inbandTextTracks_
  16227. };
  16228. return i.masterPlaylistLoader_ = "dash" === i.sourceType_ ? new Eh(r, i.hls_, i.withCredentials) : new cc(r, i
  16229. .hls_, i.withCredentials), i.setupMasterPlaylistLoaderListeners_(), i.mainSegmentLoader_ = new Hh(Ta
  16230. .mergeOptions(f, {
  16231. segmentMetadataTrack: i.segmentMetadataTrack_,
  16232. loaderType: "main"
  16233. }), e), i.audioSegmentLoader_ = new Hh(Ta.mergeOptions(f, {
  16234. loaderType: "audio"
  16235. }), e), i.subtitleSegmentLoader_ = new Wh(Ta.mergeOptions(f, {
  16236. loaderType: "vtt"
  16237. }), e), i.setupSegmentLoaderListeners_(), lf.forEach(function(e) {
  16238. i[e + "_"] = df.bind(i, e)
  16239. }), i.logger_ = Th("MPC"), i.masterPlaylistLoader_.load(), i
  16240. }
  16241. return ec(t, e), $d(t, [{
  16242. key: "setupMasterPlaylistLoaderListeners_",
  16243. value: function() {
  16244. var e = this;
  16245. this.masterPlaylistLoader_.on("loadedmetadata", function() {
  16246. var t = e.masterPlaylistLoader_.media(),
  16247. i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3;
  16248. kc(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? e.requestOptions_
  16249. .timeout = 0 : e.requestOptions_.timeout = i, t.endList && "none" !== e.tech_.preload() && (
  16250. e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.mainSegmentLoader_.load()), sf({
  16251. sourceType: e.sourceType_,
  16252. segmentLoaders: {
  16253. AUDIO: e.audioSegmentLoader_,
  16254. SUBTITLES: e.subtitleSegmentLoader_,
  16255. main: e.mainSegmentLoader_
  16256. },
  16257. tech: e.tech_,
  16258. requestOptions: e.requestOptions_,
  16259. masterPlaylistLoader: e.masterPlaylistLoader_,
  16260. hls: e.hls_,
  16261. master: e.master(),
  16262. mediaTypes: e.mediaTypes_,
  16263. blacklistCurrentPlaylist: e.blacklistCurrentPlaylist.bind(e)
  16264. }), e.triggerPresenceUsage_(e.master(), t);
  16265. try {
  16266. e.setupSourceBuffers_()
  16267. } catch (t) {
  16268. return Ta.log.warn("Failed to create SourceBuffers", t), e.mediaSource.endOfStream("decode")
  16269. }
  16270. e.setupFirstPlay(), e.trigger("selectedinitialmedia")
  16271. }), this.masterPlaylistLoader_.on("loadedplaylist", function() {
  16272. var t = e.masterPlaylistLoader_.media();
  16273. if (!t) {
  16274. e.excludeUnsupportedVariants_();
  16275. var i = void 0;
  16276. return e.enableLowInitialPlaylist && (i = e.selectInitialPlaylist()), i || (i = e
  16277. .selectPlaylist()), e.initialMedia_ = i, void e.masterPlaylistLoader_.media(e
  16278. .initialMedia_)
  16279. }
  16280. if (e.useCueTags_ && e.updateAdCues_(t), e.mainSegmentLoader_.playlist(t, e.requestOptions_),
  16281. e.updateDuration(), e.tech_.paused() || (e.mainSegmentLoader_.load(), e
  16282. .audioSegmentLoader_ && e.audioSegmentLoader_.load()), !t.endList) {
  16283. var r = function() {
  16284. var t = e.seekable();
  16285. 0 !== t.length && e.mediaSource.addSeekableRange_(t.start(0), t.end(0))
  16286. };
  16287. if (e.duration() !== 1 / 0) {
  16288. e.tech_.one("durationchange", function t() {
  16289. e.duration() === 1 / 0 ? r() : e.tech_.one("durationchange", t)
  16290. })
  16291. } else r()
  16292. }
  16293. }), this.masterPlaylistLoader_.on("error", function() {
  16294. e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)
  16295. }), this.masterPlaylistLoader_.on("mediachanging", function() {
  16296. e.mainSegmentLoader_.abort(), e.mainSegmentLoader_.pause()
  16297. }), this.masterPlaylistLoader_.on("mediachange", function() {
  16298. var t = e.masterPlaylistLoader_.media(),
  16299. i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3;
  16300. kc(e.masterPlaylistLoader_.master, e.masterPlaylistLoader_.media()) ? e.requestOptions_
  16301. .timeout = 0 : e.requestOptions_.timeout = i, e.mainSegmentLoader_.playlist(t, e
  16302. .requestOptions_), e.mainSegmentLoader_.load(), e.tech_.trigger({
  16303. type: "mediachange",
  16304. bubbles: !0
  16305. })
  16306. }), this.masterPlaylistLoader_.on("playlistunchanged", function() {
  16307. var t = e.masterPlaylistLoader_.media();
  16308. e.stuckAtPlaylistEnd_(t) && (e.blacklistCurrentPlaylist({
  16309. message: "Playlist no longer updating."
  16310. }), e.tech_.trigger("playliststuck"))
  16311. }), this.masterPlaylistLoader_.on("renditiondisabled", function() {
  16312. e.tech_.trigger({
  16313. type: "usage",
  16314. name: "hls-rendition-disabled"
  16315. })
  16316. }), this.masterPlaylistLoader_.on("renditionenabled", function() {
  16317. e.tech_.trigger({
  16318. type: "usage",
  16319. name: "hls-rendition-enabled"
  16320. })
  16321. })
  16322. }
  16323. }, {
  16324. key: "triggerPresenceUsage_",
  16325. value: function(e, t) {
  16326. var i = e.mediaGroups || {},
  16327. r = !0,
  16328. n = Object.keys(i.AUDIO);
  16329. for (var a in i.AUDIO)
  16330. for (var s in i.AUDIO[a]) {
  16331. i.AUDIO[a][s].uri || (r = !1)
  16332. }
  16333. r && this.tech_.trigger({
  16334. type: "usage",
  16335. name: "hls-demuxed"
  16336. }), Object.keys(i.SUBTITLES).length && this.tech_.trigger({
  16337. type: "usage",
  16338. name: "hls-webvtt"
  16339. }), uf.Playlist.isAes(t) && this.tech_.trigger({
  16340. type: "usage",
  16341. name: "hls-aes"
  16342. }), uf.Playlist.isFmp4(t) && this.tech_.trigger({
  16343. type: "usage",
  16344. name: "hls-fmp4"
  16345. }), n.length && Object.keys(i.AUDIO[n[0]]).length > 1 && this.tech_.trigger({
  16346. type: "usage",
  16347. name: "hls-alternate-audio"
  16348. }), this.useCueTags_ && this.tech_.trigger({
  16349. type: "usage",
  16350. name: "hls-playlist-cue-tags"
  16351. })
  16352. }
  16353. }, {
  16354. key: "setupSegmentLoaderListeners_",
  16355. value: function() {
  16356. var e = this;
  16357. this.mainSegmentLoader_.on("bandwidthupdate", function() {
  16358. var t = e.selectPlaylist(),
  16359. i = e.masterPlaylistLoader_.media(),
  16360. r = e.tech_.buffered(),
  16361. n = r.length ? r.end(r.length - 1) - e.tech_.currentTime() : 0,
  16362. a = e.bufferLowWaterLine();
  16363. (!i.endList || e.duration() < kh.MAX_BUFFER_LOW_WATER_LINE || t.attributes.BANDWIDTH < i
  16364. .attributes.BANDWIDTH || n >= a) && e.masterPlaylistLoader_.media(t), e.tech_.trigger(
  16365. "bandwidthupdate")
  16366. }), this.mainSegmentLoader_.on("progress", function() {
  16367. e.trigger("progress")
  16368. }), this.mainSegmentLoader_.on("error", function() {
  16369. e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())
  16370. }), this.mainSegmentLoader_.on("syncinfoupdate", function() {
  16371. e.onSyncInfoUpdate_()
  16372. }), this.mainSegmentLoader_.on("timestampoffset", function() {
  16373. e.tech_.trigger({
  16374. type: "usage",
  16375. name: "hls-timestamp-offset"
  16376. })
  16377. }), this.audioSegmentLoader_.on("syncinfoupdate", function() {
  16378. e.onSyncInfoUpdate_()
  16379. }), this.mainSegmentLoader_.on("ended", function() {
  16380. e.onEndOfStream()
  16381. }), this.mainSegmentLoader_.on("earlyabort", function() {
  16382. e.blacklistCurrentPlaylist({
  16383. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  16384. }, 120)
  16385. }), this.mainSegmentLoader_.on("reseteverything", function() {
  16386. e.tech_.trigger("hls-reset")
  16387. }), this.mainSegmentLoader_.on("segmenttimemapping", function(t) {
  16388. e.tech_.trigger({
  16389. type: "hls-segment-time-mapping",
  16390. mapping: t.mapping
  16391. })
  16392. }), this.audioSegmentLoader_.on("ended", function() {
  16393. e.onEndOfStream()
  16394. })
  16395. }
  16396. }, {
  16397. key: "mediaSecondsLoaded_",
  16398. value: function() {
  16399. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_
  16400. .mediaSecondsLoaded)
  16401. }
  16402. }, {
  16403. key: "load",
  16404. value: function() {
  16405. this.mainSegmentLoader_.load(), this.mediaTypes_.AUDIO.activePlaylistLoader && this
  16406. .audioSegmentLoader_.load(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this
  16407. .subtitleSegmentLoader_.load()
  16408. }
  16409. }, {
  16410. key: "smoothQualityChange_",
  16411. value: function() {
  16412. var e = this.selectPlaylist();
  16413. e !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(e), this
  16414. .mainSegmentLoader_.resetLoader())
  16415. }
  16416. }, {
  16417. key: "fastQualityChange_",
  16418. value: function() {
  16419. var e = this,
  16420. t = this.selectPlaylist();
  16421. t !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(t), this
  16422. .mainSegmentLoader_.resetEverything(function() {
  16423. Ta.browser.IE_VERSION || Ta.browser.IS_EDGE ? e.tech_.setCurrentTime(e.tech_.currentTime() +
  16424. .04) : e.tech_.setCurrentTime(e.tech_.currentTime())
  16425. }))
  16426. }
  16427. }, {
  16428. key: "play",
  16429. value: function() {
  16430. if (!this.setupFirstPlay()) {
  16431. this.tech_.ended() && this.seekTo_(0), this.hasPlayed_() && this.load();
  16432. var e = this.tech_.seekable();
  16433. return this.tech_.duration() === 1 / 0 && this.tech_.currentTime() < e.start(0) ? this.seekTo_(e
  16434. .end(e.length - 1)) : void 0
  16435. }
  16436. }
  16437. }, {
  16438. key: "setupFirstPlay",
  16439. value: function() {
  16440. var e = this,
  16441. t = this.masterPlaylistLoader_.media();
  16442. if (!t || this.tech_.paused() || this.hasPlayed_()) return !1;
  16443. if (!t.endList) {
  16444. var i = this.seekable();
  16445. if (!i.length) return !1;
  16446. if (Ta.browser.IE_VERSION && 0 === this.tech_.readyState()) return this.tech_.one(
  16447. "loadedmetadata",
  16448. function() {
  16449. e.trigger("firstplay"), e.seekTo_(i.end(0)), e.hasPlayed_ = function() {
  16450. return !0
  16451. }
  16452. }), !1;
  16453. this.trigger("firstplay"), this.seekTo_(i.end(0))
  16454. }
  16455. return this.hasPlayed_ = function() {
  16456. return !0
  16457. }, this.load(), !0
  16458. }
  16459. }, {
  16460. key: "handleSourceOpen_",
  16461. value: function() {
  16462. try {
  16463. this.setupSourceBuffers_()
  16464. } catch (e) {
  16465. return Ta.log.warn("Failed to create Source Buffers", e), this.mediaSource.endOfStream("decode")
  16466. }
  16467. if (this.tech_.autoplay()) {
  16468. var e = this.tech_.play();
  16469. void 0 !== e && "function" == typeof e.then && e.then(null, function(e) {})
  16470. }
  16471. this.trigger("sourceopen")
  16472. }
  16473. }, {
  16474. key: "onEndOfStream",
  16475. value: function() {
  16476. var e = this.mainSegmentLoader_.ended_;
  16477. this.mediaTypes_.AUDIO.activePlaylistLoader && (e = !this.mainSegmentLoader_.startingMedia_ || this
  16478. .mainSegmentLoader_.startingMedia_.containsVideo ? e && this.audioSegmentLoader_.ended_ : this
  16479. .audioSegmentLoader_.ended_), e && this.mediaSource.endOfStream()
  16480. }
  16481. }, {
  16482. key: "stuckAtPlaylistEnd_",
  16483. value: function(e) {
  16484. if (!this.seekable().length) return !1;
  16485. var t = this.syncController_.getExpiredTime(e, this.mediaSource.duration);
  16486. if (null === t) return !1;
  16487. var i = uf.Playlist.playlistEnd(e, t),
  16488. r = this.tech_.currentTime(),
  16489. n = this.tech_.buffered();
  16490. if (!n.length) return i - r <= .1;
  16491. var a = n.end(n.length - 1);
  16492. return a - r <= .1 && i - a <= .1
  16493. }
  16494. }, {
  16495. key: "blacklistCurrentPlaylist",
  16496. value: function() {
  16497. var e, t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {},
  16498. i = arguments[1],
  16499. r = void 0;
  16500. if (r = t.playlist || this.masterPlaylistLoader_.media(), i = i || t.blacklistDuration || this
  16501. .blacklistDuration, !r) {
  16502. this.error = t;
  16503. try {
  16504. return this.mediaSource.endOfStream("network")
  16505. } catch (e) {
  16506. return this.trigger("error")
  16507. }
  16508. }
  16509. var n = 1 === this.masterPlaylistLoader_.master.playlists.filter(Sc).length;
  16510. return n ? (Ta.log.warn(
  16511. "Problem encountered with the current HLS playlist. Trying again since it is the final playlist."
  16512. ), this.tech_.trigger("retryplaylist"), this.masterPlaylistLoader_.load(n)) : (r.excludeUntil =
  16513. Date.now() + 1e3 * i, this.tech_.trigger("blacklistplaylist"), this.tech_.trigger({
  16514. type: "usage",
  16515. name: "hls-rendition-blacklisted"
  16516. }), e = this.selectPlaylist(), Ta.log.warn(
  16517. "Problem encountered with the current HLS playlist." + (t.message ? " " + t.message : "") +
  16518. " Switching to another playlist."), this.masterPlaylistLoader_.media(e))
  16519. }
  16520. }, {
  16521. key: "pauseLoading",
  16522. value: function() {
  16523. this.mainSegmentLoader_.pause(), this.mediaTypes_.AUDIO.activePlaylistLoader && this
  16524. .audioSegmentLoader_.pause(), this.mediaTypes_.SUBTITLES.activePlaylistLoader && this
  16525. .subtitleSegmentLoader_.pause()
  16526. }
  16527. }, {
  16528. key: "setCurrentTime",
  16529. value: function(e) {
  16530. var t = Fc(this.tech_.buffered(), e);
  16531. return this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media() && this
  16532. .masterPlaylistLoader_.media().segments ? t && t.length ? e : (this.mainSegmentLoader_
  16533. .resetEverything(), this.mainSegmentLoader_.abort(), this.mediaTypes_.AUDIO
  16534. .activePlaylistLoader && (this.audioSegmentLoader_.resetEverything(), this.audioSegmentLoader_
  16535. .abort()), this.mediaTypes_.SUBTITLES.activePlaylistLoader && (this.subtitleSegmentLoader_
  16536. .resetEverything(), this.subtitleSegmentLoader_.abort()), void this.load()) : 0
  16537. }
  16538. }, {
  16539. key: "duration",
  16540. value: function() {
  16541. return this.masterPlaylistLoader_ ? this.mediaSource ? this.mediaSource.duration : uf.Playlist
  16542. .duration(this.masterPlaylistLoader_.media()) : 0
  16543. }
  16544. }, {
  16545. key: "seekable",
  16546. value: function() {
  16547. return this.seekable_
  16548. }
  16549. }, {
  16550. key: "onSyncInfoUpdate_",
  16551. value: function() {
  16552. var e = void 0,
  16553. t = void 0;
  16554. if (this.masterPlaylistLoader_) {
  16555. var i = this.masterPlaylistLoader_.media();
  16556. if (i) {
  16557. var r = this.syncController_.getExpiredTime(i, this.mediaSource.duration);
  16558. if (null !== r && 0 !== (e = uf.Playlist.seekable(i, r)).length) {
  16559. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  16560. if (i = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null === (r = this
  16561. .syncController_.getExpiredTime(i, this.mediaSource.duration))) return;
  16562. if (0 === (t = uf.Playlist.seekable(i, r)).length) return
  16563. }
  16564. t ? t.start(0) > e.end(0) || e.start(0) > t.end(0) ? this.seekable_ = e : this.seekable_ = Ta
  16565. .createTimeRanges([
  16566. [t.start(0) > e.start(0) ? t.start(0) : e.start(0), t.end(0) < e.end(0) ? t.end(0) : e
  16567. .end(0)
  16568. ]
  16569. ]) : this.seekable_ = e, this.logger_("seekable updated [" + Hc(this.seekable_) + "]"), this
  16570. .tech_.trigger("seekablechanged")
  16571. }
  16572. }
  16573. }
  16574. }
  16575. }, {
  16576. key: "updateDuration",
  16577. value: function() {
  16578. var e = this,
  16579. t = this.mediaSource.duration,
  16580. i = uf.Playlist.duration(this.masterPlaylistLoader_.media()),
  16581. r = this.tech_.buffered(),
  16582. n = function t() {
  16583. e.mediaSource.duration = i, e.tech_.trigger("durationchange"), e.mediaSource
  16584. .removeEventListener("sourceopen", t)
  16585. };
  16586. r.length > 0 && (i = Math.max(i, r.end(r.length - 1))), t !== i && ("open" !== this.mediaSource
  16587. .readyState ? this.mediaSource.addEventListener("sourceopen", n) : n())
  16588. }
  16589. }, {
  16590. key: "dispose",
  16591. value: function() {
  16592. var e = this;
  16593. this.decrypter_.terminate(), this.masterPlaylistLoader_.dispose(), this.mainSegmentLoader_
  16594. .dispose(), ["AUDIO", "SUBTITLES"].forEach(function(t) {
  16595. var i = e.mediaTypes_[t].groups;
  16596. for (var r in i) i[r].forEach(function(e) {
  16597. e.playlistLoader && e.playlistLoader.dispose()
  16598. })
  16599. }), this.audioSegmentLoader_.dispose(), this.subtitleSegmentLoader_.dispose()
  16600. }
  16601. }, {
  16602. key: "master",
  16603. value: function() {
  16604. return this.masterPlaylistLoader_.master
  16605. }
  16606. }, {
  16607. key: "media",
  16608. value: function() {
  16609. return this.masterPlaylistLoader_.media() || this.initialMedia_
  16610. }
  16611. }, {
  16612. key: "setupSourceBuffers_",
  16613. value: function() {
  16614. var e, t = this.masterPlaylistLoader_.media();
  16615. if (t && "open" === this.mediaSource.readyState) {
  16616. if ((e = uh(this.masterPlaylistLoader_.master, t)).length < 1) return this.error =
  16617. "No compatible SourceBuffer configuration for the variant stream:" + t.resolvedUri, this
  16618. .mediaSource.endOfStream("decode");
  16619. this.configureLoaderMimeTypes_(e), this.excludeIncompatibleVariants_(t)
  16620. }
  16621. }
  16622. }, {
  16623. key: "configureLoaderMimeTypes_",
  16624. value: function(e) {
  16625. var t = e.length > 1 && -1 === e[0].indexOf(",") && e[0] !== e[1] ? new Ta.EventTarget : null;
  16626. this.mainSegmentLoader_.mimeType(e[0], t), e[1] && this.audioSegmentLoader_.mimeType(e[1], t)
  16627. }
  16628. }, {
  16629. key: "excludeUnsupportedVariants_",
  16630. value: function() {
  16631. this.master().playlists.forEach(function(e) {
  16632. var t;
  16633. e.attributes.CODECS && n.MediaSource && n.MediaSource.isTypeSupported && !n.MediaSource
  16634. .isTypeSupported('video/mp4; codecs="' + (t = e.attributes.CODECS, t.replace(
  16635. /avc1\.(\d+)\.(\d+)/i,
  16636. function(e) {
  16637. return ah([e])[0]
  16638. })) + '"') && (e.excludeUntil = 1 / 0)
  16639. })
  16640. }
  16641. }, {
  16642. key: "excludeIncompatibleVariants_",
  16643. value: function(e) {
  16644. var t = 2,
  16645. i = null,
  16646. r = void 0;
  16647. e.attributes.CODECS && (r = sh(e.attributes.CODECS), i = r.videoCodec, t = r.codecCount), this
  16648. .master().playlists.forEach(function(e) {
  16649. var r = {
  16650. codecCount: 2,
  16651. videoCodec: null
  16652. };
  16653. e.attributes.CODECS && (r = sh(e.attributes.CODECS)), r.codecCount !== t && (e.excludeUntil =
  16654. 1 / 0), r.videoCodec !== i && (e.excludeUntil = 1 / 0)
  16655. })
  16656. }
  16657. }, {
  16658. key: "updateAdCues_",
  16659. value: function(e) {
  16660. var t = 0,
  16661. i = this.seekable();
  16662. i.length && (t = i.start(0)),
  16663. function(e, t) {
  16664. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0;
  16665. if (e.segments)
  16666. for (var r = i, a = void 0, s = 0; s < e.segments.length; s++) {
  16667. var o = e.segments[s];
  16668. if (a || (a = qh(t, r + o.duration / 2)), a) {
  16669. if ("cueIn" in o) {
  16670. a.endTime = r, a.adEndTime = r, r += o.duration, a = null;
  16671. continue
  16672. }
  16673. if (r < a.endTime) {
  16674. r += o.duration;
  16675. continue
  16676. }
  16677. a.endTime += o.duration
  16678. } else if ("cueOut" in o && ((a = new n.VTTCue(r, r + o.duration, o.cueOut)).adStartTime =
  16679. r, a.adEndTime = r + parseFloat(o.cueOut), t.addCue(a)), "cueOutCont" in o) {
  16680. var u, l, d = o.cueOutCont.split("/").map(parseFloat),
  16681. c = ic(d, 2);
  16682. u = c[0], l = c[1], (a = new n.VTTCue(r, r + o.duration, "")).adStartTime = r - u, a
  16683. .adEndTime = a.adStartTime + l, t.addCue(a)
  16684. }
  16685. r += o.duration
  16686. }
  16687. }(e, this.cueTagsTrack_, t)
  16688. }
  16689. }, {
  16690. key: "goalBufferLength",
  16691. value: function() {
  16692. var e = this.tech_.currentTime(),
  16693. t = kh.GOAL_BUFFER_LENGTH,
  16694. i = kh.GOAL_BUFFER_LENGTH_RATE,
  16695. r = Math.max(t, kh.MAX_GOAL_BUFFER_LENGTH);
  16696. return Math.min(t + e * i, r)
  16697. }
  16698. }, {
  16699. key: "bufferLowWaterLine",
  16700. value: function() {
  16701. var e = this.tech_.currentTime(),
  16702. t = kh.BUFFER_LOW_WATER_LINE,
  16703. i = kh.BUFFER_LOW_WATER_LINE_RATE,
  16704. r = Math.max(t, kh.MAX_BUFFER_LOW_WATER_LINE);
  16705. return Math.min(t + e * i, r)
  16706. }
  16707. }]), t
  16708. }(Ta.EventTarget),
  16709. hf = function e(t, i, r) {
  16710. Zd(this, e);
  16711. var n, a, s, o = t.masterPlaylistController_.fastQualityChange_.bind(t.masterPlaylistController_);
  16712. if (i.attributes.RESOLUTION) {
  16713. var u = i.attributes.RESOLUTION;
  16714. this.width = u.width, this.height = u.height
  16715. }
  16716. this.bandwidth = i.attributes.BANDWIDTH, this.id = r, this.enabled = (n = t.playlists, a = i.uri, s = o,
  16717. function(e) {
  16718. var t = n.master.playlists[a],
  16719. i = Tc(t),
  16720. r = Sc(t);
  16721. return void 0 === e ? r : (e ? delete t.disabled : t.disabled = !0, e === r || i || (s(), e ? n.trigger(
  16722. "renditionenabled") : n.trigger("renditiondisabled")), e)
  16723. })
  16724. },
  16725. ff = ["seeking", "seeked", "pause", "playing", "error"],
  16726. pf = function() {
  16727. function e(t) {
  16728. var i = this;
  16729. Zd(this, e), this.tech_ = t.tech, this.seekable = t.seekable, this.seekTo = t.seekTo, this
  16730. .consecutiveUpdates = 0, this.lastRecordedTime = null, this.timer_ = null, this.checkCurrentTimeTimeout_ =
  16731. null, this.logger_ = Th("PlaybackWatcher"), this.logger_("initialize");
  16732. var r = function() {
  16733. return i.monitorCurrentTime_()
  16734. },
  16735. a = function() {
  16736. return i.techWaiting_()
  16737. },
  16738. s = function() {
  16739. return i.cancelTimer_()
  16740. },
  16741. o = function() {
  16742. return i.fixesBadSeeks_()
  16743. };
  16744. this.tech_.on("seekablechanged", o), this.tech_.on("waiting", a), this.tech_.on(ff, s), this.tech_.on(
  16745. "canplay", r), this.dispose = function() {
  16746. i.logger_("dispose"), i.tech_.off("seekablechanged", o), i.tech_.off("waiting", a), i.tech_.off(ff, s), i
  16747. .tech_.off("canplay", r), i.checkCurrentTimeTimeout_ && n.clearTimeout(i.checkCurrentTimeTimeout_), i
  16748. .cancelTimer_()
  16749. }
  16750. }
  16751. return $d(e, [{
  16752. key: "monitorCurrentTime_",
  16753. value: function() {
  16754. this.checkCurrentTime_(), this.checkCurrentTimeTimeout_ && n.clearTimeout(this
  16755. .checkCurrentTimeTimeout_), this.checkCurrentTimeTimeout_ = n.setTimeout(this
  16756. .monitorCurrentTime_.bind(this), 250)
  16757. }
  16758. }, {
  16759. key: "checkCurrentTime_",
  16760. value: function() {
  16761. if (this.tech_.seeking() && this.fixesBadSeeks_()) return this.consecutiveUpdates = 0, void(this
  16762. .lastRecordedTime = this.tech_.currentTime());
  16763. if (!this.tech_.paused() && !this.tech_.seeking()) {
  16764. var e = this.tech_.currentTime(),
  16765. t = this.tech_.buffered();
  16766. if (this.lastRecordedTime === e && (!t.length || e + .1 >= t.end(t.length - 1))) return this
  16767. .techWaiting_();
  16768. this.consecutiveUpdates >= 5 && e === this.lastRecordedTime ? (this.consecutiveUpdates++, this
  16769. .waiting_()) : e === this.lastRecordedTime ? this.consecutiveUpdates++ : (this
  16770. .consecutiveUpdates = 0, this.lastRecordedTime = e)
  16771. }
  16772. }
  16773. }, {
  16774. key: "cancelTimer_",
  16775. value: function() {
  16776. this.consecutiveUpdates = 0, this.timer_ && (this.logger_("cancelTimer_"), clearTimeout(this
  16777. .timer_)), this.timer_ = null
  16778. }
  16779. }, {
  16780. key: "fixesBadSeeks_",
  16781. value: function() {
  16782. var e = this.tech_.seeking(),
  16783. t = this.seekable(),
  16784. i = this.tech_.currentTime(),
  16785. r = void 0;
  16786. e && this.afterSeekableWindow_(t, i) && (r = t.end(t.length - 1));
  16787. e && this.beforeSeekableWindow_(t, i) && (r = t.start(0) + .1);
  16788. return void 0 !== r && (this.logger_("Trying to seek outside of seekable at time " + i +
  16789. " with seekable range " + Hc(t) + ". Seeking to " + r + "."), this.seekTo(r), !0)
  16790. }
  16791. }, {
  16792. key: "waiting_",
  16793. value: function() {
  16794. if (!this.techWaiting_()) {
  16795. var e = this.tech_.currentTime(),
  16796. t = this.tech_.buffered(),
  16797. i = Fc(t, e);
  16798. return i.length && e + 3 <= i.end(0) ? (this.cancelTimer_(), this.seekTo(e), this.logger_(
  16799. "Stopped at " + e + " while inside a buffered region [" + i.start(0) + " -> " + i.end(0) +
  16800. "]. Attempting to resume playback by seeking to the current time."), void this.tech_
  16801. .trigger({
  16802. type: "usage",
  16803. name: "hls-unknown-waiting"
  16804. })) : void 0
  16805. }
  16806. }
  16807. }, {
  16808. key: "techWaiting_",
  16809. value: function() {
  16810. var e = this.seekable(),
  16811. t = this.tech_.currentTime();
  16812. if (this.tech_.seeking() && this.fixesBadSeeks_()) return !0;
  16813. if (this.tech_.seeking() || null !== this.timer_) return !0;
  16814. if (this.beforeSeekableWindow_(e, t)) {
  16815. var i = e.end(e.length - 1);
  16816. return this.logger_("Fell out of live window at time " + t +
  16817. ". Seeking to live point (seekable end) " + i), this.cancelTimer_(), this.seekTo(i), this
  16818. .tech_.trigger({
  16819. type: "usage",
  16820. name: "hls-live-resync"
  16821. }), !0
  16822. }
  16823. var r = this.tech_.buffered(),
  16824. n = jc(r, t);
  16825. if (this.videoUnderflow_(n, r, t)) return this.cancelTimer_(), this.seekTo(t), this.tech_.trigger({
  16826. type: "usage",
  16827. name: "hls-video-underflow"
  16828. }), !0;
  16829. if (n.length > 0) {
  16830. var a = n.start(0) - t;
  16831. return this.logger_("Stopped at " + t + ", setting timer for " + a + ", seeking to " + n.start(
  16832. 0)), this.timer_ = setTimeout(this.skipTheGap_.bind(this), 1e3 * a, t), !0
  16833. }
  16834. return !1
  16835. }
  16836. }, {
  16837. key: "afterSeekableWindow_",
  16838. value: function(e, t) {
  16839. return !!e.length && t > e.end(e.length - 1) + .1
  16840. }
  16841. }, {
  16842. key: "beforeSeekableWindow_",
  16843. value: function(e, t) {
  16844. return !!(e.length && e.start(0) > 0 && t < e.start(0) - .1)
  16845. }
  16846. }, {
  16847. key: "videoUnderflow_",
  16848. value: function(e, t, i) {
  16849. if (0 === e.length) {
  16850. var r = this.gapFromVideoUnderflow_(t, i);
  16851. if (r) return this.logger_("Encountered a gap in video from " + r.start + " to " + r.end +
  16852. ". Seeking to current time " + i), !0
  16853. }
  16854. return !1
  16855. }
  16856. }, {
  16857. key: "skipTheGap_",
  16858. value: function(e) {
  16859. var t = this.tech_.buffered(),
  16860. i = this.tech_.currentTime(),
  16861. r = jc(t, i);
  16862. this.cancelTimer_(), 0 !== r.length && i === e && (this.logger_("skipTheGap_:", "currentTime:", i,
  16863. "scheduled currentTime:", e, "nextRange start:", r.start(0)), this.seekTo(r.start(0) + 1 /
  16864. 30), this.tech_.trigger({
  16865. type: "usage",
  16866. name: "hls-gap-skip"
  16867. }))
  16868. }
  16869. }, {
  16870. key: "gapFromVideoUnderflow_",
  16871. value: function(e, t) {
  16872. for (var i = function(e) {
  16873. if (e.length < 2) return Ta.createTimeRanges();
  16874. for (var t = [], i = 1; i < e.length; i++) {
  16875. var r = e.end(i - 1),
  16876. n = e.start(i);
  16877. t.push([r, n])
  16878. }
  16879. return Ta.createTimeRanges(t)
  16880. }(e), r = 0; r < i.length; r++) {
  16881. var n = i.start(r),
  16882. a = i.end(r);
  16883. if (t - n < 4 && t - n > 2) return {
  16884. start: n,
  16885. end: a
  16886. }
  16887. }
  16888. return null
  16889. }
  16890. }]), e
  16891. }(),
  16892. mf = {
  16893. errorInterval: 30,
  16894. getSource: function(e) {
  16895. return e(this.tech({
  16896. IWillNotUseThisInPlugins: !0
  16897. }).currentSource_)
  16898. }
  16899. },
  16900. gf = function(e) {
  16901. ! function e(t, i) {
  16902. var r = 0,
  16903. n = 0,
  16904. a = Ta.mergeOptions(mf, i);
  16905. t.ready(function() {
  16906. t.trigger({
  16907. type: "usage",
  16908. name: "hls-error-reload-initialized"
  16909. })
  16910. });
  16911. var s = function() {
  16912. n && t.currentTime(n)
  16913. },
  16914. o = function(e) {
  16915. null !== e && void 0 !== e && (n = t.duration() !== 1 / 0 && t.currentTime() || 0, t.one("loadedmetadata",
  16916. s), t.src(e), t.trigger({
  16917. type: "usage",
  16918. name: "hls-error-reload"
  16919. }), t.play())
  16920. },
  16921. u = function() {
  16922. if (Date.now() - r < 1e3 * a.errorInterval) t.trigger({
  16923. type: "usage",
  16924. name: "hls-error-reload-canceled"
  16925. });
  16926. else {
  16927. if (a.getSource && "function" == typeof a.getSource) return r = Date.now(), a.getSource.call(t, o);
  16928. Ta.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")
  16929. }
  16930. },
  16931. l = function e() {
  16932. t.off("loadedmetadata", s), t.off("error", u), t.off("dispose", e)
  16933. };
  16934. t.on("error", u), t.on("dispose", l), t.reloadSourceOnError = function(i) {
  16935. l(), e(t, i)
  16936. }
  16937. }(this, e)
  16938. };
  16939. Ta.use("*", function(e) {
  16940. return {
  16941. setSource: function(e, t) {
  16942. t(null, e)
  16943. },
  16944. setCurrentTime: function(t) {
  16945. return e.vhs && e.currentSource().src === e.vhs.source_.src && e.vhs.setCurrentTime(t), t
  16946. },
  16947. play: function() {
  16948. e.vhs && e.currentSource().src === e.vhs.source_.src && e.vhs.setCurrentTime(e.currentTime())
  16949. }
  16950. }
  16951. });
  16952. var vf = {
  16953. PlaylistLoader: cc,
  16954. Playlist: Rc,
  16955. Decrypter: Qd,
  16956. AsyncStream: zd,
  16957. decrypt: Yd,
  16958. utils: Nc,
  16959. STANDARD_PLAYLIST_SELECTOR: function() {
  16960. return function(e, t, i, r) {
  16961. var a = e.playlists.map(function(e) {
  16962. var t, i;
  16963. return t = e.attributes.RESOLUTION && e.attributes.RESOLUTION.width, i = e.attributes
  16964. .RESOLUTION && e.attributes.RESOLUTION.height, {
  16965. bandwidth: e.attributes.BANDWIDTH || n.Number.MAX_VALUE,
  16966. width: t,
  16967. height: i,
  16968. playlist: e
  16969. }
  16970. });
  16971. Nh(a, function(e, t) {
  16972. return e.bandwidth - t.bandwidth
  16973. });
  16974. var s = (a = a.filter(function(e) {
  16975. return !Rc.isIncompatible(e.playlist)
  16976. })).filter(function(e) {
  16977. return Rc.isEnabled(e.playlist)
  16978. });
  16979. s.length || (s = a.filter(function(e) {
  16980. return !Rc.isDisabled(e.playlist)
  16981. }));
  16982. var o = s.filter(function(e) {
  16983. return e.bandwidth * kh.BANDWIDTH_VARIANCE < t
  16984. }),
  16985. u = o[o.length - 1],
  16986. l = o.filter(function(e) {
  16987. return e.bandwidth === u.bandwidth
  16988. })[0],
  16989. d = o.filter(function(e) {
  16990. return e.width && e.height
  16991. });
  16992. Nh(d, function(e, t) {
  16993. return e.width - t.width
  16994. });
  16995. var c = d.filter(function(e) {
  16996. return e.width === i && e.height === r
  16997. });
  16998. u = c[c.length - 1];
  16999. var h = c.filter(function(e) {
  17000. return e.bandwidth === u.bandwidth
  17001. })[0],
  17002. f = void 0,
  17003. p = void 0,
  17004. m = void 0;
  17005. h || (p = (f = d.filter(function(e) {
  17006. return e.width > i || e.height > r
  17007. })).filter(function(e) {
  17008. return e.width === f[0].width && e.height === f[0].height
  17009. }), u = p[p.length - 1], m = p.filter(function(e) {
  17010. return e.bandwidth === u.bandwidth
  17011. })[0]);
  17012. var g = m || h || l || s[0] || a[0];
  17013. return g ? g.playlist : null
  17014. }(this.playlists.master, this.systemBandwidth, parseInt(Uh(this.tech_.el(), "width"), 10), parseInt(Uh(
  17015. this.tech_.el(), "height"), 10))
  17016. },
  17017. INITIAL_PLAYLIST_SELECTOR: function() {
  17018. var e = this.playlists.master.playlists.filter(Rc.isEnabled);
  17019. return Nh(e, function(e, t) {
  17020. return Bh(e, t)
  17021. }), e.filter(function(e) {
  17022. return sh(e.attributes.CODECS).videoCodec
  17023. })[0] || null
  17024. },
  17025. comparePlaylistBandwidth: Bh,
  17026. comparePlaylistResolution: function(e, t) {
  17027. var i = void 0,
  17028. r = void 0;
  17029. return e.attributes.RESOLUTION && e.attributes.RESOLUTION.width && (i = e.attributes.RESOLUTION.width), i =
  17030. i || n.Number.MAX_VALUE, t.attributes.RESOLUTION && t.attributes.RESOLUTION.width && (r = t.attributes
  17031. .RESOLUTION.width), i === (r = r || n.Number.MAX_VALUE) && e.attributes.BANDWIDTH && t.attributes
  17032. .BANDWIDTH ? e.attributes.BANDWIDTH - t.attributes.BANDWIDTH : i - r
  17033. },
  17034. xhr: Cc()
  17035. };
  17036. ["GOAL_BUFFER_LENGTH", "MAX_GOAL_BUFFER_LENGTH", "GOAL_BUFFER_LENGTH_RATE", "BUFFER_LOW_WATER_LINE",
  17037. "MAX_BUFFER_LOW_WATER_LINE", "BUFFER_LOW_WATER_LINE_RATE", "BANDWIDTH_VARIANCE"
  17038. ].forEach(function(e) {
  17039. Object.defineProperty(vf, e, {
  17040. get: function() {
  17041. return Ta.log.warn("using Hls." + e + " is UNSAFE be sure you know what you are doing"), kh[e]
  17042. },
  17043. set: function(t) {
  17044. Ta.log.warn("using Hls." + e + " is UNSAFE be sure you know what you are doing"), "number" !=
  17045. typeof t || t < 0 ? Ta.log.warn("value of Hls." + e + " must be greater than or equal to 0") : kh[
  17046. e] = t
  17047. }
  17048. })
  17049. });
  17050. var yf = function(e) {
  17051. if (/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e)) return "hls";
  17052. return /^application\/dash\+xml/i.test(e) ? "dash" : null
  17053. },
  17054. _f = function(e, t) {
  17055. for (var i = t.media(), r = -1, n = 0; n < e.length; n++)
  17056. if (e[n].id === i.uri) {
  17057. r = n;
  17058. break
  17059. } e.selectedIndex_ = r, e.trigger({
  17060. selectedIndex: r,
  17061. type: "change"
  17062. })
  17063. };
  17064. vf.canPlaySource = function() {
  17065. return Ta.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")
  17066. };
  17067. var bf = function(e) {
  17068. if ("dash" === e.options_.sourceType) {
  17069. var t = Ta.players[e.tech_.options_.playerId];
  17070. if (t.eme) {
  17071. var i = function(e, t, i) {
  17072. if (!e) return e;
  17073. var r = {};
  17074. for (var n in e) r[n] = {
  17075. audioContentType: 'audio/mp4; codecs="' + i.attributes.CODECS + '"',
  17076. videoContentType: 'video/mp4; codecs="' + t.attributes.CODECS + '"'
  17077. }, t.contentProtection && t.contentProtection[n] && t.contentProtection[n].pssh && (r[n].pssh = t
  17078. .contentProtection[n].pssh), "string" == typeof e[n] && (r[n].url = e[n]);
  17079. return Ta.mergeOptions(e, r)
  17080. }(e.source_.keySystems, e.playlists.media(), e.masterPlaylistController_.mediaTypes_.AUDIO
  17081. .activePlaylistLoader.media());
  17082. i && (t.currentSource().keySystems = i)
  17083. }
  17084. }
  17085. };
  17086. vf.supportsNativeHls = function() {
  17087. var e = l.createElement("video");
  17088. if (!Ta.getTech("Html5").isSupported()) return !1;
  17089. return ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl", "application/x-mpegurl",
  17090. "video/x-mpegurl", "video/mpegurl", "application/mpegurl"
  17091. ].some(function(t) {
  17092. return /maybe|probably/i.test(e.canPlayType(t))
  17093. })
  17094. }(), vf.supportsNativeDash = !!Ta.getTech("Html5").isSupported() && /maybe|probably/i.test(l.createElement(
  17095. "video").canPlayType("application/dash+xml")), vf.supportsTypeNatively = function(e) {
  17096. return "hls" === e ? vf.supportsNativeHls : "dash" === e && vf.supportsNativeDash
  17097. }, vf.isSupported = function() {
  17098. return Ta.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")
  17099. };
  17100. var wf = Ta.getComponent("Component"),
  17101. Ef = function(e) {
  17102. function t(e, i, r) {
  17103. Zd(this, t);
  17104. var n = tc(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, i, r.hls));
  17105. if (i.options_ && i.options_.playerId) {
  17106. var a = Ta(i.options_.playerId);
  17107. a.hasOwnProperty("hls") || Object.defineProperty(a, "hls", {
  17108. get: function() {
  17109. return Ta.log.warn("player.hls is deprecated. Use player.tech().hls instead."), i.trigger({
  17110. type: "usage",
  17111. name: "hls-player-access"
  17112. }), n
  17113. }
  17114. }), a.vhs = n, a.dash = n
  17115. }
  17116. if (n.tech_ = i, n.source_ = e, n.stats = {}, n.setOptions_(), n.options_.overrideNative && i
  17117. .overrideNativeAudioTracks && i.overrideNativeVideoTracks) i.overrideNativeAudioTracks(!0), i
  17118. .overrideNativeVideoTracks(!0);
  17119. else if (n.options_.overrideNative && (i.featuresNativeVideoTracks || i.featuresNativeAudioTracks))
  17120. throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
  17121. return n.on(l, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"],
  17122. function(e) {
  17123. var t = l.fullscreenElement || l.webkitFullscreenElement || l.mozFullScreenElement || l
  17124. .msFullscreenElement;
  17125. t && t.contains(n.tech_.el()) && n.masterPlaylistController_.smoothQualityChange_()
  17126. }), n.on(n.tech_, "error", function() {
  17127. this.masterPlaylistController_ && this.masterPlaylistController_.pauseLoading()
  17128. }), n.on(n.tech_, "play", n.play), n
  17129. }
  17130. return ec(t, wf), $d(t, [{
  17131. key: "setOptions_",
  17132. value: function() {
  17133. var e = this;
  17134. this.options_.withCredentials = this.options_.withCredentials || !1, "number" != typeof this
  17135. .options_.blacklistDuration && (this.options_.blacklistDuration = 300), "number" != typeof this
  17136. .options_.bandwidth && (this.options_.bandwidth = 4194304), this.options_
  17137. .enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && 4194304 === this.options_
  17138. .bandwidth, ["withCredentials", "bandwidth"].forEach(function(t) {
  17139. void 0 !== e.source_[t] && (e.options_[t] = e.source_[t])
  17140. }), this.bandwidth = this.options_.bandwidth
  17141. }
  17142. }, {
  17143. key: "src",
  17144. value: function(e, t) {
  17145. var i = this;
  17146. e && (this.setOptions_(), this.options_.url = this.source_.src, this.options_.tech = this.tech_,
  17147. this.options_.externHls = vf, this.options_.sourceType = yf(t), this.options_.seekTo = function(
  17148. e) {
  17149. i.tech_.setCurrentTime(e), i.setCurrentTime(e)
  17150. }, this.masterPlaylistController_ = new cf(this.options_), this.playbackWatcher_ = new pf(Ta
  17151. .mergeOptions(this.options_, {
  17152. seekable: function() {
  17153. return i.seekable()
  17154. }
  17155. })), this.masterPlaylistController_.on("error", function() {
  17156. Ta.players[i.tech_.options_.playerId].error(i.masterPlaylistController_.error)
  17157. }), this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist
  17158. .bind(this) : vf.STANDARD_PLAYLIST_SELECTOR.bind(this), this.masterPlaylistController_
  17159. .selectInitialPlaylist = vf.INITIAL_PLAYLIST_SELECTOR.bind(this), this.playlists = this
  17160. .masterPlaylistController_.masterPlaylistLoader_, this.mediaSource = this
  17161. .masterPlaylistController_.mediaSource, Object.defineProperties(this, {
  17162. selectPlaylist: {
  17163. get: function() {
  17164. return this.masterPlaylistController_.selectPlaylist
  17165. },
  17166. set: function(e) {
  17167. this.masterPlaylistController_.selectPlaylist = e.bind(this)
  17168. }
  17169. },
  17170. throughput: {
  17171. get: function() {
  17172. return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate
  17173. },
  17174. set: function(e) {
  17175. this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = e, this
  17176. .masterPlaylistController_.mainSegmentLoader_.throughput.count = 1
  17177. }
  17178. },
  17179. bandwidth: {
  17180. get: function() {
  17181. return this.masterPlaylistController_.mainSegmentLoader_.bandwidth
  17182. },
  17183. set: function(e) {
  17184. this.masterPlaylistController_.mainSegmentLoader_.bandwidth = e, this
  17185. .masterPlaylistController_.mainSegmentLoader_.throughput = {
  17186. rate: 0,
  17187. count: 0
  17188. }
  17189. }
  17190. },
  17191. systemBandwidth: {
  17192. get: function() {
  17193. var e = 1 / (this.bandwidth || 1),
  17194. t = void 0;
  17195. return t = this.throughput > 0 ? 1 / this.throughput : 0, Math.floor(1 / (e + t))
  17196. },
  17197. set: function() {
  17198. Ta.log.error('The "systemBandwidth" property is read-only')
  17199. }
  17200. }
  17201. }), Object.defineProperties(this.stats, {
  17202. bandwidth: {
  17203. get: function() {
  17204. return i.bandwidth || 0
  17205. },
  17206. enumerable: !0
  17207. },
  17208. mediaRequests: {
  17209. get: function() {
  17210. return i.masterPlaylistController_.mediaRequests_() || 0
  17211. },
  17212. enumerable: !0
  17213. },
  17214. mediaRequestsAborted: {
  17215. get: function() {
  17216. return i.masterPlaylistController_.mediaRequestsAborted_() || 0
  17217. },
  17218. enumerable: !0
  17219. },
  17220. mediaRequestsTimedout: {
  17221. get: function() {
  17222. return i.masterPlaylistController_.mediaRequestsTimedout_() || 0
  17223. },
  17224. enumerable: !0
  17225. },
  17226. mediaRequestsErrored: {
  17227. get: function() {
  17228. return i.masterPlaylistController_.mediaRequestsErrored_() || 0
  17229. },
  17230. enumerable: !0
  17231. },
  17232. mediaTransferDuration: {
  17233. get: function() {
  17234. return i.masterPlaylistController_.mediaTransferDuration_() || 0
  17235. },
  17236. enumerable: !0
  17237. },
  17238. mediaBytesTransferred: {
  17239. get: function() {
  17240. return i.masterPlaylistController_.mediaBytesTransferred_() || 0
  17241. },
  17242. enumerable: !0
  17243. },
  17244. mediaSecondsLoaded: {
  17245. get: function() {
  17246. return i.masterPlaylistController_.mediaSecondsLoaded_() || 0
  17247. },
  17248. enumerable: !0
  17249. },
  17250. buffered: {
  17251. get: function() {
  17252. return Gc(i.tech_.buffered())
  17253. },
  17254. enumerable: !0
  17255. },
  17256. currentTime: {
  17257. get: function() {
  17258. return i.tech_.currentTime()
  17259. },
  17260. enumerable: !0
  17261. },
  17262. currentSource: {
  17263. get: function() {
  17264. return i.tech_.currentSource_
  17265. },
  17266. enumerable: !0
  17267. },
  17268. currentTech: {
  17269. get: function() {
  17270. return i.tech_.name_
  17271. },
  17272. enumerable: !0
  17273. },
  17274. duration: {
  17275. get: function() {
  17276. return i.tech_.duration()
  17277. },
  17278. enumerable: !0
  17279. },
  17280. master: {
  17281. get: function() {
  17282. return i.playlists.master
  17283. },
  17284. enumerable: !0
  17285. },
  17286. playerDimensions: {
  17287. get: function() {
  17288. return i.tech_.currentDimensions()
  17289. },
  17290. enumerable: !0
  17291. },
  17292. seekable: {
  17293. get: function() {
  17294. return Gc(i.tech_.seekable())
  17295. },
  17296. enumerable: !0
  17297. },
  17298. timestamp: {
  17299. get: function() {
  17300. return Date.now()
  17301. },
  17302. enumerable: !0
  17303. },
  17304. videoPlaybackQuality: {
  17305. get: function() {
  17306. return i.tech_.getVideoPlaybackQuality()
  17307. },
  17308. enumerable: !0
  17309. }
  17310. }), this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this
  17311. .masterPlaylistController_)), this.masterPlaylistController_.on("selectedinitialmedia",
  17312. function() {
  17313. var e, t;
  17314. t = (e = i).playlists, e.representations = function() {
  17315. return t.master.playlists.filter(function(e) {
  17316. return !Tc(e)
  17317. }).map(function(t, i) {
  17318. return new hf(e, t, t.uri)
  17319. })
  17320. }, bf(i)
  17321. }), this.on(this.masterPlaylistController_, "progress", function() {
  17322. this.tech_.trigger("progress")
  17323. }), this.tech_.ready(function() {
  17324. return i.setupQualityLevels_()
  17325. }), this.tech_.el() && this.tech_.src(Ta.URL.createObjectURL(this.masterPlaylistController_
  17326. .mediaSource)))
  17327. }
  17328. }, {
  17329. key: "setupQualityLevels_",
  17330. value: function() {
  17331. var e = this,
  17332. t = Ta.players[this.tech_.options_.playerId];
  17333. t && t.qualityLevels && (this.qualityLevels_ = t.qualityLevels(), this.masterPlaylistController_.on(
  17334. "selectedinitialmedia",
  17335. function() {
  17336. var t, i;
  17337. t = e.qualityLevels_, (i = e).representations().forEach(function(e) {
  17338. t.addQualityLevel(e)
  17339. }), _f(t, i.playlists)
  17340. }), this.playlists.on("mediachange", function() {
  17341. _f(e.qualityLevels_, e.playlists)
  17342. }))
  17343. }
  17344. }, {
  17345. key: "play",
  17346. value: function() {
  17347. this.masterPlaylistController_.play()
  17348. }
  17349. }, {
  17350. key: "setCurrentTime",
  17351. value: function(e) {
  17352. this.masterPlaylistController_.setCurrentTime(e)
  17353. }
  17354. }, {
  17355. key: "duration",
  17356. value: function() {
  17357. return this.masterPlaylistController_.duration()
  17358. }
  17359. }, {
  17360. key: "seekable",
  17361. value: function() {
  17362. return this.masterPlaylistController_.seekable()
  17363. }
  17364. }, {
  17365. key: "dispose",
  17366. value: function() {
  17367. this.playbackWatcher_ && this.playbackWatcher_.dispose(), this.masterPlaylistController_ && this
  17368. .masterPlaylistController_.dispose(), this.qualityLevels_ && this.qualityLevels_.dispose(),
  17369. function e(t, i, r) {
  17370. null === t && (t = Function.prototype);
  17371. var n = Object.getOwnPropertyDescriptor(t, i);
  17372. if (void 0 === n) {
  17373. var a = Object.getPrototypeOf(t);
  17374. return null === a ? void 0 : e(a, i, r)
  17375. }
  17376. if ("value" in n) return n.value;
  17377. var s = n.get;
  17378. return void 0 !== s ? s.call(r) : void 0
  17379. }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "dispose", this).call(this)
  17380. }
  17381. }]), t
  17382. }(),
  17383. Tf = {
  17384. name: "videojs-http-streaming",
  17385. VERSION: "1.2.6",
  17386. canHandleSource: function(e) {
  17387. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  17388. i = Ta.mergeOptions(Ta.options, t);
  17389. return Tf.canPlayType(e.type, i)
  17390. },
  17391. handleSource: function(e, t) {
  17392. var i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {},
  17393. r = Ta.mergeOptions(Ta.options, i);
  17394. return t.hls = new Ef(e, t, r), t.hls.xhr = Cc(), t.hls.src(e.src, e.type), t.hls
  17395. },
  17396. canPlayType: function(e) {
  17397. var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},
  17398. i = Ta.mergeOptions(Ta.options, t).hls.overrideNative,
  17399. r = yf(e);
  17400. return r && (!vf.supportsTypeNatively(r) || i) ? "maybe" : ""
  17401. }
  17402. };
  17403. return void 0 !== Ta.MediaSource && void 0 !== Ta.URL || (Ta.MediaSource = vh, Ta.URL = yh), vh
  17404. .supportsNativeMediaSources() && Ta.getTech("Html5").registerSourceHandler(Tf, 0), Ta.HlsHandler = Ef, Ta
  17405. .HlsSourceHandler = Tf, Ta.Hls = vf, Ta.use || Ta.registerComponent("Hls", vf), Ta.options.hls = Ta.options.hls ||
  17406. {}, Ta.registerPlugin ? Ta.registerPlugin("reloadSourceOnError", gf) : Ta.plugin("reloadSourceOnError", gf), Ta
  17407. }),
  17408. function() {
  17409. var e, t;
  17410. e = window, (t = e && e.videojs) && (t.CDN_VERSION = "7.2.4")
  17411. }(),
  17412. function(e, t) {
  17413. "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define
  17414. .amd ? define([], t) : "object" == typeof exports ? exports.flvjs = t() : e.flvjs = t()
  17415. }(this, function() {
  17416. return function(e) {
  17417. var t = {};
  17418. function i(r) {
  17419. if (t[r]) return t[r].exports;
  17420. var n = t[r] = {
  17421. i: r,
  17422. l: !1,
  17423. exports: {}
  17424. };
  17425. return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports
  17426. }
  17427. return i.m = e, i.c = t, i.d = function(e, t, r) {
  17428. i.o(e, t) || Object.defineProperty(e, t, {
  17429. enumerable: !0,
  17430. get: r
  17431. })
  17432. }, i.r = function(e) {
  17433. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  17434. value: "Module"
  17435. }), Object.defineProperty(e, "__esModule", {
  17436. value: !0
  17437. })
  17438. }, i.t = function(e, t) {
  17439. if (1 & t && (e = i(e)), 8 & t) return e;
  17440. if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  17441. var r = Object.create(null);
  17442. if (i.r(r), Object.defineProperty(r, "default", {
  17443. enumerable: !0,
  17444. value: e
  17445. }), 2 & t && "string" != typeof e)
  17446. for (var n in e) i.d(r, n, function(t) {
  17447. return e[t]
  17448. }.bind(null, n));
  17449. return r
  17450. }, i.n = function(e) {
  17451. var t = e && e.__esModule ? function() {
  17452. return e.default
  17453. } : function() {
  17454. return e
  17455. };
  17456. return i.d(t, "a", t), t
  17457. }, i.o = function(e, t) {
  17458. return Object.prototype.hasOwnProperty.call(e, t)
  17459. }, i.p = "", i(i.s = 230)
  17460. }([function(e, t, i) {
  17461. "use strict";
  17462. var r = i(8),
  17463. n = i.n(r),
  17464. a = function() {
  17465. function e() {}
  17466. return e.e = function(t, i) {
  17467. t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
  17468. var r = "[" + t + "] > " + i;
  17469. e.ENABLE_CALLBACK && e.emitter.emit("log", "error", r), e.ENABLE_ERROR && (console.error ? console
  17470. .error(r) : console.warn ? console.warn(r) : console.log(r))
  17471. }, e.i = function(t, i) {
  17472. t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
  17473. var r = "[" + t + "] > " + i;
  17474. e.ENABLE_CALLBACK && e.emitter.emit("log", "info", r), e.ENABLE_INFO && (console.info ? console
  17475. .info(r) : console.log(r))
  17476. }, e.w = function(t, i) {
  17477. t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
  17478. var r = "[" + t + "] > " + i;
  17479. e.ENABLE_CALLBACK && e.emitter.emit("log", "warn", r), e.ENABLE_WARN && (console.warn ? console
  17480. .warn(r) : console.log(r))
  17481. }, e.d = function(t, i) {
  17482. t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
  17483. var r = "[" + t + "] > " + i;
  17484. e.ENABLE_CALLBACK && e.emitter.emit("log", "debug", r), e.ENABLE_DEBUG && (console.debug ? console
  17485. .debug(r) : console.log(r))
  17486. }, e.v = function(t, i) {
  17487. t && !e.FORCE_GLOBAL_TAG || (t = e.GLOBAL_TAG);
  17488. var r = "[" + t + "] > " + i;
  17489. e.ENABLE_CALLBACK && e.emitter.emit("log", "verbose", r), e.ENABLE_VERBOSE && console.log(r)
  17490. }, e
  17491. }();
  17492. a.GLOBAL_TAG = "flv.js", a.FORCE_GLOBAL_TAG = !1, a.ENABLE_ERROR = !0, a.ENABLE_INFO = !1, a.ENABLE_WARN = !
  17493. 1, a.ENABLE_DEBUG = !1, a.ENABLE_VERBOSE = !1, a.ENABLE_CALLBACK = !1, a.emitter = new n.a, t.a = a
  17494. }, function(e, t, i) {
  17495. "use strict";
  17496. i.d(t, "G", function() {
  17497. return r
  17498. }), i.d(t, "E", function() {
  17499. return n
  17500. }), i.d(t, "F", function() {
  17501. return a
  17502. }), i.d(t, "w", function() {
  17503. return s
  17504. }), i.d(t, "l", function() {
  17505. return o
  17506. }), i.d(t, "q", function() {
  17507. return u
  17508. }), i.d(t, "y", function() {
  17509. return l
  17510. }), i.d(t, "v", function() {
  17511. return d
  17512. }), i.d(t, "k", function() {
  17513. return c
  17514. }), i.d(t, "s", function() {
  17515. return h
  17516. }), i.d(t, "t", function() {
  17517. return f
  17518. }), i.d(t, "m", function() {
  17519. return p
  17520. }), i.d(t, "D", function() {
  17521. return m
  17522. }), i.d(t, "x", function() {
  17523. return g
  17524. }), i.d(t, "A", function() {
  17525. return v
  17526. }), i.d(t, "B", function() {
  17527. return y
  17528. }), i.d(t, "u", function() {
  17529. return _
  17530. }), i.d(t, "r", function() {
  17531. return b
  17532. }), i.d(t, "o", function() {
  17533. return w
  17534. }), i.d(t, "z", function() {
  17535. return E
  17536. }), i.d(t, "n", function() {
  17537. return T
  17538. }), i.d(t, "b", function() {
  17539. return S
  17540. }), i.d(t, "a", function() {
  17541. return A
  17542. }), i.d(t, "f", function() {
  17543. return k
  17544. }), i.d(t, "p", function() {
  17545. return R
  17546. }), i.d(t, "C", function() {
  17547. return M
  17548. }), i.d(t, "i", function() {
  17549. return D
  17550. }), i.d(t, "d", function() {
  17551. return I
  17552. }), i.d(t, "h", function() {
  17553. return L
  17554. }), i.d(t, "c", function() {
  17555. return x
  17556. }), i.d(t, "j", function() {
  17557. return P
  17558. }), i.d(t, "e", function() {
  17559. return U
  17560. }), i.d(t, "g", function() {
  17561. return N
  17562. });
  17563. var r = 1,
  17564. n = 2,
  17565. a = 3,
  17566. s = 1,
  17567. o = 2,
  17568. u = 3,
  17569. l = 4,
  17570. d = 6,
  17571. c = 7,
  17572. h = 10,
  17573. f = 11,
  17574. p = 12,
  17575. m = 13,
  17576. g = 14,
  17577. v = 15,
  17578. y = 16,
  17579. _ = 20,
  17580. b = 21,
  17581. w = 102,
  17582. E = 103,
  17583. T = 200,
  17584. S = 1,
  17585. A = 2,
  17586. k = 3,
  17587. R = 22,
  17588. M = 23,
  17589. O = !0,
  17590. C = !0;
  17591. function D(e) {
  17592. O = e
  17593. }
  17594. function I() {
  17595. return O
  17596. }
  17597. function L(e) {}
  17598. function x() {
  17599. return C
  17600. }
  17601. function P(e) {
  17602. return new Promise(function(t) {
  17603. return setTimeout(t, e)
  17604. })
  17605. }
  17606. function U(e) {
  17607. var t, i = new Date,
  17608. r = i.getFullYear(),
  17609. n = i.getMonth() + 1,
  17610. a = i.getDate();
  17611. i.getDay(), t = r + "-" + n + "-" + a + " " + i.getHours() + ":" + i.getMinutes() + ":" + i.getSeconds(),
  17612. console.log("[" + t + "]: " + e)
  17613. }
  17614. function N() {
  17615. for (var e = window.location.href.split("/"), t = "", i = 0; i < 3; i++) t += e[i], t += "/";
  17616. return t
  17617. }
  17618. }, function(e, t, i) {
  17619. "use strict";
  17620. t.a = {
  17621. IO_ERROR: "io_error",
  17622. DEMUX_ERROR: "demux_error",
  17623. INIT_SEGMENT: "init_segment",
  17624. MEDIA_SEGMENT: "media_segment",
  17625. LOADING_COMPLETE: "loading_complete",
  17626. RECOVERED_EARLY_EOF: "recovered_early_eof",
  17627. MEDIA_INFO: "media_info",
  17628. METADATA_ARRIVED: "metadata_arrived",
  17629. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  17630. STATISTICS_INFO: "statistics_info",
  17631. RECOMMEND_SEEKPOINT: "recommend_seekpoint",
  17632. RECONNECT_ING: "reconnect_ing",
  17633. RECONNECT_SUCCESS: "reconnect_success",
  17634. IS_ENCODED_H265: "encoded_265",
  17635. SOURCE_ENDED: "source_ended",
  17636. UPDATE_DURATION: "update_duration",
  17637. UPDATE_KBPS: "update_kbps",
  17638. SOCKET_CLOSE: "socket_close",
  17639. SEI_DATA: "sei_data",
  17640. AUDIO_ERROR: "audio_error",
  17641. ON_DBL_CLICK: "ondblclick",
  17642. RECORDING: "recording"
  17643. }
  17644. }, function(e, t, i) {
  17645. "use strict";
  17646. i.d(t, "c", function() {
  17647. return a
  17648. }), i.d(t, "b", function() {
  17649. return s
  17650. }), i.d(t, "a", function() {
  17651. return o
  17652. });
  17653. var r = i(4);
  17654. function n(e, t) {
  17655. for (var i = 0; i < t.length; i++) {
  17656. var r = t[i];
  17657. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  17658. .defineProperty(e, r.key, r)
  17659. }
  17660. }
  17661. var a = {
  17662. kIdle: 0,
  17663. kConnecting: 1,
  17664. kBuffering: 2,
  17665. kError: 3,
  17666. kComplete: 4
  17667. },
  17668. s = {
  17669. OK: "OK",
  17670. EXCEPTION: "Exception",
  17671. HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid",
  17672. CONNECTING_TIMEOUT: "ConnectingTimeout",
  17673. EARLY_EOF: "EarlyEof",
  17674. UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof"
  17675. },
  17676. o = function() {
  17677. function e(e) {
  17678. this._type = e || "undefined", this._status = a.kIdle, this._needStash = !1, this
  17679. ._onContentLengthKnown = null, this._onURLRedirect = null, this._onDataArrival = null, this
  17680. ._onHLSError = null, this._onError = null, this._onComplete = null
  17681. }
  17682. var t, i, s = e.prototype;
  17683. return s.destroy = function() {
  17684. this._status = a.kIdle, this._onContentLengthKnown = null, this._onURLRedirect = null, this
  17685. ._onDataArrival = null, this._onError = null, this._onHLSError = null, this._onComplete = null
  17686. }, s.isWorking = function() {
  17687. return this._status === a.kConnecting || this._status === a.kBuffering
  17688. }, s.open = function(e, t) {
  17689. throw new r.c("Unimplemented abstract function!")
  17690. }, s.abort = function() {
  17691. throw new r.c("Unimplemented abstract function!")
  17692. }, t = e, (i = [{
  17693. key: "type",
  17694. get: function() {
  17695. return this._type
  17696. }
  17697. }, {
  17698. key: "status",
  17699. get: function() {
  17700. return this._status
  17701. }
  17702. }, {
  17703. key: "needStashBuffer",
  17704. get: function() {
  17705. return this._needStash
  17706. }
  17707. }, {
  17708. key: "onContentLengthKnown",
  17709. get: function() {
  17710. return this._onContentLengthKnown
  17711. },
  17712. set: function(e) {
  17713. this._onContentLengthKnown = e
  17714. }
  17715. }, {
  17716. key: "onURLRedirect",
  17717. get: function() {
  17718. return this._onURLRedirect
  17719. },
  17720. set: function(e) {
  17721. this._onURLRedirect = e
  17722. }
  17723. }, {
  17724. key: "onDataArrival",
  17725. get: function() {
  17726. return this._onDataArrival
  17727. },
  17728. set: function(e) {
  17729. this._onDataArrival = e
  17730. }
  17731. }, {
  17732. key: "onHLSError",
  17733. get: function() {
  17734. return this._onHLSError
  17735. },
  17736. set: function(e) {
  17737. this._onHLSError = e
  17738. }
  17739. }, {
  17740. key: "onError",
  17741. get: function() {
  17742. return this._onError
  17743. },
  17744. set: function(e) {
  17745. this._onError = e
  17746. }
  17747. }, {
  17748. key: "onComplete",
  17749. get: function() {
  17750. return this._onComplete
  17751. },
  17752. set: function(e) {
  17753. this._onComplete = e
  17754. }
  17755. }]) && n(t.prototype, i), Object.defineProperty(t, "prototype", {
  17756. writable: !1
  17757. }), e
  17758. }()
  17759. }, function(e, t, i) {
  17760. "use strict";
  17761. function r(e, t) {
  17762. e.prototype = Object.create(t.prototype), e.prototype.constructor = e,
  17763. function(e, t) {
  17764. (Object.setPrototypeOf || function(e, t) {
  17765. return e.__proto__ = t, e
  17766. })(e, t)
  17767. }(e, t)
  17768. }
  17769. function n(e, t) {
  17770. for (var i = 0; i < t.length; i++) {
  17771. var r = t[i];
  17772. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  17773. .defineProperty(e, r.key, r)
  17774. }
  17775. }
  17776. function a(e, t, i) {
  17777. return t && n(e.prototype, t), i && n(e, i), Object.defineProperty(e, "prototype", {
  17778. writable: !1
  17779. }), e
  17780. }
  17781. i.d(t, "d", function() {
  17782. return s
  17783. }), i.d(t, "a", function() {
  17784. return o
  17785. }), i.d(t, "b", function() {
  17786. return u
  17787. }), i.d(t, "c", function() {
  17788. return l
  17789. });
  17790. var s = function() {
  17791. function e(e) {
  17792. this._message = e
  17793. }
  17794. return e.prototype.toString = function() {
  17795. return this.name + ": " + this.message
  17796. }, a(e, [{
  17797. key: "name",
  17798. get: function() {
  17799. return "RuntimeException"
  17800. }
  17801. }, {
  17802. key: "message",
  17803. get: function() {
  17804. return this._message
  17805. }
  17806. }]), e
  17807. }(),
  17808. o = function(e) {
  17809. function t(t) {
  17810. return e.call(this, t) || this
  17811. }
  17812. return r(t, e), a(t, [{
  17813. key: "name",
  17814. get: function() {
  17815. return "IllegalStateException"
  17816. }
  17817. }]), t
  17818. }(s),
  17819. u = function(e) {
  17820. function t(t) {
  17821. return e.call(this, t) || this
  17822. }
  17823. return r(t, e), a(t, [{
  17824. key: "name",
  17825. get: function() {
  17826. return "InvalidArgumentException"
  17827. }
  17828. }]), t
  17829. }(s),
  17830. l = function(e) {
  17831. function t(t) {
  17832. return e.call(this, t) || this
  17833. }
  17834. return r(t, e), a(t, [{
  17835. key: "name",
  17836. get: function() {
  17837. return "NotImplementedException"
  17838. }
  17839. }]), t
  17840. }(s)
  17841. }, function(e, t) {
  17842. "function" == typeof Object.create ? e.exports = function(e, t) {
  17843. t && (e.super_ = t, e.prototype = Object.create(t.prototype, {
  17844. constructor: {
  17845. value: e,
  17846. enumerable: !1,
  17847. writable: !0,
  17848. configurable: !0
  17849. }
  17850. }))
  17851. } : e.exports = function(e, t) {
  17852. if (t) {
  17853. e.super_ = t;
  17854. var i = function() {};
  17855. i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e
  17856. }
  17857. }
  17858. }, function(e, t, i) {
  17859. var r = i(10),
  17860. n = r.Buffer;
  17861. function a(e, t) {
  17862. for (var i in e) t[i] = e[i]
  17863. }
  17864. function s(e, t, i) {
  17865. return n(e, t, i)
  17866. }
  17867. n.from && n.alloc && n.allocUnsafe && n.allocUnsafeSlow ? e.exports = r : (a(r, t), t.Buffer = s), s
  17868. .prototype = Object.create(n.prototype), a(n, s), s.from = function(e, t, i) {
  17869. if ("number" == typeof e) throw new TypeError("Argument must not be a number");
  17870. return n(e, t, i)
  17871. }, s.alloc = function(e, t, i) {
  17872. if ("number" != typeof e) throw new TypeError("Argument must be a number");
  17873. var r = n(e);
  17874. return void 0 !== t ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r
  17875. }, s.allocUnsafe = function(e) {
  17876. if ("number" != typeof e) throw new TypeError("Argument must be a number");
  17877. return n(e)
  17878. }, s.allocUnsafeSlow = function(e) {
  17879. if ("number" != typeof e) throw new TypeError("Argument must be a number");
  17880. return r.SlowBuffer(e)
  17881. }
  17882. }, function(e, t, i) {
  17883. "use strict";
  17884. var r = {};
  17885. ! function() {
  17886. var e = self.navigator.userAgent.toLowerCase(),
  17887. t = /(edge)\/([\w.]+)/.exec(e) || /(opr)[\/]([\w.]+)/.exec(e) || /(chrome)[ \/]([\w.]+)/.exec(e) ||
  17888. /(iemobile)[\/]([\w.]+)/.exec(e) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(
  17889. e) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e) ||
  17890. /(webkit)[ \/]([\w.]+)/.exec(e) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e) || /(msie) ([\w.]+)/
  17891. .exec(e) || e.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(e) || e.indexOf("compatible") < 0 &&
  17892. /(firefox)[ \/]([\w.]+)/.exec(e) || [],
  17893. i = /(ipad)/.exec(e) || /(ipod)/.exec(e) || /(windows phone)/.exec(e) || /(iphone)/.exec(e) ||
  17894. /(kindle)/.exec(e) || /(android)/.exec(e) || /(windows)/.exec(e) || /(mac)/.exec(e) || /(linux)/.exec(
  17895. e) || /(cros)/.exec(e) || [],
  17896. n = {
  17897. browser: t[5] || t[3] || t[1] || "",
  17898. version: t[2] || t[4] || "0",
  17899. majorVersion: t[4] || t[2] || "0",
  17900. platform: i[0] || ""
  17901. },
  17902. a = {};
  17903. if (n.browser) {
  17904. a[n.browser] = !0;
  17905. var s = n.majorVersion.split(".");
  17906. a.version = {
  17907. major: parseInt(n.majorVersion, 10),
  17908. string: n.version
  17909. }, s.length > 1 && (a.version.minor = parseInt(s[1], 10)), s.length > 2 && (a.version.build =
  17910. parseInt(s[2], 10))
  17911. }
  17912. for (var o in n.platform && (a[n.platform] = !0), (a.chrome || a.opr || a.safari) && (a.webkit = !0), (a
  17913. .rv || a.iemobile) && (a.rv && delete a.rv, n.browser = "msie", a.msie = !0), a.edge && (delete a
  17914. .edge, n.browser = "msedge", a.msedge = !0), a.opr && (n.browser = "opera", a.opera = !0), a
  17915. .safari && a.android && (n.browser = "android", a.android = !0), a.name = n.browser, a.platform = n
  17916. .platform, r) r.hasOwnProperty(o) && delete r[o];
  17917. Object.assign(r, a)
  17918. }(), t.a = r
  17919. }, function(e, t, i) {
  17920. "use strict";
  17921. var r, n = "object" == typeof Reflect ? Reflect : null,
  17922. a = n && "function" == typeof n.apply ? n.apply : function(e, t, i) {
  17923. return Function.prototype.apply.call(e, t, i)
  17924. };
  17925. r = n && "function" == typeof n.ownKeys ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
  17926. return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))
  17927. } : function(e) {
  17928. return Object.getOwnPropertyNames(e)
  17929. };
  17930. var s = Number.isNaN || function(e) {
  17931. return e != e
  17932. };
  17933. function o() {
  17934. o.init.call(this)
  17935. }
  17936. e.exports = o, e.exports.once = function(e, t) {
  17937. return new Promise(function(i, r) {
  17938. function n(i) {
  17939. e.removeListener(t, a), r(i)
  17940. }
  17941. function a() {
  17942. "function" == typeof e.removeListener && e.removeListener("error", n), i([].slice.call(
  17943. arguments))
  17944. }
  17945. g(e, t, a, {
  17946. once: !0
  17947. }), "error" !== t && function(e, t, i) {
  17948. "function" == typeof e.on && g(e, "error", t, {
  17949. once: !0
  17950. })
  17951. }(e, n)
  17952. })
  17953. }, o.EventEmitter = o, o.prototype._events = void 0, o.prototype._eventsCount = 0, o.prototype
  17954. ._maxListeners = void 0;
  17955. var u = 10;
  17956. function l(e) {
  17957. if ("function" != typeof e) throw new TypeError(
  17958. 'The "listener" argument must be of type Function. Received type ' + typeof e)
  17959. }
  17960. function d(e) {
  17961. return void 0 === e._maxListeners ? o.defaultMaxListeners : e._maxListeners
  17962. }
  17963. function c(e, t, i, r) {
  17964. var n, a, s, o;
  17965. if (l(i), void 0 === (a = e._events) ? (a = e._events = Object.create(null), e._eventsCount = 0) : (
  17966. void 0 !== a.newListener && (e.emit("newListener", t, i.listener ? i.listener : i), a = e._events),
  17967. s = a[t]), void 0 === s) s = a[t] = i, ++e._eventsCount;
  17968. else if ("function" == typeof s ? s = a[t] = r ? [i, s] : [s, i] : r ? s.unshift(i) : s.push(i), (n = d(
  17969. e)) > 0 && s.length > n && !s.warned) {
  17970. s.warned = !0;
  17971. var u = new Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) +
  17972. " listeners added. Use emitter.setMaxListeners() to increase limit");
  17973. u.name = "MaxListenersExceededWarning", u.emitter = e, u.type = t, u.count = s.length, o = u, console &&
  17974. console.warn && console.warn(o)
  17975. }
  17976. return e
  17977. }
  17978. function h(e, t, i) {
  17979. var r = {
  17980. fired: !1,
  17981. wrapFn: void 0,
  17982. target: e,
  17983. type: t,
  17984. listener: i
  17985. },
  17986. n = function() {
  17987. if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 0 ===
  17988. arguments.length ? this.listener.call(this.target) : this.listener.apply(this.target, arguments)
  17989. }.bind(r);
  17990. return n.listener = i, r.wrapFn = n, n
  17991. }
  17992. function f(e, t, i) {
  17993. var r = e._events;
  17994. if (void 0 === r) return [];
  17995. var n = r[t];
  17996. return void 0 === n ? [] : "function" == typeof n ? i ? [n.listener || n] : [n] : i ? function(e) {
  17997. for (var t = new Array(e.length), i = 0; i < t.length; ++i) t[i] = e[i].listener || e[i];
  17998. return t
  17999. }(n) : m(n, n.length)
  18000. }
  18001. function p(e) {
  18002. var t = this._events;
  18003. if (void 0 !== t) {
  18004. var i = t[e];
  18005. if ("function" == typeof i) return 1;
  18006. if (void 0 !== i) return i.length
  18007. }
  18008. return 0
  18009. }
  18010. function m(e, t) {
  18011. for (var i = new Array(t), r = 0; r < t; ++r) i[r] = e[r];
  18012. return i
  18013. }
  18014. function g(e, t, i, r) {
  18015. if ("function" == typeof e.on) r.once ? e.once(t, i) : e.on(t, i);
  18016. else {
  18017. if ("function" != typeof e.addEventListener) throw new TypeError(
  18018. 'The "emitter" argument must be of type EventEmitter. Received type ' + typeof e);
  18019. e.addEventListener(t, function n(a) {
  18020. r.once && e.removeEventListener(t, n), i(a)
  18021. })
  18022. }
  18023. }
  18024. Object.defineProperty(o, "defaultMaxListeners", {
  18025. enumerable: !0,
  18026. get: function() {
  18027. return u
  18028. },
  18029. set: function(e) {
  18030. if ("number" != typeof e || e < 0 || s(e)) throw new RangeError(
  18031. 'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' +
  18032. e + ".");
  18033. u = e
  18034. }
  18035. }), o.init = function() {
  18036. void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events =
  18037. Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0
  18038. }, o.prototype.setMaxListeners = function(e) {
  18039. if ("number" != typeof e || e < 0 || s(e)) throw new RangeError(
  18040. 'The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
  18041. return this._maxListeners = e, this
  18042. }, o.prototype.getMaxListeners = function() {
  18043. return d(this)
  18044. }, o.prototype.emit = function(e) {
  18045. for (var t = [], i = 1; i < arguments.length; i++) t.push(arguments[i]);
  18046. var r = "error" === e,
  18047. n = this._events;
  18048. if (void 0 !== n) r = r && void 0 === n.error;
  18049. else if (!r) return !1;
  18050. if (r) {
  18051. var s;
  18052. if (t.length > 0 && (s = t[0]), s instanceof Error) throw s;
  18053. var o = new Error("Unhandled error." + (s ? " (" + s.message + ")" : ""));
  18054. throw o.context = s, o
  18055. }
  18056. var u = n[e];
  18057. if (void 0 === u) return !1;
  18058. if ("function" == typeof u) a(u, this, t);
  18059. else {
  18060. var l = u.length,
  18061. d = m(u, l);
  18062. for (i = 0; i < l; ++i) a(d[i], this, t)
  18063. }
  18064. return !0
  18065. }, o.prototype.addListener = function(e, t) {
  18066. return c(this, e, t, !1)
  18067. }, o.prototype.on = o.prototype.addListener, o.prototype.prependListener = function(e, t) {
  18068. return c(this, e, t, !0)
  18069. }, o.prototype.once = function(e, t) {
  18070. return l(t), this.on(e, h(this, e, t)), this
  18071. }, o.prototype.prependOnceListener = function(e, t) {
  18072. return l(t), this.prependListener(e, h(this, e, t)), this
  18073. }, o.prototype.removeListener = function(e, t) {
  18074. var i, r, n, a, s;
  18075. if (l(t), void 0 === (r = this._events)) return this;
  18076. if (void 0 === (i = r[e])) return this;
  18077. if (i === t || i.listener === t) 0 == --this._eventsCount ? this._events = Object.create(null) : (
  18078. delete r[e], r.removeListener && this.emit("removeListener", e, i.listener || t));
  18079. else if ("function" != typeof i) {
  18080. for (n = -1, a = i.length - 1; a >= 0; a--)
  18081. if (i[a] === t || i[a].listener === t) {
  18082. s = i[a].listener, n = a;
  18083. break
  18084. } if (n < 0) return this;
  18085. 0 === n ? i.shift() : function(e, t) {
  18086. for (; t + 1 < e.length; t++) e[t] = e[t + 1];
  18087. e.pop()
  18088. }(i, n), 1 === i.length && (r[e] = i[0]), void 0 !== r.removeListener && this.emit("removeListener",
  18089. e, s || t)
  18090. }
  18091. return this
  18092. }, o.prototype.off = o.prototype.removeListener, o.prototype.removeAllListeners = function(e) {
  18093. var t, i, r;
  18094. if (void 0 === (i = this._events)) return this;
  18095. if (void 0 === i.removeListener) return 0 === arguments.length ? (this._events = Object.create(null),
  18096. this._eventsCount = 0) : void 0 !== i[e] && (0 == --this._eventsCount ? this._events = Object
  18097. .create(null) : delete i[e]), this;
  18098. if (0 === arguments.length) {
  18099. var n, a = Object.keys(i);
  18100. for (r = 0; r < a.length; ++r) "removeListener" !== (n = a[r]) && this.removeAllListeners(n);
  18101. return this.removeAllListeners("removeListener"), this._events = Object.create(null), this
  18102. ._eventsCount = 0, this
  18103. }
  18104. if ("function" == typeof(t = i[e])) this.removeListener(e, t);
  18105. else if (void 0 !== t)
  18106. for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
  18107. return this
  18108. }, o.prototype.listeners = function(e) {
  18109. return f(this, e, !0)
  18110. }, o.prototype.rawListeners = function(e) {
  18111. return f(this, e, !1)
  18112. }, o.listenerCount = function(e, t) {
  18113. return "function" == typeof e.listenerCount ? e.listenerCount(t) : p.call(e, t)
  18114. }, o.prototype.listenerCount = p, o.prototype.eventNames = function() {
  18115. return this._eventsCount > 0 ? r(this._events) : []
  18116. }
  18117. }, function(e, t) {
  18118. var i, r, n = e.exports = {};
  18119. function a() {
  18120. throw new Error("setTimeout has not been defined")
  18121. }
  18122. function s() {
  18123. throw new Error("clearTimeout has not been defined")
  18124. }
  18125. function o(e) {
  18126. if (i === setTimeout) return setTimeout(e, 0);
  18127. if ((i === a || !i) && setTimeout) return i = setTimeout, setTimeout(e, 0);
  18128. try {
  18129. return i(e, 0)
  18130. } catch (t) {
  18131. try {
  18132. return i.call(null, e, 0)
  18133. } catch (t) {
  18134. return i.call(this, e, 0)
  18135. }
  18136. }
  18137. }! function() {
  18138. try {
  18139. i = "function" == typeof setTimeout ? setTimeout : a
  18140. } catch (e) {
  18141. i = a
  18142. }
  18143. try {
  18144. r = "function" == typeof clearTimeout ? clearTimeout : s
  18145. } catch (e) {
  18146. r = s
  18147. }
  18148. }();
  18149. var u, l = [],
  18150. d = !1,
  18151. c = -1;
  18152. function h() {
  18153. d && u && (d = !1, u.length ? l = u.concat(l) : c = -1, l.length && f())
  18154. }
  18155. function f() {
  18156. if (!d) {
  18157. var e = o(h);
  18158. d = !0;
  18159. for (var t = l.length; t;) {
  18160. for (u = l, l = []; ++c < t;) u && u[c].run();
  18161. c = -1, t = l.length
  18162. }
  18163. u = null, d = !1,
  18164. function(e) {
  18165. if (r === clearTimeout) return clearTimeout(e);
  18166. if ((r === s || !r) && clearTimeout) return r = clearTimeout, clearTimeout(e);
  18167. try {
  18168. r(e)
  18169. } catch (t) {
  18170. try {
  18171. return r.call(null, e)
  18172. } catch (t) {
  18173. return r.call(this, e)
  18174. }
  18175. }
  18176. }(e)
  18177. }
  18178. }
  18179. function p(e, t) {
  18180. this.fun = e, this.array = t
  18181. }
  18182. function m() {}
  18183. n.nextTick = function(e) {
  18184. var t = new Array(arguments.length - 1);
  18185. if (arguments.length > 1)
  18186. for (var i = 1; i < arguments.length; i++) t[i - 1] = arguments[i];
  18187. l.push(new p(e, t)), 1 !== l.length || d || o(f)
  18188. }, p.prototype.run = function() {
  18189. this.fun.apply(null, this.array)
  18190. }, n.title = "browser", n.browser = !0, n.env = {}, n.argv = [], n.version = "", n.versions = {}, n.on =
  18191. m, n.addListener = m, n.once = m, n.off = m, n.removeListener = m, n.removeAllListeners = m, n.emit = m, n
  18192. .prependListener = m, n.prependOnceListener = m, n.listeners = function(e) {
  18193. return []
  18194. }, n.binding = function(e) {
  18195. throw new Error("process.binding is not supported")
  18196. }, n.cwd = function() {
  18197. return "/"
  18198. }, n.chdir = function(e) {
  18199. throw new Error("process.chdir is not supported")
  18200. }, n.umask = function() {
  18201. return 0
  18202. }
  18203. }, function(e, t, i) {
  18204. "use strict";
  18205. (function(e) {
  18206. var r = i(125),
  18207. n = i(126),
  18208. a = i(66);
  18209. function s() {
  18210. return u.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823
  18211. }
  18212. function o(e, t) {
  18213. if (s() < t) throw new RangeError("Invalid typed array length");
  18214. return u.TYPED_ARRAY_SUPPORT ? (e = new Uint8Array(t)).__proto__ = u.prototype : (null === e && (e =
  18215. new u(t)), e.length = t), e
  18216. }
  18217. function u(e, t, i) {
  18218. if (!(u.TYPED_ARRAY_SUPPORT || this instanceof u)) return new u(e, t, i);
  18219. if ("number" == typeof e) {
  18220. if ("string" == typeof t) throw new Error(
  18221. "If encoding is specified then the first argument must be a string");
  18222. return c(this, e)
  18223. }
  18224. return l(this, e, t, i)
  18225. }
  18226. function l(e, t, i, r) {
  18227. if ("number" == typeof t) throw new TypeError('"value" argument must not be a number');
  18228. return "undefined" != typeof ArrayBuffer && t instanceof ArrayBuffer ? function(e, t, i, r) {
  18229. if (t.byteLength, i < 0 || t.byteLength < i) throw new RangeError("'offset' is out of bounds");
  18230. if (t.byteLength < i + (r || 0)) throw new RangeError("'length' is out of bounds");
  18231. return t = void 0 === i && void 0 === r ? new Uint8Array(t) : void 0 === r ? new Uint8Array(t,
  18232. i) : new Uint8Array(t, i, r), u.TYPED_ARRAY_SUPPORT ? (e = t).__proto__ = u.prototype : e = h(e,
  18233. t), e
  18234. }(e, t, i, r) : "string" == typeof t ? function(e, t, i) {
  18235. if ("string" == typeof i && "" !== i || (i = "utf8"), !u.isEncoding(i)) throw new TypeError(
  18236. '"encoding" must be a valid string encoding');
  18237. var r = 0 | p(t, i),
  18238. n = (e = o(e, r)).write(t, i);
  18239. return n !== r && (e = e.slice(0, n)), e
  18240. }(e, t, i) : function(e, t) {
  18241. if (u.isBuffer(t)) {
  18242. var i = 0 | f(t.length);
  18243. return 0 === (e = o(e, i)).length || t.copy(e, 0, 0, i), e
  18244. }
  18245. if (t) {
  18246. if ("undefined" != typeof ArrayBuffer && t.buffer instanceof ArrayBuffer || "length" in t)
  18247. return "number" != typeof t.length || (r = t.length) != r ? o(e, 0) : h(e, t);
  18248. if ("Buffer" === t.type && a(t.data)) return h(e, t.data)
  18249. }
  18250. var r;
  18251. throw new TypeError(
  18252. "First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")
  18253. }(e, t)
  18254. }
  18255. function d(e) {
  18256. if ("number" != typeof e) throw new TypeError('"size" argument must be a number');
  18257. if (e < 0) throw new RangeError('"size" argument must not be negative')
  18258. }
  18259. function c(e, t) {
  18260. if (d(t), e = o(e, t < 0 ? 0 : 0 | f(t)), !u.TYPED_ARRAY_SUPPORT)
  18261. for (var i = 0; i < t; ++i) e[i] = 0;
  18262. return e
  18263. }
  18264. function h(e, t) {
  18265. var i = t.length < 0 ? 0 : 0 | f(t.length);
  18266. e = o(e, i);
  18267. for (var r = 0; r < i; r += 1) e[r] = 255 & t[r];
  18268. return e
  18269. }
  18270. function f(e) {
  18271. if (e >= s()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + s()
  18272. .toString(16) + " bytes");
  18273. return 0 | e
  18274. }
  18275. function p(e, t) {
  18276. if (u.isBuffer(e)) return e.length;
  18277. if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer
  18278. .isView(e) || e instanceof ArrayBuffer)) return e.byteLength;
  18279. "string" != typeof e && (e = "" + e);
  18280. var i = e.length;
  18281. if (0 === i) return 0;
  18282. for (var r = !1;;) switch (t) {
  18283. case "ascii":
  18284. case "latin1":
  18285. case "binary":
  18286. return i;
  18287. case "utf8":
  18288. case "utf-8":
  18289. case void 0:
  18290. return F(e).length;
  18291. case "ucs2":
  18292. case "ucs-2":
  18293. case "utf16le":
  18294. case "utf-16le":
  18295. return 2 * i;
  18296. case "hex":
  18297. return i >>> 1;
  18298. case "base64":
  18299. return j(e).length;
  18300. default:
  18301. if (r) return F(e).length;
  18302. t = ("" + t).toLowerCase(), r = !0
  18303. }
  18304. }
  18305. function m(e, t, i) {
  18306. var r = e[t];
  18307. e[t] = e[i], e[i] = r
  18308. }
  18309. function g(e, t, i, r, n) {
  18310. if (0 === e.length) return -1;
  18311. if ("string" == typeof i ? (r = i, i = 0) : i > 2147483647 ? i = 2147483647 : i < -2147483648 && (
  18312. i = -2147483648), i = +i, isNaN(i) && (i = n ? 0 : e.length - 1), i < 0 && (i = e.length + i),
  18313. i >= e.length) {
  18314. if (n) return -1;
  18315. i = e.length - 1
  18316. } else if (i < 0) {
  18317. if (!n) return -1;
  18318. i = 0
  18319. }
  18320. if ("string" == typeof t && (t = u.from(t, r)), u.isBuffer(t)) return 0 === t.length ? -1 : v(e, t, i,
  18321. r, n);
  18322. if ("number" == typeof t) return t &= 255, u.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array
  18323. .prototype.indexOf ? n ? Uint8Array.prototype.indexOf.call(e, t, i) : Uint8Array.prototype
  18324. .lastIndexOf.call(e, t, i) : v(e, [t], i, r, n);
  18325. throw new TypeError("val must be string, number or Buffer")
  18326. }
  18327. function v(e, t, i, r, n) {
  18328. var a, s = 1,
  18329. o = e.length,
  18330. u = t.length;
  18331. if (void 0 !== r && ("ucs2" === (r = String(r).toLowerCase()) || "ucs-2" === r || "utf16le" === r ||
  18332. "utf-16le" === r)) {
  18333. if (e.length < 2 || t.length < 2) return -1;
  18334. s = 2, o /= 2, u /= 2, i /= 2
  18335. }
  18336. function l(e, t) {
  18337. return 1 === s ? e[t] : e.readUInt16BE(t * s)
  18338. }
  18339. if (n) {
  18340. var d = -1;
  18341. for (a = i; a < o; a++)
  18342. if (l(e, a) === l(t, -1 === d ? 0 : a - d)) {
  18343. if (-1 === d && (d = a), a - d + 1 === u) return d * s
  18344. } else -1 !== d && (a -= a - d), d = -1
  18345. } else
  18346. for (i + u > o && (i = o - u), a = i; a >= 0; a--) {
  18347. for (var c = !0, h = 0; h < u; h++)
  18348. if (l(e, a + h) !== l(t, h)) {
  18349. c = !1;
  18350. break
  18351. } if (c) return a
  18352. }
  18353. return -1
  18354. }
  18355. function y(e, t, i, r) {
  18356. i = Number(i) || 0;
  18357. var n = e.length - i;
  18358. r ? (r = Number(r)) > n && (r = n) : r = n;
  18359. var a = t.length;
  18360. if (a % 2 != 0) throw new TypeError("Invalid hex string");
  18361. r > a / 2 && (r = a / 2);
  18362. for (var s = 0; s < r; ++s) {
  18363. var o = parseInt(t.substr(2 * s, 2), 16);
  18364. if (isNaN(o)) return s;
  18365. e[i + s] = o
  18366. }
  18367. return s
  18368. }
  18369. function _(e, t, i, r) {
  18370. return H(F(t, e.length - i), e, i, r)
  18371. }
  18372. function b(e, t, i, r) {
  18373. return H(function(e) {
  18374. for (var t = [], i = 0; i < e.length; ++i) t.push(255 & e.charCodeAt(i));
  18375. return t
  18376. }(t), e, i, r)
  18377. }
  18378. function w(e, t, i, r) {
  18379. return b(e, t, i, r)
  18380. }
  18381. function E(e, t, i, r) {
  18382. return H(j(t), e, i, r)
  18383. }
  18384. function T(e, t, i, r) {
  18385. return H(function(e, t) {
  18386. for (var i, r, n, a = [], s = 0; s < e.length && !((t -= 2) < 0); ++s) r = (i = e.charCodeAt(
  18387. s)) >> 8, n = i % 256, a.push(n), a.push(r);
  18388. return a
  18389. }(t, e.length - i), e, i, r)
  18390. }
  18391. function S(e, t, i) {
  18392. return 0 === t && i === e.length ? r.fromByteArray(e) : r.fromByteArray(e.slice(t, i))
  18393. }
  18394. function A(e, t, i) {
  18395. i = Math.min(e.length, i);
  18396. for (var r = [], n = t; n < i;) {
  18397. var a, s, o, u, l = e[n],
  18398. d = null,
  18399. c = l > 239 ? 4 : l > 223 ? 3 : l > 191 ? 2 : 1;
  18400. if (n + c <= i) switch (c) {
  18401. case 1:
  18402. l < 128 && (d = l);
  18403. break;
  18404. case 2:
  18405. 128 == (192 & (a = e[n + 1])) && (u = (31 & l) << 6 | 63 & a) > 127 && (d = u);
  18406. break;
  18407. case 3:
  18408. a = e[n + 1], s = e[n + 2], 128 == (192 & a) && 128 == (192 & s) && (u = (15 & l) << 12 | (
  18409. 63 & a) << 6 | 63 & s) > 2047 && (u < 55296 || u > 57343) && (d = u);
  18410. break;
  18411. case 4:
  18412. a = e[n + 1], s = e[n + 2], o = e[n + 3], 128 == (192 & a) && 128 == (192 & s) && 128 == (
  18413. 192 & o) && (u = (15 & l) << 18 | (63 & a) << 12 | (63 & s) << 6 | 63 & o) > 65535 && u <
  18414. 1114112 && (d = u)
  18415. }
  18416. null === d ? (d = 65533, c = 1) : d > 65535 && (d -= 65536, r.push(d >>> 10 & 1023 | 55296), d =
  18417. 56320 | 1023 & d), r.push(d), n += c
  18418. }
  18419. return function(e) {
  18420. var t = e.length;
  18421. if (t <= 4096) return String.fromCharCode.apply(String, e);
  18422. for (var i = "", r = 0; r < t;) i += String.fromCharCode.apply(String, e.slice(r, r += 4096));
  18423. return i
  18424. }(r)
  18425. }
  18426. function k(e, t, i) {
  18427. var r = "";
  18428. i = Math.min(e.length, i);
  18429. for (var n = t; n < i; ++n) r += String.fromCharCode(127 & e[n]);
  18430. return r
  18431. }
  18432. function R(e, t, i) {
  18433. var r = "";
  18434. i = Math.min(e.length, i);
  18435. for (var n = t; n < i; ++n) r += String.fromCharCode(e[n]);
  18436. return r
  18437. }
  18438. function M(e, t, i) {
  18439. var r = e.length;
  18440. (!t || t < 0) && (t = 0), (!i || i < 0 || i > r) && (i = r);
  18441. for (var n = "", a = t; a < i; ++a) n += B(e[a]);
  18442. return n
  18443. }
  18444. function O(e, t, i) {
  18445. for (var r = e.slice(t, i), n = "", a = 0; a < r.length; a += 2) n += String.fromCharCode(r[a] + 256 *
  18446. r[a + 1]);
  18447. return n
  18448. }
  18449. function C(e, t, i) {
  18450. if (e % 1 != 0 || e < 0) throw new RangeError("offset is not uint");
  18451. if (e + t > i) throw new RangeError("Trying to access beyond buffer length")
  18452. }
  18453. function D(e, t, i, r, n, a) {
  18454. if (!u.isBuffer(e)) throw new TypeError('"buffer" argument must be a Buffer instance');
  18455. if (t > n || t < a) throw new RangeError('"value" argument is out of bounds');
  18456. if (i + r > e.length) throw new RangeError("Index out of range")
  18457. }
  18458. function I(e, t, i, r) {
  18459. t < 0 && (t = 65535 + t + 1);
  18460. for (var n = 0, a = Math.min(e.length - i, 2); n < a; ++n) e[i + n] = (t & 255 << 8 * (r ? n : 1 -
  18461. n)) >>> 8 * (r ? n : 1 - n)
  18462. }
  18463. function L(e, t, i, r) {
  18464. t < 0 && (t = 4294967295 + t + 1);
  18465. for (var n = 0, a = Math.min(e.length - i, 4); n < a; ++n) e[i + n] = t >>> 8 * (r ? n : 3 - n) & 255
  18466. }
  18467. function x(e, t, i, r, n, a) {
  18468. if (i + r > e.length) throw new RangeError("Index out of range");
  18469. if (i < 0) throw new RangeError("Index out of range")
  18470. }
  18471. function P(e, t, i, r, a) {
  18472. return a || x(e, 0, i, 4), n.write(e, t, i, r, 23, 4), i + 4
  18473. }
  18474. function U(e, t, i, r, a) {
  18475. return a || x(e, 0, i, 8), n.write(e, t, i, r, 52, 8), i + 8
  18476. }
  18477. t.Buffer = u, t.SlowBuffer = function(e) {
  18478. return +e != e && (e = 0), u.alloc(+e)
  18479. }, t.INSPECT_MAX_BYTES = 50, u.TYPED_ARRAY_SUPPORT = void 0 !== e.TYPED_ARRAY_SUPPORT ? e
  18480. .TYPED_ARRAY_SUPPORT : function() {
  18481. try {
  18482. var e = new Uint8Array(1);
  18483. return e.__proto__ = {
  18484. __proto__: Uint8Array.prototype,
  18485. foo: function() {
  18486. return 42
  18487. }
  18488. }, 42 === e.foo() && "function" == typeof e.subarray && 0 === e.subarray(1, 1).byteLength
  18489. } catch (e) {
  18490. return !1
  18491. }
  18492. }(), t.kMaxLength = s(), u.poolSize = 8192, u._augment = function(e) {
  18493. return e.__proto__ = u.prototype, e
  18494. }, u.from = function(e, t, i) {
  18495. return l(null, e, t, i)
  18496. }, u.TYPED_ARRAY_SUPPORT && (u.prototype.__proto__ = Uint8Array.prototype, u.__proto__ = Uint8Array,
  18497. "undefined" != typeof Symbol && Symbol.species && u[Symbol.species] === u && Object.defineProperty(
  18498. u, Symbol.species, {
  18499. value: null,
  18500. configurable: !0
  18501. })), u.alloc = function(e, t, i) {
  18502. return function(e, t, i, r) {
  18503. return d(t), t <= 0 ? o(e, t) : void 0 !== i ? "string" == typeof r ? o(e, t).fill(i, r) : o(e,
  18504. t).fill(i) : o(e, t)
  18505. }(null, e, t, i)
  18506. }, u.allocUnsafe = function(e) {
  18507. return c(null, e)
  18508. }, u.allocUnsafeSlow = function(e) {
  18509. return c(null, e)
  18510. }, u.isBuffer = function(e) {
  18511. return !(null == e || !e._isBuffer)
  18512. }, u.compare = function(e, t) {
  18513. if (!u.isBuffer(e) || !u.isBuffer(t)) throw new TypeError("Arguments must be Buffers");
  18514. if (e === t) return 0;
  18515. for (var i = e.length, r = t.length, n = 0, a = Math.min(i, r); n < a; ++n)
  18516. if (e[n] !== t[n]) {
  18517. i = e[n], r = t[n];
  18518. break
  18519. } return i < r ? -1 : r < i ? 1 : 0
  18520. }, u.isEncoding = function(e) {
  18521. switch (String(e).toLowerCase()) {
  18522. case "hex":
  18523. case "utf8":
  18524. case "utf-8":
  18525. case "ascii":
  18526. case "latin1":
  18527. case "binary":
  18528. case "base64":
  18529. case "ucs2":
  18530. case "ucs-2":
  18531. case "utf16le":
  18532. case "utf-16le":
  18533. return !0;
  18534. default:
  18535. return !1
  18536. }
  18537. }, u.concat = function(e, t) {
  18538. if (!a(e)) throw new TypeError('"list" argument must be an Array of Buffers');
  18539. if (0 === e.length) return u.alloc(0);
  18540. var i;
  18541. if (void 0 === t)
  18542. for (t = 0, i = 0; i < e.length; ++i) t += e[i].length;
  18543. var r = u.allocUnsafe(t),
  18544. n = 0;
  18545. for (i = 0; i < e.length; ++i) {
  18546. var s = e[i];
  18547. if (!u.isBuffer(s)) throw new TypeError('"list" argument must be an Array of Buffers');
  18548. s.copy(r, n), n += s.length
  18549. }
  18550. return r
  18551. }, u.byteLength = p, u.prototype._isBuffer = !0, u.prototype.swap16 = function() {
  18552. var e = this.length;
  18553. if (e % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
  18554. for (var t = 0; t < e; t += 2) m(this, t, t + 1);
  18555. return this
  18556. }, u.prototype.swap32 = function() {
  18557. var e = this.length;
  18558. if (e % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
  18559. for (var t = 0; t < e; t += 4) m(this, t, t + 3), m(this, t + 1, t + 2);
  18560. return this
  18561. }, u.prototype.swap64 = function() {
  18562. var e = this.length;
  18563. if (e % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
  18564. for (var t = 0; t < e; t += 8) m(this, t, t + 7), m(this, t + 1, t + 6), m(this, t + 2, t + 5), m(
  18565. this, t + 3, t + 4);
  18566. return this
  18567. }, u.prototype.toString = function() {
  18568. var e = 0 | this.length;
  18569. return 0 === e ? "" : 0 === arguments.length ? A(this, 0, e) : function(e, t, i) {
  18570. var r = !1;
  18571. if ((void 0 === t || t < 0) && (t = 0), t > this.length) return "";
  18572. if ((void 0 === i || i > this.length) && (i = this.length), i <= 0) return "";
  18573. if ((i >>>= 0) <= (t >>>= 0)) return "";
  18574. for (e || (e = "utf8");;) switch (e) {
  18575. case "hex":
  18576. return M(this, t, i);
  18577. case "utf8":
  18578. case "utf-8":
  18579. return A(this, t, i);
  18580. case "ascii":
  18581. return k(this, t, i);
  18582. case "latin1":
  18583. case "binary":
  18584. return R(this, t, i);
  18585. case "base64":
  18586. return S(this, t, i);
  18587. case "ucs2":
  18588. case "ucs-2":
  18589. case "utf16le":
  18590. case "utf-16le":
  18591. return O(this, t, i);
  18592. default:
  18593. if (r) throw new TypeError("Unknown encoding: " + e);
  18594. e = (e + "").toLowerCase(), r = !0
  18595. }
  18596. }.apply(this, arguments)
  18597. }, u.prototype.equals = function(e) {
  18598. if (!u.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
  18599. return this === e || 0 === u.compare(this, e)
  18600. }, u.prototype.inspect = function() {
  18601. var e = "",
  18602. i = t.INSPECT_MAX_BYTES;
  18603. return this.length > 0 && (e = this.toString("hex", 0, i).match(/.{2}/g).join(" "), this.length >
  18604. i && (e += " ... ")), "<Buffer " + e + ">"
  18605. }, u.prototype.compare = function(e, t, i, r, n) {
  18606. if (!u.isBuffer(e)) throw new TypeError("Argument must be a Buffer");
  18607. if (void 0 === t && (t = 0), void 0 === i && (i = e ? e.length : 0), void 0 === r && (r = 0),
  18608. void 0 === n && (n = this.length), t < 0 || i > e.length || r < 0 || n > this.length)
  18609. throw new RangeError("out of range index");
  18610. if (r >= n && t >= i) return 0;
  18611. if (r >= n) return -1;
  18612. if (t >= i) return 1;
  18613. if (this === e) return 0;
  18614. for (var a = (n >>>= 0) - (r >>>= 0), s = (i >>>= 0) - (t >>>= 0), o = Math.min(a, s), l = this
  18615. .slice(r, n), d = e.slice(t, i), c = 0; c < o; ++c)
  18616. if (l[c] !== d[c]) {
  18617. a = l[c], s = d[c];
  18618. break
  18619. } return a < s ? -1 : s < a ? 1 : 0
  18620. }, u.prototype.includes = function(e, t, i) {
  18621. return -1 !== this.indexOf(e, t, i)
  18622. }, u.prototype.indexOf = function(e, t, i) {
  18623. return g(this, e, t, i, !0)
  18624. }, u.prototype.lastIndexOf = function(e, t, i) {
  18625. return g(this, e, t, i, !1)
  18626. }, u.prototype.write = function(e, t, i, r) {
  18627. if (void 0 === t) r = "utf8", i = this.length, t = 0;
  18628. else if (void 0 === i && "string" == typeof t) r = t, i = this.length, t = 0;
  18629. else {
  18630. if (!isFinite(t)) throw new Error(
  18631. "Buffer.write(string, encoding, offset[, length]) is no longer supported");
  18632. t |= 0, isFinite(i) ? (i |= 0, void 0 === r && (r = "utf8")) : (r = i, i = void 0)
  18633. }
  18634. var n = this.length - t;
  18635. if ((void 0 === i || i > n) && (i = n), e.length > 0 && (i < 0 || t < 0) || t > this.length)
  18636. throw new RangeError("Attempt to write outside buffer bounds");
  18637. r || (r = "utf8");
  18638. for (var a = !1;;) switch (r) {
  18639. case "hex":
  18640. return y(this, e, t, i);
  18641. case "utf8":
  18642. case "utf-8":
  18643. return _(this, e, t, i);
  18644. case "ascii":
  18645. return b(this, e, t, i);
  18646. case "latin1":
  18647. case "binary":
  18648. return w(this, e, t, i);
  18649. case "base64":
  18650. return E(this, e, t, i);
  18651. case "ucs2":
  18652. case "ucs-2":
  18653. case "utf16le":
  18654. case "utf-16le":
  18655. return T(this, e, t, i);
  18656. default:
  18657. if (a) throw new TypeError("Unknown encoding: " + r);
  18658. r = ("" + r).toLowerCase(), a = !0
  18659. }
  18660. }, u.prototype.toJSON = function() {
  18661. return {
  18662. type: "Buffer",
  18663. data: Array.prototype.slice.call(this._arr || this, 0)
  18664. }
  18665. }, u.prototype.slice = function(e, t) {
  18666. var i, r = this.length;
  18667. if ((e = ~~e) < 0 ? (e += r) < 0 && (e = 0) : e > r && (e = r), (t = void 0 === t ? r : ~~t) < 0 ? (
  18668. t += r) < 0 && (t = 0) : t > r && (t = r), t < e && (t = e), u.TYPED_ARRAY_SUPPORT)(i = this
  18669. .subarray(e, t)).__proto__ = u.prototype;
  18670. else {
  18671. var n = t - e;
  18672. i = new u(n, void 0);
  18673. for (var a = 0; a < n; ++a) i[a] = this[a + e]
  18674. }
  18675. return i
  18676. }, u.prototype.readUIntLE = function(e, t, i) {
  18677. e |= 0, t |= 0, i || C(e, t, this.length);
  18678. for (var r = this[e], n = 1, a = 0; ++a < t && (n *= 256);) r += this[e + a] * n;
  18679. return r
  18680. }, u.prototype.readUIntBE = function(e, t, i) {
  18681. e |= 0, t |= 0, i || C(e, t, this.length);
  18682. for (var r = this[e + --t], n = 1; t > 0 && (n *= 256);) r += this[e + --t] * n;
  18683. return r
  18684. }, u.prototype.readUInt8 = function(e, t) {
  18685. return t || C(e, 1, this.length), this[e]
  18686. }, u.prototype.readUInt16LE = function(e, t) {
  18687. return t || C(e, 2, this.length), this[e] | this[e + 1] << 8
  18688. }, u.prototype.readUInt16BE = function(e, t) {
  18689. return t || C(e, 2, this.length), this[e] << 8 | this[e + 1]
  18690. }, u.prototype.readUInt32LE = function(e, t) {
  18691. return t || C(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + 16777216 *
  18692. this[e + 3]
  18693. }, u.prototype.readUInt32BE = function(e, t) {
  18694. return t || C(e, 4, this.length), 16777216 * this[e] + (this[e + 1] << 16 | this[e + 2] << 8 | this[
  18695. e + 3])
  18696. }, u.prototype.readIntLE = function(e, t, i) {
  18697. e |= 0, t |= 0, i || C(e, t, this.length);
  18698. for (var r = this[e], n = 1, a = 0; ++a < t && (n *= 256);) r += this[e + a] * n;
  18699. return r >= (n *= 128) && (r -= Math.pow(2, 8 * t)), r
  18700. }, u.prototype.readIntBE = function(e, t, i) {
  18701. e |= 0, t |= 0, i || C(e, t, this.length);
  18702. for (var r = t, n = 1, a = this[e + --r]; r > 0 && (n *= 256);) a += this[e + --r] * n;
  18703. return a >= (n *= 128) && (a -= Math.pow(2, 8 * t)), a
  18704. }, u.prototype.readInt8 = function(e, t) {
  18705. return t || C(e, 1, this.length), 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]
  18706. }, u.prototype.readInt16LE = function(e, t) {
  18707. t || C(e, 2, this.length);
  18708. var i = this[e] | this[e + 1] << 8;
  18709. return 32768 & i ? 4294901760 | i : i
  18710. }, u.prototype.readInt16BE = function(e, t) {
  18711. t || C(e, 2, this.length);
  18712. var i = this[e + 1] | this[e] << 8;
  18713. return 32768 & i ? 4294901760 | i : i
  18714. }, u.prototype.readInt32LE = function(e, t) {
  18715. return t || C(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24
  18716. }, u.prototype.readInt32BE = function(e, t) {
  18717. return t || C(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]
  18718. }, u.prototype.readFloatLE = function(e, t) {
  18719. return t || C(e, 4, this.length), n.read(this, e, !0, 23, 4)
  18720. }, u.prototype.readFloatBE = function(e, t) {
  18721. return t || C(e, 4, this.length), n.read(this, e, !1, 23, 4)
  18722. }, u.prototype.readDoubleLE = function(e, t) {
  18723. return t || C(e, 8, this.length), n.read(this, e, !0, 52, 8)
  18724. }, u.prototype.readDoubleBE = function(e, t) {
  18725. return t || C(e, 8, this.length), n.read(this, e, !1, 52, 8)
  18726. }, u.prototype.writeUIntLE = function(e, t, i, r) {
  18727. e = +e, t |= 0, i |= 0, r || D(this, e, t, i, Math.pow(2, 8 * i) - 1, 0);
  18728. var n = 1,
  18729. a = 0;
  18730. for (this[t] = 255 & e; ++a < i && (n *= 256);) this[t + a] = e / n & 255;
  18731. return t + i
  18732. }, u.prototype.writeUIntBE = function(e, t, i, r) {
  18733. e = +e, t |= 0, i |= 0, r || D(this, e, t, i, Math.pow(2, 8 * i) - 1, 0);
  18734. var n = i - 1,
  18735. a = 1;
  18736. for (this[t + n] = 255 & e; --n >= 0 && (a *= 256);) this[t + n] = e / a & 255;
  18737. return t + i
  18738. }, u.prototype.writeUInt8 = function(e, t, i) {
  18739. return e = +e, t |= 0, i || D(this, e, t, 1, 255, 0), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(e)),
  18740. this[t] = 255 & e, t + 1
  18741. }, u.prototype.writeUInt16LE = function(e, t, i) {
  18742. return e = +e, t |= 0, i || D(this, e, t, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[t] = 255 & e,
  18743. this[t + 1] = e >>> 8) : I(this, e, t, !0), t + 2
  18744. }, u.prototype.writeUInt16BE = function(e, t, i) {
  18745. return e = +e, t |= 0, i || D(this, e, t, 2, 65535, 0), u.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 8,
  18746. this[t + 1] = 255 & e) : I(this, e, t, !1), t + 2
  18747. }, u.prototype.writeUInt32LE = function(e, t, i) {
  18748. return e = +e, t |= 0, i || D(this, e, t, 4, 4294967295, 0), u.TYPED_ARRAY_SUPPORT ? (this[t + 3] =
  18749. e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = 255 & e) : L(this, e, t, !0),
  18750. t + 4
  18751. }, u.prototype.writeUInt32BE = function(e, t, i) {
  18752. return e = +e, t |= 0, i || D(this, e, t, 4, 4294967295, 0), u.TYPED_ARRAY_SUPPORT ? (this[t] =
  18753. e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = 255 & e) : L(this, e, t,
  18754. !1), t + 4
  18755. }, u.prototype.writeIntLE = function(e, t, i, r) {
  18756. if (e = +e, t |= 0, !r) {
  18757. var n = Math.pow(2, 8 * i - 1);
  18758. D(this, e, t, i, n - 1, -n)
  18759. }
  18760. var a = 0,
  18761. s = 1,
  18762. o = 0;
  18763. for (this[t] = 255 & e; ++a < i && (s *= 256);) e < 0 && 0 === o && 0 !== this[t + a - 1] && (o =
  18764. 1), this[t + a] = (e / s >> 0) - o & 255;
  18765. return t + i
  18766. }, u.prototype.writeIntBE = function(e, t, i, r) {
  18767. if (e = +e, t |= 0, !r) {
  18768. var n = Math.pow(2, 8 * i - 1);
  18769. D(this, e, t, i, n - 1, -n)
  18770. }
  18771. var a = i - 1,
  18772. s = 1,
  18773. o = 0;
  18774. for (this[t + a] = 255 & e; --a >= 0 && (s *= 256);) e < 0 && 0 === o && 0 !== this[t + a + 1] && (
  18775. o = 1), this[t + a] = (e / s >> 0) - o & 255;
  18776. return t + i
  18777. }, u.prototype.writeInt8 = function(e, t, i) {
  18778. return e = +e, t |= 0, i || D(this, e, t, 1, 127, -128), u.TYPED_ARRAY_SUPPORT || (e = Math.floor(
  18779. e)), e < 0 && (e = 255 + e + 1), this[t] = 255 & e, t + 1
  18780. }, u.prototype.writeInt16LE = function(e, t, i) {
  18781. return e = +e, t |= 0, i || D(this, e, t, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[t] =
  18782. 255 & e, this[t + 1] = e >>> 8) : I(this, e, t, !0), t + 2
  18783. }, u.prototype.writeInt16BE = function(e, t, i) {
  18784. return e = +e, t |= 0, i || D(this, e, t, 2, 32767, -32768), u.TYPED_ARRAY_SUPPORT ? (this[t] =
  18785. e >>> 8, this[t + 1] = 255 & e) : I(this, e, t, !1), t + 2
  18786. }, u.prototype.writeInt32LE = function(e, t, i) {
  18787. return e = +e, t |= 0, i || D(this, e, t, 4, 2147483647, -2147483648), u.TYPED_ARRAY_SUPPORT ? (
  18788. this[t] = 255 & e, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24) : L(
  18789. this, e, t, !0), t + 4
  18790. }, u.prototype.writeInt32BE = function(e, t, i) {
  18791. return e = +e, t |= 0, i || D(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 +
  18792. e + 1), u.TYPED_ARRAY_SUPPORT ? (this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>>
  18793. 8, this[t + 3] = 255 & e) : L(this, e, t, !1), t + 4
  18794. }, u.prototype.writeFloatLE = function(e, t, i) {
  18795. return P(this, e, t, !0, i)
  18796. }, u.prototype.writeFloatBE = function(e, t, i) {
  18797. return P(this, e, t, !1, i)
  18798. }, u.prototype.writeDoubleLE = function(e, t, i) {
  18799. return U(this, e, t, !0, i)
  18800. }, u.prototype.writeDoubleBE = function(e, t, i) {
  18801. return U(this, e, t, !1, i)
  18802. }, u.prototype.copy = function(e, t, i, r) {
  18803. if (i || (i = 0), r || 0 === r || (r = this.length), t >= e.length && (t = e.length), t || (t = 0),
  18804. r > 0 && r < i && (r = i), r === i) return 0;
  18805. if (0 === e.length || 0 === this.length) return 0;
  18806. if (t < 0) throw new RangeError("targetStart out of bounds");
  18807. if (i < 0 || i >= this.length) throw new RangeError("sourceStart out of bounds");
  18808. if (r < 0) throw new RangeError("sourceEnd out of bounds");
  18809. r > this.length && (r = this.length), e.length - t < r - i && (r = e.length - t + i);
  18810. var n, a = r - i;
  18811. if (this === e && i < t && t < r)
  18812. for (n = a - 1; n >= 0; --n) e[n + t] = this[n + i];
  18813. else if (a < 1e3 || !u.TYPED_ARRAY_SUPPORT)
  18814. for (n = 0; n < a; ++n) e[n + t] = this[n + i];
  18815. else Uint8Array.prototype.set.call(e, this.subarray(i, i + a), t);
  18816. return a
  18817. }, u.prototype.fill = function(e, t, i, r) {
  18818. if ("string" == typeof e) {
  18819. if ("string" == typeof t ? (r = t, t = 0, i = this.length) : "string" == typeof i && (r = i, i =
  18820. this.length), 1 === e.length) {
  18821. var n = e.charCodeAt(0);
  18822. n < 256 && (e = n)
  18823. }
  18824. if (void 0 !== r && "string" != typeof r) throw new TypeError("encoding must be a string");
  18825. if ("string" == typeof r && !u.isEncoding(r)) throw new TypeError("Unknown encoding: " + r)
  18826. } else "number" == typeof e && (e &= 255);
  18827. if (t < 0 || this.length < t || this.length < i) throw new RangeError("Out of range index");
  18828. if (i <= t) return this;
  18829. var a;
  18830. if (t >>>= 0, i = void 0 === i ? this.length : i >>> 0, e || (e = 0), "number" == typeof e)
  18831. for (a = t; a < i; ++a) this[a] = e;
  18832. else {
  18833. var s = u.isBuffer(e) ? e : F(new u(e, r).toString()),
  18834. o = s.length;
  18835. for (a = 0; a < i - t; ++a) this[a + t] = s[a % o]
  18836. }
  18837. return this
  18838. };
  18839. var N = /[^+\/0-9A-Za-z-_]/g;
  18840. function B(e) {
  18841. return e < 16 ? "0" + e.toString(16) : e.toString(16)
  18842. }
  18843. function F(e, t) {
  18844. var i;
  18845. t = t || 1 / 0;
  18846. for (var r = e.length, n = null, a = [], s = 0; s < r; ++s) {
  18847. if ((i = e.charCodeAt(s)) > 55295 && i < 57344) {
  18848. if (!n) {
  18849. if (i > 56319) {
  18850. (t -= 3) > -1 && a.push(239, 191, 189);
  18851. continue
  18852. }
  18853. if (s + 1 === r) {
  18854. (t -= 3) > -1 && a.push(239, 191, 189);
  18855. continue
  18856. }
  18857. n = i;
  18858. continue
  18859. }
  18860. if (i < 56320) {
  18861. (t -= 3) > -1 && a.push(239, 191, 189), n = i;
  18862. continue
  18863. }
  18864. i = 65536 + (n - 55296 << 10 | i - 56320)
  18865. } else n && (t -= 3) > -1 && a.push(239, 191, 189);
  18866. if (n = null, i < 128) {
  18867. if ((t -= 1) < 0) break;
  18868. a.push(i)
  18869. } else if (i < 2048) {
  18870. if ((t -= 2) < 0) break;
  18871. a.push(i >> 6 | 192, 63 & i | 128)
  18872. } else if (i < 65536) {
  18873. if ((t -= 3) < 0) break;
  18874. a.push(i >> 12 | 224, i >> 6 & 63 | 128, 63 & i | 128)
  18875. } else {
  18876. if (!(i < 1114112)) throw new Error("Invalid code point");
  18877. if ((t -= 4) < 0) break;
  18878. a.push(i >> 18 | 240, i >> 12 & 63 | 128, i >> 6 & 63 | 128, 63 & i | 128)
  18879. }
  18880. }
  18881. return a
  18882. }
  18883. function j(e) {
  18884. return r.toByteArray(function(e) {
  18885. if ((e = function(e) {
  18886. return e.trim ? e.trim() : e.replace(/^\s+|\s+$/g, "")
  18887. }(e).replace(N, "")).length < 2) return "";
  18888. for (; e.length % 4 != 0;) e += "=";
  18889. return e
  18890. }(e))
  18891. }
  18892. function H(e, t, i, r) {
  18893. for (var n = 0; n < r && !(n + i >= t.length || n >= e.length); ++n) t[n + i] = e[n];
  18894. return n
  18895. }
  18896. }).call(this, i(13))
  18897. }, function(e, t, i) {
  18898. (function(e) {
  18899. ! function(e, t) {
  18900. "use strict";
  18901. function r(e, t) {
  18902. if (!e) throw new Error(t || "Assertion failed")
  18903. }
  18904. function n(e, t) {
  18905. e.super_ = t;
  18906. var i = function() {};
  18907. i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e
  18908. }
  18909. function a(e, t, i) {
  18910. if (a.isBN(e)) return e;
  18911. this.negative = 0, this.words = null, this.length = 0, this.red = null, null !== e && ("le" !== t &&
  18912. "be" !== t || (i = t, t = 10), this._init(e || 0, t || 10, i || "be"))
  18913. }
  18914. var s;
  18915. "object" == typeof e ? e.exports = a : t.BN = a, a.BN = a, a.wordSize = 26;
  18916. try {
  18917. s = "undefined" != typeof window && void 0 !== window.Buffer ? window.Buffer : i(178).Buffer
  18918. } catch (e) {}
  18919. function o(e, t) {
  18920. var i = e.charCodeAt(t);
  18921. return i >= 65 && i <= 70 ? i - 55 : i >= 97 && i <= 102 ? i - 87 : i - 48 & 15
  18922. }
  18923. function u(e, t, i) {
  18924. var r = o(e, i);
  18925. return i - 1 >= t && (r |= o(e, i - 1) << 4), r
  18926. }
  18927. function l(e, t, i, r) {
  18928. for (var n = 0, a = Math.min(e.length, i), s = t; s < a; s++) {
  18929. var o = e.charCodeAt(s) - 48;
  18930. n *= r, n += o >= 49 ? o - 49 + 10 : o >= 17 ? o - 17 + 10 : o
  18931. }
  18932. return n
  18933. }
  18934. a.isBN = function(e) {
  18935. return e instanceof a || null !== e && "object" == typeof e && e.constructor.wordSize === a
  18936. .wordSize && Array.isArray(e.words)
  18937. }, a.max = function(e, t) {
  18938. return e.cmp(t) > 0 ? e : t
  18939. }, a.min = function(e, t) {
  18940. return e.cmp(t) < 0 ? e : t
  18941. }, a.prototype._init = function(e, t, i) {
  18942. if ("number" == typeof e) return this._initNumber(e, t, i);
  18943. if ("object" == typeof e) return this._initArray(e, t, i);
  18944. "hex" === t && (t = 16), r(t === (0 | t) && t >= 2 && t <= 36);
  18945. var n = 0;
  18946. "-" === (e = e.toString().replace(/\s+/g, ""))[0] && (n++, this.negative = 1), n < e.length && (
  18947. 16 === t ? this._parseHex(e, n, i) : (this._parseBase(e, t, n), "le" === i && this._initArray(
  18948. this.toArray(), t, i)))
  18949. }, a.prototype._initNumber = function(e, t, i) {
  18950. e < 0 && (this.negative = 1, e = -e), e < 67108864 ? (this.words = [67108863 & e], this.length =
  18951. 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], this
  18952. .length = 2) : (r(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863,
  18953. 1
  18954. ], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i)
  18955. }, a.prototype._initArray = function(e, t, i) {
  18956. if (r("number" == typeof e.length), e.length <= 0) return this.words = [0], this.length = 1, this;
  18957. this.length = Math.ceil(e.length / 3), this.words = new Array(this.length);
  18958. for (var n = 0; n < this.length; n++) this.words[n] = 0;
  18959. var a, s, o = 0;
  18960. if ("be" === i)
  18961. for (n = e.length - 1, a = 0; n >= 0; n -= 3) s = e[n] | e[n - 1] << 8 | e[n - 2] << 16, this
  18962. .words[a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >=
  18963. 26 && (o -= 26, a++);
  18964. else if ("le" === i)
  18965. for (n = 0, a = 0; n < e.length; n += 3) s = e[n] | e[n + 1] << 8 | e[n + 2] << 16, this.words[
  18966. a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && (
  18967. o -= 26, a++);
  18968. return this.strip()
  18969. }, a.prototype._parseHex = function(e, t, i) {
  18970. this.length = Math.ceil((e.length - t) / 6), this.words = new Array(this.length);
  18971. for (var r = 0; r < this.length; r++) this.words[r] = 0;
  18972. var n, a = 0,
  18973. s = 0;
  18974. if ("be" === i)
  18975. for (r = e.length - 1; r >= t; r -= 2) n = u(e, t, r) << a, this.words[s] |= 67108863 & n, a >=
  18976. 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8;
  18977. else
  18978. for (r = (e.length - t) % 2 == 0 ? t + 1 : t; r < e.length; r += 2) n = u(e, t, r) << a, this
  18979. .words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8;
  18980. this.strip()
  18981. }, a.prototype._parseBase = function(e, t, i) {
  18982. this.words = [0], this.length = 1;
  18983. for (var r = 0, n = 1; n <= 67108863; n *= t) r++;
  18984. r--, n = n / t | 0;
  18985. for (var a = e.length - i, s = a % r, o = Math.min(a, a - s) + i, u = 0, d = i; d < o; d += r) u =
  18986. l(e, d, d + r, t), this.imuln(n), this.words[0] + u < 67108864 ? this.words[0] += u : this
  18987. ._iaddn(u);
  18988. if (0 !== s) {
  18989. var c = 1;
  18990. for (u = l(e, d, e.length, t), d = 0; d < s; d++) c *= t;
  18991. this.imuln(c), this.words[0] + u < 67108864 ? this.words[0] += u : this._iaddn(u)
  18992. }
  18993. this.strip()
  18994. }, a.prototype.copy = function(e) {
  18995. e.words = new Array(this.length);
  18996. for (var t = 0; t < this.length; t++) e.words[t] = this.words[t];
  18997. e.length = this.length, e.negative = this.negative, e.red = this.red
  18998. }, a.prototype.clone = function() {
  18999. var e = new a(null);
  19000. return this.copy(e), e
  19001. }, a.prototype._expand = function(e) {
  19002. for (; this.length < e;) this.words[this.length++] = 0;
  19003. return this
  19004. }, a.prototype.strip = function() {
  19005. for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--;
  19006. return this._normSign()
  19007. }, a.prototype._normSign = function() {
  19008. return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this
  19009. }, a.prototype.inspect = function() {
  19010. return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">"
  19011. };
  19012. var d = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000",
  19013. "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000",
  19014. "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000",
  19015. "00000000000000000000", "000000000000000000000", "0000000000000000000000",
  19016. "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000"
  19017. ],
  19018. c = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  19019. 5, 5, 5, 5, 5, 5, 5
  19020. ],
  19021. h = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7,
  19022. 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6,
  19023. 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5,
  19024. 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  19025. ];
  19026. function f(e, t, i) {
  19027. i.negative = t.negative ^ e.negative;
  19028. var r = e.length + t.length | 0;
  19029. i.length = r, r = r - 1 | 0;
  19030. var n = 0 | e.words[0],
  19031. a = 0 | t.words[0],
  19032. s = n * a,
  19033. o = 67108863 & s,
  19034. u = s / 67108864 | 0;
  19035. i.words[0] = o;
  19036. for (var l = 1; l < r; l++) {
  19037. for (var d = u >>> 26, c = 67108863 & u, h = Math.min(l, t.length - 1), f = Math.max(0, l - e
  19038. .length + 1); f <= h; f++) {
  19039. var p = l - f | 0;
  19040. d += (s = (n = 0 | e.words[p]) * (a = 0 | t.words[f]) + c) / 67108864 | 0, c = 67108863 & s
  19041. }
  19042. i.words[l] = 0 | c, u = 0 | d
  19043. }
  19044. return 0 !== u ? i.words[l] = 0 | u : i.length--, i.strip()
  19045. }
  19046. a.prototype.toString = function(e, t) {
  19047. var i;
  19048. if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) {
  19049. i = "";
  19050. for (var n = 0, a = 0, s = 0; s < this.length; s++) {
  19051. var o = this.words[s],
  19052. u = (16777215 & (o << n | a)).toString(16);
  19053. i = 0 != (a = o >>> 24 - n & 16777215) || s !== this.length - 1 ? d[6 - u.length] + u + i :
  19054. u + i, (n += 2) >= 26 && (n -= 26, s--)
  19055. }
  19056. for (0 !== a && (i = a.toString(16) + i); i.length % t != 0;) i = "0" + i;
  19057. return 0 !== this.negative && (i = "-" + i), i
  19058. }
  19059. if (e === (0 | e) && e >= 2 && e <= 36) {
  19060. var l = c[e],
  19061. f = h[e];
  19062. i = "";
  19063. var p = this.clone();
  19064. for (p.negative = 0; !p.isZero();) {
  19065. var m = p.modn(f).toString(e);
  19066. i = (p = p.idivn(f)).isZero() ? m + i : d[l - m.length] + m + i
  19067. }
  19068. for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i;
  19069. return 0 !== this.negative && (i = "-" + i), i
  19070. }
  19071. r(!1, "Base should be between 2 and 36")
  19072. }, a.prototype.toNumber = function() {
  19073. var e = this.words[0];
  19074. return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[
  19075. 2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(!1,
  19076. "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e
  19077. }, a.prototype.toJSON = function() {
  19078. return this.toString(16)
  19079. }, a.prototype.toBuffer = function(e, t) {
  19080. return r(void 0 !== s), this.toArrayLike(s, e, t)
  19081. }, a.prototype.toArray = function(e, t) {
  19082. return this.toArrayLike(Array, e, t)
  19083. }, a.prototype.toArrayLike = function(e, t, i) {
  19084. var n = this.byteLength(),
  19085. a = i || Math.max(1, n);
  19086. r(n <= a, "byte array longer than desired length"), r(a > 0, "Requested array length <= 0"), this
  19087. .strip();
  19088. var s, o, u = "le" === t,
  19089. l = new e(a),
  19090. d = this.clone();
  19091. if (u) {
  19092. for (o = 0; !d.isZero(); o++) s = d.andln(255), d.iushrn(8), l[o] = s;
  19093. for (; o < a; o++) l[o] = 0
  19094. } else {
  19095. for (o = 0; o < a - n; o++) l[o] = 0;
  19096. for (o = 0; !d.isZero(); o++) s = d.andln(255), d.iushrn(8), l[a - o - 1] = s
  19097. }
  19098. return l
  19099. }, Math.clz32 ? a.prototype._countBits = function(e) {
  19100. return 32 - Math.clz32(e)
  19101. } : a.prototype._countBits = function(e) {
  19102. var t = e,
  19103. i = 0;
  19104. return t >= 4096 && (i += 13, t >>>= 13), t >= 64 && (i += 7, t >>>= 7), t >= 8 && (i += 4, t >>>=
  19105. 4), t >= 2 && (i += 2, t >>>= 2), i + t
  19106. }, a.prototype._zeroBits = function(e) {
  19107. if (0 === e) return 26;
  19108. var t = e,
  19109. i = 0;
  19110. return 0 == (8191 & t) && (i += 13, t >>>= 13), 0 == (127 & t) && (i += 7, t >>>= 7), 0 == (15 &
  19111. t) && (i += 4, t >>>= 4), 0 == (3 & t) && (i += 2, t >>>= 2), 0 == (1 & t) && i++, i
  19112. }, a.prototype.bitLength = function() {
  19113. var e = this.words[this.length - 1],
  19114. t = this._countBits(e);
  19115. return 26 * (this.length - 1) + t
  19116. }, a.prototype.zeroBits = function() {
  19117. if (this.isZero()) return 0;
  19118. for (var e = 0, t = 0; t < this.length; t++) {
  19119. var i = this._zeroBits(this.words[t]);
  19120. if (e += i, 26 !== i) break
  19121. }
  19122. return e
  19123. }, a.prototype.byteLength = function() {
  19124. return Math.ceil(this.bitLength() / 8)
  19125. }, a.prototype.toTwos = function(e) {
  19126. return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone()
  19127. }, a.prototype.fromTwos = function(e) {
  19128. return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone()
  19129. }, a.prototype.isNeg = function() {
  19130. return 0 !== this.negative
  19131. }, a.prototype.neg = function() {
  19132. return this.clone().ineg()
  19133. }, a.prototype.ineg = function() {
  19134. return this.isZero() || (this.negative ^= 1), this
  19135. }, a.prototype.iuor = function(e) {
  19136. for (; this.length < e.length;) this.words[this.length++] = 0;
  19137. for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t];
  19138. return this.strip()
  19139. }, a.prototype.ior = function(e) {
  19140. return r(0 == (this.negative | e.negative)), this.iuor(e)
  19141. }, a.prototype.or = function(e) {
  19142. return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this)
  19143. }, a.prototype.uor = function(e) {
  19144. return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this)
  19145. }, a.prototype.iuand = function(e) {
  19146. var t;
  19147. t = this.length > e.length ? e : this;
  19148. for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i];
  19149. return this.length = t.length, this.strip()
  19150. }, a.prototype.iand = function(e) {
  19151. return r(0 == (this.negative | e.negative)), this.iuand(e)
  19152. }, a.prototype.and = function(e) {
  19153. return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this)
  19154. }, a.prototype.uand = function(e) {
  19155. return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this)
  19156. }, a.prototype.iuxor = function(e) {
  19157. var t, i;
  19158. this.length > e.length ? (t = this, i = e) : (t = e, i = this);
  19159. for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r];
  19160. if (this !== t)
  19161. for (; r < t.length; r++) this.words[r] = t.words[r];
  19162. return this.length = t.length, this.strip()
  19163. }, a.prototype.ixor = function(e) {
  19164. return r(0 == (this.negative | e.negative)), this.iuxor(e)
  19165. }, a.prototype.xor = function(e) {
  19166. return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this)
  19167. }, a.prototype.uxor = function(e) {
  19168. return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this)
  19169. }, a.prototype.inotn = function(e) {
  19170. r("number" == typeof e && e >= 0);
  19171. var t = 0 | Math.ceil(e / 26),
  19172. i = e % 26;
  19173. this._expand(t), i > 0 && t--;
  19174. for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n];
  19175. return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), this.strip()
  19176. }, a.prototype.notn = function(e) {
  19177. return this.clone().inotn(e)
  19178. }, a.prototype.setn = function(e, t) {
  19179. r("number" == typeof e && e >= 0);
  19180. var i = e / 26 | 0,
  19181. n = e % 26;
  19182. return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 <<
  19183. n), this.strip()
  19184. }, a.prototype.iadd = function(e) {
  19185. var t, i, r;
  19186. if (0 !== this.negative && 0 === e.negative) return this.negative = 0, t = this.isub(e), this
  19187. .negative ^= 1, this._normSign();
  19188. if (0 === this.negative && 0 !== e.negative) return e.negative = 0, t = this.isub(e), e.negative =
  19189. 1, t._normSign();
  19190. this.length > e.length ? (i = this, r = e) : (i = e, r = this);
  19191. for (var n = 0, a = 0; a < r.length; a++) t = (0 | i.words[a]) + (0 | r.words[a]) + n, this.words[
  19192. a] = 67108863 & t, n = t >>> 26;
  19193. for (; 0 !== n && a < i.length; a++) t = (0 | i.words[a]) + n, this.words[a] = 67108863 & t, n =
  19194. t >>> 26;
  19195. if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++;
  19196. else if (i !== this)
  19197. for (; a < i.length; a++) this.words[a] = i.words[a];
  19198. return this
  19199. }, a.prototype.add = function(e) {
  19200. var t;
  19201. return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, t = this.sub(e), e.negative ^=
  19202. 1, t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, t = e.sub(this), this
  19203. .negative = 1, t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this)
  19204. }, a.prototype.isub = function(e) {
  19205. if (0 !== e.negative) {
  19206. e.negative = 0;
  19207. var t = this.iadd(e);
  19208. return e.negative = 1, t._normSign()
  19209. }
  19210. if (0 !== this.negative) return this.negative = 0, this.iadd(e), this.negative = 1, this
  19211. ._normSign();
  19212. var i, r, n = this.cmp(e);
  19213. if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this;
  19214. n > 0 ? (i = this, r = e) : (i = e, r = this);
  19215. for (var a = 0, s = 0; s < r.length; s++) a = (t = (0 | i.words[s]) - (0 | r.words[s]) + a) >> 26,
  19216. this.words[s] = 67108863 & t;
  19217. for (; 0 !== a && s < i.length; s++) a = (t = (0 | i.words[s]) + a) >> 26, this.words[s] =
  19218. 67108863 & t;
  19219. if (0 === a && s < i.length && i !== this)
  19220. for (; s < i.length; s++) this.words[s] = i.words[s];
  19221. return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this.strip()
  19222. }, a.prototype.sub = function(e) {
  19223. return this.clone().isub(e)
  19224. };
  19225. var p = function(e, t, i) {
  19226. var r, n, a, s = e.words,
  19227. o = t.words,
  19228. u = i.words,
  19229. l = 0,
  19230. d = 0 | s[0],
  19231. c = 8191 & d,
  19232. h = d >>> 13,
  19233. f = 0 | s[1],
  19234. p = 8191 & f,
  19235. m = f >>> 13,
  19236. g = 0 | s[2],
  19237. v = 8191 & g,
  19238. y = g >>> 13,
  19239. _ = 0 | s[3],
  19240. b = 8191 & _,
  19241. w = _ >>> 13,
  19242. E = 0 | s[4],
  19243. T = 8191 & E,
  19244. S = E >>> 13,
  19245. A = 0 | s[5],
  19246. k = 8191 & A,
  19247. R = A >>> 13,
  19248. M = 0 | s[6],
  19249. O = 8191 & M,
  19250. C = M >>> 13,
  19251. D = 0 | s[7],
  19252. I = 8191 & D,
  19253. L = D >>> 13,
  19254. x = 0 | s[8],
  19255. P = 8191 & x,
  19256. U = x >>> 13,
  19257. N = 0 | s[9],
  19258. B = 8191 & N,
  19259. F = N >>> 13,
  19260. j = 0 | o[0],
  19261. H = 8191 & j,
  19262. G = j >>> 13,
  19263. V = 0 | o[1],
  19264. W = 8191 & V,
  19265. q = V >>> 13,
  19266. X = 0 | o[2],
  19267. z = 8191 & X,
  19268. K = X >>> 13,
  19269. Y = 0 | o[3],
  19270. Q = 8191 & Y,
  19271. J = Y >>> 13,
  19272. Z = 0 | o[4],
  19273. $ = 8191 & Z,
  19274. ee = Z >>> 13,
  19275. te = 0 | o[5],
  19276. ie = 8191 & te,
  19277. re = te >>> 13,
  19278. ne = 0 | o[6],
  19279. ae = 8191 & ne,
  19280. se = ne >>> 13,
  19281. oe = 0 | o[7],
  19282. ue = 8191 & oe,
  19283. le = oe >>> 13,
  19284. de = 0 | o[8],
  19285. ce = 8191 & de,
  19286. he = de >>> 13,
  19287. fe = 0 | o[9],
  19288. pe = 8191 & fe,
  19289. me = fe >>> 13;
  19290. i.negative = e.negative ^ t.negative, i.length = 19;
  19291. var ge = (l + (r = Math.imul(c, H)) | 0) + ((8191 & (n = (n = Math.imul(c, G)) + Math.imul(h, H) |
  19292. 0)) << 13) | 0;
  19293. l = ((a = Math.imul(h, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p,
  19294. H), n = (n = Math.imul(p, G)) + Math.imul(m, H) | 0, a = Math.imul(m, G);
  19295. var ve = (l + (r = r + Math.imul(c, W) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, q) | 0) +
  19296. Math.imul(h, W) | 0)) << 13) | 0;
  19297. l = ((a = a + Math.imul(h, q) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math
  19298. .imul(v, H), n = (n = Math.imul(v, G)) + Math.imul(y, H) | 0, a = Math.imul(y, G), r = r + Math
  19299. .imul(p, W) | 0, n = (n = n + Math.imul(p, q) | 0) + Math.imul(m, W) | 0, a = a + Math.imul(m,
  19300. q) | 0;
  19301. var ye = (l + (r = r + Math.imul(c, z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, K) | 0) +
  19302. Math.imul(h, z) | 0)) << 13) | 0;
  19303. l = ((a = a + Math.imul(h, K) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math
  19304. .imul(b, H), n = (n = Math.imul(b, G)) + Math.imul(w, H) | 0, a = Math.imul(w, G), r = r + Math
  19305. .imul(v, W) | 0, n = (n = n + Math.imul(v, q) | 0) + Math.imul(y, W) | 0, a = a + Math.imul(y,
  19306. q) | 0, r = r + Math.imul(p, z) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, z) | 0,
  19307. a = a + Math.imul(m, K) | 0;
  19308. var _e = (l + (r = r + Math.imul(c, Q) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, J) | 0) +
  19309. Math.imul(h, Q) | 0)) << 13) | 0;
  19310. l = ((a = a + Math.imul(h, J) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math
  19311. .imul(T, H), n = (n = Math.imul(T, G)) + Math.imul(S, H) | 0, a = Math.imul(S, G), r = r + Math
  19312. .imul(b, W) | 0, n = (n = n + Math.imul(b, q) | 0) + Math.imul(w, W) | 0, a = a + Math.imul(w,
  19313. q) | 0, r = r + Math.imul(v, z) | 0, n = (n = n + Math.imul(v, K) | 0) + Math.imul(y, z) | 0,
  19314. a = a + Math.imul(y, K) | 0, r = r + Math.imul(p, Q) | 0, n = (n = n + Math.imul(p, J) | 0) +
  19315. Math.imul(m, Q) | 0, a = a + Math.imul(m, J) | 0;
  19316. var be = (l + (r = r + Math.imul(c, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, ee) | 0) +
  19317. Math.imul(h, $) | 0)) << 13) | 0;
  19318. l = ((a = a + Math.imul(h, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math
  19319. .imul(k, H), n = (n = Math.imul(k, G)) + Math.imul(R, H) | 0, a = Math.imul(R, G), r = r + Math
  19320. .imul(T, W) | 0, n = (n = n + Math.imul(T, q) | 0) + Math.imul(S, W) | 0, a = a + Math.imul(S,
  19321. q) | 0, r = r + Math.imul(b, z) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(w, z) | 0,
  19322. a = a + Math.imul(w, K) | 0, r = r + Math.imul(v, Q) | 0, n = (n = n + Math.imul(v, J) | 0) +
  19323. Math.imul(y, Q) | 0, a = a + Math.imul(y, J) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math
  19324. .imul(p, ee) | 0) + Math.imul(m, $) | 0, a = a + Math.imul(m, ee) | 0;
  19325. var we = (l + (r = r + Math.imul(c, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, re) | 0) +
  19326. Math.imul(h, ie) | 0)) << 13) | 0;
  19327. l = ((a = a + Math.imul(h, re) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math
  19328. .imul(O, H), n = (n = Math.imul(O, G)) + Math.imul(C, H) | 0, a = Math.imul(C, G), r = r + Math
  19329. .imul(k, W) | 0, n = (n = n + Math.imul(k, q) | 0) + Math.imul(R, W) | 0, a = a + Math.imul(R,
  19330. q) | 0, r = r + Math.imul(T, z) | 0, n = (n = n + Math.imul(T, K) | 0) + Math.imul(S, z) | 0,
  19331. a = a + Math.imul(S, K) | 0, r = r + Math.imul(b, Q) | 0, n = (n = n + Math.imul(b, J) | 0) +
  19332. Math.imul(w, Q) | 0, a = a + Math.imul(w, J) | 0, r = r + Math.imul(v, $) | 0, n = (n = n + Math
  19333. .imul(v, ee) | 0) + Math.imul(y, $) | 0, a = a + Math.imul(y, ee) | 0, r = r + Math.imul(p,
  19334. ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, a = a + Math.imul(m, re) |
  19335. 0;
  19336. var Ee = (l + (r = r + Math.imul(c, ae) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, se) | 0) +
  19337. Math.imul(h, ae) | 0)) << 13) | 0;
  19338. l = ((a = a + Math.imul(h, se) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math
  19339. .imul(I, H), n = (n = Math.imul(I, G)) + Math.imul(L, H) | 0, a = Math.imul(L, G), r = r + Math
  19340. .imul(O, W) | 0, n = (n = n + Math.imul(O, q) | 0) + Math.imul(C, W) | 0, a = a + Math.imul(C,
  19341. q) | 0, r = r + Math.imul(k, z) | 0, n = (n = n + Math.imul(k, K) | 0) + Math.imul(R, z) | 0,
  19342. a = a + Math.imul(R, K) | 0, r = r + Math.imul(T, Q) | 0, n = (n = n + Math.imul(T, J) | 0) +
  19343. Math.imul(S, Q) | 0, a = a + Math.imul(S, J) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math
  19344. .imul(b, ee) | 0) + Math.imul(w, $) | 0, a = a + Math.imul(w, ee) | 0, r = r + Math.imul(v,
  19345. ie) | 0, n = (n = n + Math.imul(v, re) | 0) + Math.imul(y, ie) | 0, a = a + Math.imul(y, re) |
  19346. 0, r = r + Math.imul(p, ae) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, ae) | 0, a =
  19347. a + Math.imul(m, se) | 0;
  19348. var Te = (l + (r = r + Math.imul(c, ue) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, le) | 0) +
  19349. Math.imul(h, ue) | 0)) << 13) | 0;
  19350. l = ((a = a + Math.imul(h, le) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math
  19351. .imul(P, H), n = (n = Math.imul(P, G)) + Math.imul(U, H) | 0, a = Math.imul(U, G), r = r + Math
  19352. .imul(I, W) | 0, n = (n = n + Math.imul(I, q) | 0) + Math.imul(L, W) | 0, a = a + Math.imul(L,
  19353. q) | 0, r = r + Math.imul(O, z) | 0, n = (n = n + Math.imul(O, K) | 0) + Math.imul(C, z) | 0,
  19354. a = a + Math.imul(C, K) | 0, r = r + Math.imul(k, Q) | 0, n = (n = n + Math.imul(k, J) | 0) +
  19355. Math.imul(R, Q) | 0, a = a + Math.imul(R, J) | 0, r = r + Math.imul(T, $) | 0, n = (n = n + Math
  19356. .imul(T, ee) | 0) + Math.imul(S, $) | 0, a = a + Math.imul(S, ee) | 0, r = r + Math.imul(b,
  19357. ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(w, ie) | 0, a = a + Math.imul(w, re) |
  19358. 0, r = r + Math.imul(v, ae) | 0, n = (n = n + Math.imul(v, se) | 0) + Math.imul(y, ae) | 0, a =
  19359. a + Math.imul(y, se) | 0, r = r + Math.imul(p, ue) | 0, n = (n = n + Math.imul(p, le) | 0) +
  19360. Math.imul(m, ue) | 0, a = a + Math.imul(m, le) | 0;
  19361. var Se = (l + (r = r + Math.imul(c, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, he) | 0) +
  19362. Math.imul(h, ce) | 0)) << 13) | 0;
  19363. l = ((a = a + Math.imul(h, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math
  19364. .imul(B, H), n = (n = Math.imul(B, G)) + Math.imul(F, H) | 0, a = Math.imul(F, G), r = r + Math
  19365. .imul(P, W) | 0, n = (n = n + Math.imul(P, q) | 0) + Math.imul(U, W) | 0, a = a + Math.imul(U,
  19366. q) | 0, r = r + Math.imul(I, z) | 0, n = (n = n + Math.imul(I, K) | 0) + Math.imul(L, z) | 0,
  19367. a = a + Math.imul(L, K) | 0, r = r + Math.imul(O, Q) | 0, n = (n = n + Math.imul(O, J) | 0) +
  19368. Math.imul(C, Q) | 0, a = a + Math.imul(C, J) | 0, r = r + Math.imul(k, $) | 0, n = (n = n + Math
  19369. .imul(k, ee) | 0) + Math.imul(R, $) | 0, a = a + Math.imul(R, ee) | 0, r = r + Math.imul(T,
  19370. ie) | 0, n = (n = n + Math.imul(T, re) | 0) + Math.imul(S, ie) | 0, a = a + Math.imul(S, re) |
  19371. 0, r = r + Math.imul(b, ae) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(w, ae) | 0, a =
  19372. a + Math.imul(w, se) | 0, r = r + Math.imul(v, ue) | 0, n = (n = n + Math.imul(v, le) | 0) +
  19373. Math.imul(y, ue) | 0, a = a + Math.imul(y, le) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n +
  19374. Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, a = a + Math.imul(m, he) | 0;
  19375. var Ae = (l + (r = r + Math.imul(c, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, me) | 0) +
  19376. Math.imul(h, pe) | 0)) << 13) | 0;
  19377. l = ((a = a + Math.imul(h, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math
  19378. .imul(B, W), n = (n = Math.imul(B, q)) + Math.imul(F, W) | 0, a = Math.imul(F, q), r = r + Math
  19379. .imul(P, z) | 0, n = (n = n + Math.imul(P, K) | 0) + Math.imul(U, z) | 0, a = a + Math.imul(U,
  19380. K) | 0, r = r + Math.imul(I, Q) | 0, n = (n = n + Math.imul(I, J) | 0) + Math.imul(L, Q) | 0,
  19381. a = a + Math.imul(L, J) | 0, r = r + Math.imul(O, $) | 0, n = (n = n + Math.imul(O, ee) | 0) +
  19382. Math.imul(C, $) | 0, a = a + Math.imul(C, ee) | 0, r = r + Math.imul(k, ie) | 0, n = (n = n +
  19383. Math.imul(k, re) | 0) + Math.imul(R, ie) | 0, a = a + Math.imul(R, re) | 0, r = r + Math.imul(
  19384. T, ae) | 0, n = (n = n + Math.imul(T, se) | 0) + Math.imul(S, ae) | 0, a = a + Math.imul(S,
  19385. se) | 0, r = r + Math.imul(b, ue) | 0, n = (n = n + Math.imul(b, le) | 0) + Math.imul(w, ue) |
  19386. 0, a = a + Math.imul(w, le) | 0, r = r + Math.imul(v, ce) | 0, n = (n = n + Math.imul(v, he) |
  19387. 0) + Math.imul(y, ce) | 0, a = a + Math.imul(y, he) | 0;
  19388. var ke = (l + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) +
  19389. Math.imul(m, pe) | 0)) << 13) | 0;
  19390. l = ((a = a + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (ke >>> 26) | 0, ke &= 67108863, r = Math
  19391. .imul(B, z), n = (n = Math.imul(B, K)) + Math.imul(F, z) | 0, a = Math.imul(F, K), r = r + Math
  19392. .imul(P, Q) | 0, n = (n = n + Math.imul(P, J) | 0) + Math.imul(U, Q) | 0, a = a + Math.imul(U,
  19393. J) | 0, r = r + Math.imul(I, $) | 0, n = (n = n + Math.imul(I, ee) | 0) + Math.imul(L, $) | 0,
  19394. a = a + Math.imul(L, ee) | 0, r = r + Math.imul(O, ie) | 0, n = (n = n + Math.imul(O, re) | 0) +
  19395. Math.imul(C, ie) | 0, a = a + Math.imul(C, re) | 0, r = r + Math.imul(k, ae) | 0, n = (n = n +
  19396. Math.imul(k, se) | 0) + Math.imul(R, ae) | 0, a = a + Math.imul(R, se) | 0, r = r + Math.imul(
  19397. T, ue) | 0, n = (n = n + Math.imul(T, le) | 0) + Math.imul(S, ue) | 0, a = a + Math.imul(S,
  19398. le) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(w, ce) |
  19399. 0, a = a + Math.imul(w, he) | 0;
  19400. var Re = (l + (r = r + Math.imul(v, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(v, me) | 0) +
  19401. Math.imul(y, pe) | 0)) << 13) | 0;
  19402. l = ((a = a + Math.imul(y, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math
  19403. .imul(B, Q), n = (n = Math.imul(B, J)) + Math.imul(F, Q) | 0, a = Math.imul(F, J), r = r + Math
  19404. .imul(P, $) | 0, n = (n = n + Math.imul(P, ee) | 0) + Math.imul(U, $) | 0, a = a + Math.imul(U,
  19405. ee) | 0, r = r + Math.imul(I, ie) | 0, n = (n = n + Math.imul(I, re) | 0) + Math.imul(L, ie) |
  19406. 0, a = a + Math.imul(L, re) | 0, r = r + Math.imul(O, ae) | 0, n = (n = n + Math.imul(O, se) |
  19407. 0) + Math.imul(C, ae) | 0, a = a + Math.imul(C, se) | 0, r = r + Math.imul(k, ue) | 0, n = (
  19408. n = n + Math.imul(k, le) | 0) + Math.imul(R, ue) | 0, a = a + Math.imul(R, le) | 0, r = r +
  19409. Math.imul(T, ce) | 0, n = (n = n + Math.imul(T, he) | 0) + Math.imul(S, ce) | 0, a = a + Math
  19410. .imul(S, he) | 0;
  19411. var Me = (l + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) +
  19412. Math.imul(w, pe) | 0)) << 13) | 0;
  19413. l = ((a = a + Math.imul(w, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math
  19414. .imul(B, $), n = (n = Math.imul(B, ee)) + Math.imul(F, $) | 0, a = Math.imul(F, ee), r = r +
  19415. Math.imul(P, ie) | 0, n = (n = n + Math.imul(P, re) | 0) + Math.imul(U, ie) | 0, a = a + Math
  19416. .imul(U, re) | 0, r = r + Math.imul(I, ae) | 0, n = (n = n + Math.imul(I, se) | 0) + Math.imul(
  19417. L, ae) | 0, a = a + Math.imul(L, se) | 0, r = r + Math.imul(O, ue) | 0, n = (n = n + Math
  19418. .imul(O, le) | 0) + Math.imul(C, ue) | 0, a = a + Math.imul(C, le) | 0, r = r + Math.imul(k,
  19419. ce) | 0, n = (n = n + Math.imul(k, he) | 0) + Math.imul(R, ce) | 0, a = a + Math.imul(R, he) |
  19420. 0;
  19421. var Oe = (l + (r = r + Math.imul(T, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(T, me) | 0) +
  19422. Math.imul(S, pe) | 0)) << 13) | 0;
  19423. l = ((a = a + Math.imul(S, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863, r = Math
  19424. .imul(B, ie), n = (n = Math.imul(B, re)) + Math.imul(F, ie) | 0, a = Math.imul(F, re), r = r +
  19425. Math.imul(P, ae) | 0, n = (n = n + Math.imul(P, se) | 0) + Math.imul(U, ae) | 0, a = a + Math
  19426. .imul(U, se) | 0, r = r + Math.imul(I, ue) | 0, n = (n = n + Math.imul(I, le) | 0) + Math.imul(
  19427. L, ue) | 0, a = a + Math.imul(L, le) | 0, r = r + Math.imul(O, ce) | 0, n = (n = n + Math
  19428. .imul(O, he) | 0) + Math.imul(C, ce) | 0, a = a + Math.imul(C, he) | 0;
  19429. var Ce = (l + (r = r + Math.imul(k, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(k, me) | 0) +
  19430. Math.imul(R, pe) | 0)) << 13) | 0;
  19431. l = ((a = a + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math
  19432. .imul(B, ae), n = (n = Math.imul(B, se)) + Math.imul(F, ae) | 0, a = Math.imul(F, se), r = r +
  19433. Math.imul(P, ue) | 0, n = (n = n + Math.imul(P, le) | 0) + Math.imul(U, ue) | 0, a = a + Math
  19434. .imul(U, le) | 0, r = r + Math.imul(I, ce) | 0, n = (n = n + Math.imul(I, he) | 0) + Math.imul(
  19435. L, ce) | 0, a = a + Math.imul(L, he) | 0;
  19436. var De = (l + (r = r + Math.imul(O, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(O, me) | 0) +
  19437. Math.imul(C, pe) | 0)) << 13) | 0;
  19438. l = ((a = a + Math.imul(C, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math
  19439. .imul(B, ue), n = (n = Math.imul(B, le)) + Math.imul(F, ue) | 0, a = Math.imul(F, le), r = r +
  19440. Math.imul(P, ce) | 0, n = (n = n + Math.imul(P, he) | 0) + Math.imul(U, ce) | 0, a = a + Math
  19441. .imul(U, he) | 0;
  19442. var Ie = (l + (r = r + Math.imul(I, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(I, me) | 0) +
  19443. Math.imul(L, pe) | 0)) << 13) | 0;
  19444. l = ((a = a + Math.imul(L, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math
  19445. .imul(B, ce), n = (n = Math.imul(B, he)) + Math.imul(F, ce) | 0, a = Math.imul(F, he);
  19446. var Le = (l + (r = r + Math.imul(P, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(P, me) | 0) +
  19447. Math.imul(U, pe) | 0)) << 13) | 0;
  19448. l = ((a = a + Math.imul(U, me) | 0) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863;
  19449. var xe = (l + (r = Math.imul(B, pe)) | 0) + ((8191 & (n = (n = Math.imul(B, me)) + Math.imul(F,
  19450. pe) | 0)) << 13) | 0;
  19451. return l = ((a = Math.imul(F, me)) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, u[0] = ge,
  19452. u[1] = ve, u[2] = ye, u[3] = _e, u[4] = be, u[5] = we, u[6] = Ee, u[7] = Te, u[8] = Se, u[9] =
  19453. Ae, u[10] = ke, u[11] = Re, u[12] = Me, u[13] = Oe, u[14] = Ce, u[15] = De, u[16] = Ie, u[17] =
  19454. Le, u[18] = xe, 0 !== l && (u[19] = l, i.length++), i
  19455. };
  19456. function m(e, t, i) {
  19457. return (new g).mulp(e, t, i)
  19458. }
  19459. function g(e, t) {
  19460. this.x = e, this.y = t
  19461. }
  19462. Math.imul || (p = f), a.prototype.mulTo = function(e, t) {
  19463. var i = this.length + e.length;
  19464. return 10 === this.length && 10 === e.length ? p(this, e, t) : i < 63 ? f(this, e, t) : i < 1024 ?
  19465. function(e, t, i) {
  19466. i.negative = t.negative ^ e.negative, i.length = e.length + t.length;
  19467. for (var r = 0, n = 0, a = 0; a < i.length - 1; a++) {
  19468. var s = n;
  19469. n = 0;
  19470. for (var o = 67108863 & r, u = Math.min(a, t.length - 1), l = Math.max(0, a - e.length +
  19471. 1); l <= u; l++) {
  19472. var d = a - l,
  19473. c = (0 | e.words[d]) * (0 | t.words[l]),
  19474. h = 67108863 & c;
  19475. o = 67108863 & (h = h + o | 0), n += (s = (s = s + (c / 67108864 | 0) | 0) + (h >>> 26) |
  19476. 0) >>> 26, s &= 67108863
  19477. }
  19478. i.words[a] = o, r = s, s = n
  19479. }
  19480. return 0 !== r ? i.words[a] = r : i.length--, i.strip()
  19481. }(this, e, t) : m(this, e, t)
  19482. }, g.prototype.makeRBT = function(e) {
  19483. for (var t = new Array(e), i = a.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this
  19484. .revBin(r, i, e);
  19485. return t
  19486. }, g.prototype.revBin = function(e, t, i) {
  19487. if (0 === e || e === i - 1) return e;
  19488. for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1;
  19489. return r
  19490. }, g.prototype.permute = function(e, t, i, r, n, a) {
  19491. for (var s = 0; s < a; s++) r[s] = t[e[s]], n[s] = i[e[s]]
  19492. }, g.prototype.transform = function(e, t, i, r, n, a) {
  19493. this.permute(a, e, t, i, r, n);
  19494. for (var s = 1; s < n; s <<= 1)
  19495. for (var o = s << 1, u = Math.cos(2 * Math.PI / o), l = Math.sin(2 * Math.PI / o), d = 0; d <
  19496. n; d += o)
  19497. for (var c = u, h = l, f = 0; f < s; f++) {
  19498. var p = i[d + f],
  19499. m = r[d + f],
  19500. g = i[d + f + s],
  19501. v = r[d + f + s],
  19502. y = c * g - h * v;
  19503. v = c * v + h * g, g = y, i[d + f] = p + g, r[d + f] = m + v, i[d + f + s] = p - g, r[d +
  19504. f + s] = m - v, f !== o && (y = u * c - l * h, h = u * h + l * c, c = y)
  19505. }
  19506. }, g.prototype.guessLen13b = function(e, t) {
  19507. var i = 1 | Math.max(t, e),
  19508. r = 1 & i,
  19509. n = 0;
  19510. for (i = i / 2 | 0; i; i >>>= 1) n++;
  19511. return 1 << n + 1 + r
  19512. }, g.prototype.conjugate = function(e, t, i) {
  19513. if (!(i <= 1))
  19514. for (var r = 0; r < i / 2; r++) {
  19515. var n = e[r];
  19516. e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n
  19517. }
  19518. }, g.prototype.normalize13b = function(e, t) {
  19519. for (var i = 0, r = 0; r < t / 2; r++) {
  19520. var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i;
  19521. e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0
  19522. }
  19523. return e
  19524. }, g.prototype.convert13b = function(e, t, i, n) {
  19525. for (var a = 0, s = 0; s < t; s++) a += 0 | e[s], i[2 * s] = 8191 & a, a >>>= 13, i[2 * s + 1] =
  19526. 8191 & a, a >>>= 13;
  19527. for (s = 2 * t; s < n; ++s) i[s] = 0;
  19528. r(0 === a), r(0 == (-8192 & a))
  19529. }, g.prototype.stub = function(e) {
  19530. for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0;
  19531. return t
  19532. }, g.prototype.mulp = function(e, t, i) {
  19533. var r = 2 * this.guessLen13b(e.length, t.length),
  19534. n = this.makeRBT(r),
  19535. a = this.stub(r),
  19536. s = new Array(r),
  19537. o = new Array(r),
  19538. u = new Array(r),
  19539. l = new Array(r),
  19540. d = new Array(r),
  19541. c = new Array(r),
  19542. h = i.words;
  19543. h.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, l, r),
  19544. this.transform(s, a, o, u, r, n), this.transform(l, a, d, c, r, n);
  19545. for (var f = 0; f < r; f++) {
  19546. var p = o[f] * d[f] - u[f] * c[f];
  19547. u[f] = o[f] * c[f] + u[f] * d[f], o[f] = p
  19548. }
  19549. return this.conjugate(o, u, r), this.transform(o, u, h, a, r, n), this.conjugate(h, a, r), this
  19550. .normalize13b(h, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i
  19551. .strip()
  19552. }, a.prototype.mul = function(e) {
  19553. var t = new a(null);
  19554. return t.words = new Array(this.length + e.length), this.mulTo(e, t)
  19555. }, a.prototype.mulf = function(e) {
  19556. var t = new a(null);
  19557. return t.words = new Array(this.length + e.length), m(this, e, t)
  19558. }, a.prototype.imul = function(e) {
  19559. return this.clone().mulTo(e, this)
  19560. }, a.prototype.imuln = function(e) {
  19561. r("number" == typeof e), r(e < 67108864);
  19562. for (var t = 0, i = 0; i < this.length; i++) {
  19563. var n = (0 | this.words[i]) * e,
  19564. a = (67108863 & n) + (67108863 & t);
  19565. t >>= 26, t += n / 67108864 | 0, t += a >>> 26, this.words[i] = 67108863 & a
  19566. }
  19567. return 0 !== t && (this.words[i] = t, this.length++), this
  19568. }, a.prototype.muln = function(e) {
  19569. return this.clone().imuln(e)
  19570. }, a.prototype.sqr = function() {
  19571. return this.mul(this)
  19572. }, a.prototype.isqr = function() {
  19573. return this.imul(this.clone())
  19574. }, a.prototype.pow = function(e) {
  19575. var t = function(e) {
  19576. for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) {
  19577. var r = i / 26 | 0,
  19578. n = i % 26;
  19579. t[i] = (e.words[r] & 1 << n) >>> n
  19580. }
  19581. return t
  19582. }(e);
  19583. if (0 === t.length) return new a(1);
  19584. for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr());
  19585. if (++r < t.length)
  19586. for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n));
  19587. return i
  19588. }, a.prototype.iushln = function(e) {
  19589. r("number" == typeof e && e >= 0);
  19590. var t, i = e % 26,
  19591. n = (e - i) / 26,
  19592. a = 67108863 >>> 26 - i << 26 - i;
  19593. if (0 !== i) {
  19594. var s = 0;
  19595. for (t = 0; t < this.length; t++) {
  19596. var o = this.words[t] & a,
  19597. u = (0 | this.words[t]) - o << i;
  19598. this.words[t] = u | s, s = o >>> 26 - i
  19599. }
  19600. s && (this.words[t] = s, this.length++)
  19601. }
  19602. if (0 !== n) {
  19603. for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t];
  19604. for (t = 0; t < n; t++) this.words[t] = 0;
  19605. this.length += n
  19606. }
  19607. return this.strip()
  19608. }, a.prototype.ishln = function(e) {
  19609. return r(0 === this.negative), this.iushln(e)
  19610. }, a.prototype.iushrn = function(e, t, i) {
  19611. var n;
  19612. r("number" == typeof e && e >= 0), n = t ? (t - t % 26) / 26 : 0;
  19613. var a = e % 26,
  19614. s = Math.min((e - a) / 26, this.length),
  19615. o = 67108863 ^ 67108863 >>> a << a,
  19616. u = i;
  19617. if (n -= s, n = Math.max(0, n), u) {
  19618. for (var l = 0; l < s; l++) u.words[l] = this.words[l];
  19619. u.length = s
  19620. }
  19621. if (0 === s);
  19622. else if (this.length > s)
  19623. for (this.length -= s, l = 0; l < this.length; l++) this.words[l] = this.words[l + s];
  19624. else this.words[0] = 0, this.length = 1;
  19625. var d = 0;
  19626. for (l = this.length - 1; l >= 0 && (0 !== d || l >= n); l--) {
  19627. var c = 0 | this.words[l];
  19628. this.words[l] = d << 26 - a | c >>> a, d = c & o
  19629. }
  19630. return u && 0 !== d && (u.words[u.length++] = d), 0 === this.length && (this.words[0] = 0, this
  19631. .length = 1), this.strip()
  19632. }, a.prototype.ishrn = function(e, t, i) {
  19633. return r(0 === this.negative), this.iushrn(e, t, i)
  19634. }, a.prototype.shln = function(e) {
  19635. return this.clone().ishln(e)
  19636. }, a.prototype.ushln = function(e) {
  19637. return this.clone().iushln(e)
  19638. }, a.prototype.shrn = function(e) {
  19639. return this.clone().ishrn(e)
  19640. }, a.prototype.ushrn = function(e) {
  19641. return this.clone().iushrn(e)
  19642. }, a.prototype.testn = function(e) {
  19643. r("number" == typeof e && e >= 0);
  19644. var t = e % 26,
  19645. i = (e - t) / 26,
  19646. n = 1 << t;
  19647. return !(this.length <= i || !(this.words[i] & n))
  19648. }, a.prototype.imaskn = function(e) {
  19649. r("number" == typeof e && e >= 0);
  19650. var t = e % 26,
  19651. i = (e - t) / 26;
  19652. if (r(0 === this.negative, "imaskn works only with positive numbers"), this.length <= i)
  19653. return this;
  19654. if (0 !== t && i++, this.length = Math.min(i, this.length), 0 !== t) {
  19655. var n = 67108863 ^ 67108863 >>> t << t;
  19656. this.words[this.length - 1] &= n
  19657. }
  19658. return this.strip()
  19659. }, a.prototype.maskn = function(e) {
  19660. return this.clone().imaskn(e)
  19661. }, a.prototype.iaddn = function(e) {
  19662. return r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ?
  19663. 1 === this.length && (0 | this.words[0]) < e ? (this.words[0] = e - (0 | this.words[0]), this
  19664. .negative = 0, this) : (this.negative = 0, this.isubn(e), this.negative = 1, this) : this
  19665. ._iaddn(e)
  19666. }, a.prototype._iaddn = function(e) {
  19667. this.words[0] += e;
  19668. for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) this.words[t] -= 67108864,
  19669. t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++;
  19670. return this.length = Math.max(this.length, t + 1), this
  19671. }, a.prototype.isubn = function(e) {
  19672. if (r("number" == typeof e), r(e < 67108864), e < 0) return this.iaddn(-e);
  19673. if (0 !== this.negative) return this.negative = 0, this.iaddn(e), this.negative = 1, this;
  19674. if (this.words[0] -= e, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0],
  19675. this.negative = 1;
  19676. else
  19677. for (var t = 0; t < this.length && this.words[t] < 0; t++) this.words[t] += 67108864, this
  19678. .words[t + 1] -= 1;
  19679. return this.strip()
  19680. }, a.prototype.addn = function(e) {
  19681. return this.clone().iaddn(e)
  19682. }, a.prototype.subn = function(e) {
  19683. return this.clone().isubn(e)
  19684. }, a.prototype.iabs = function() {
  19685. return this.negative = 0, this
  19686. }, a.prototype.abs = function() {
  19687. return this.clone().iabs()
  19688. }, a.prototype._ishlnsubmul = function(e, t, i) {
  19689. var n, a, s = e.length + i;
  19690. this._expand(s);
  19691. var o = 0;
  19692. for (n = 0; n < e.length; n++) {
  19693. a = (0 | this.words[n + i]) + o;
  19694. var u = (0 | e.words[n]) * t;
  19695. o = ((a -= 67108863 & u) >> 26) - (u / 67108864 | 0), this.words[n + i] = 67108863 & a
  19696. }
  19697. for (; n < this.length - i; n++) o = (a = (0 | this.words[n + i]) + o) >> 26, this.words[n + i] =
  19698. 67108863 & a;
  19699. if (0 === o) return this.strip();
  19700. for (r(-1 === o), o = 0, n = 0; n < this.length; n++) o = (a = -(0 | this.words[n]) + o) >> 26,
  19701. this.words[n] = 67108863 & a;
  19702. return this.negative = 1, this.strip()
  19703. }, a.prototype._wordDiv = function(e, t) {
  19704. var i = (this.length, e.length),
  19705. r = this.clone(),
  19706. n = e,
  19707. s = 0 | n.words[n.length - 1];
  19708. 0 != (i = 26 - this._countBits(s)) && (n = n.ushln(i), r.iushln(i), s = 0 | n.words[n.length -
  19709. 1]);
  19710. var o, u = r.length - n.length;
  19711. if ("mod" !== t) {
  19712. (o = new a(null)).length = u + 1, o.words = new Array(o.length);
  19713. for (var l = 0; l < o.length; l++) o.words[l] = 0
  19714. }
  19715. var d = r.clone()._ishlnsubmul(n, 1, u);
  19716. 0 === d.negative && (r = d, o && (o.words[u] = 1));
  19717. for (var c = u - 1; c >= 0; c--) {
  19718. var h = 67108864 * (0 | r.words[n.length + c]) + (0 | r.words[n.length + c - 1]);
  19719. for (h = Math.min(h / s | 0, 67108863), r._ishlnsubmul(n, h, c); 0 !== r.negative;) h--, r
  19720. .negative = 0, r._ishlnsubmul(n, 1, c), r.isZero() || (r.negative ^= 1);
  19721. o && (o.words[c] = h)
  19722. }
  19723. return o && o.strip(), r.strip(), "div" !== t && 0 !== i && r.iushrn(i), {
  19724. div: o || null,
  19725. mod: r
  19726. }
  19727. }, a.prototype.divmod = function(e, t, i) {
  19728. return r(!e.isZero()), this.isZero() ? {
  19729. div: new a(0),
  19730. mod: new a(0)
  19731. } : 0 !== this.negative && 0 === e.negative ? (o = this.neg().divmod(e, t), "mod" !== t && (n =
  19732. o.div.neg()), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.iadd(e)), {
  19733. div: n,
  19734. mod: s
  19735. }) : 0 === this.negative && 0 !== e.negative ? (o = this.divmod(e.neg(), t), "mod" !== t && (n =
  19736. o.div.neg()), {
  19737. div: n,
  19738. mod: o.mod
  19739. }) : 0 != (this.negative & e.negative) ? (o = this.neg().divmod(e.neg(), t), "div" !== t && (s =
  19740. o.mod.neg(), i && 0 !== s.negative && s.isub(e)), {
  19741. div: o.div,
  19742. mod: s
  19743. }) : e.length > this.length || this.cmp(e) < 0 ? {
  19744. div: new a(0),
  19745. mod: this
  19746. } : 1 === e.length ? "div" === t ? {
  19747. div: this.divn(e.words[0]),
  19748. mod: null
  19749. } : "mod" === t ? {
  19750. div: null,
  19751. mod: new a(this.modn(e.words[0]))
  19752. } : {
  19753. div: this.divn(e.words[0]),
  19754. mod: new a(this.modn(e.words[0]))
  19755. } : this._wordDiv(e, t);
  19756. var n, s, o
  19757. }, a.prototype.div = function(e) {
  19758. return this.divmod(e, "div", !1).div
  19759. }, a.prototype.mod = function(e) {
  19760. return this.divmod(e, "mod", !1).mod
  19761. }, a.prototype.umod = function(e) {
  19762. return this.divmod(e, "mod", !0).mod
  19763. }, a.prototype.divRound = function(e) {
  19764. var t = this.divmod(e);
  19765. if (t.mod.isZero()) return t.div;
  19766. var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod,
  19767. r = e.ushrn(1),
  19768. n = e.andln(1),
  19769. a = i.cmp(r);
  19770. return a < 0 || 1 === n && 0 === a ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn(
  19771. 1)
  19772. }, a.prototype.modn = function(e) {
  19773. r(e <= 67108863);
  19774. for (var t = (1 << 26) % e, i = 0, n = this.length - 1; n >= 0; n--) i = (t * i + (0 | this.words[
  19775. n])) % e;
  19776. return i
  19777. }, a.prototype.idivn = function(e) {
  19778. r(e <= 67108863);
  19779. for (var t = 0, i = this.length - 1; i >= 0; i--) {
  19780. var n = (0 | this.words[i]) + 67108864 * t;
  19781. this.words[i] = n / e | 0, t = n % e
  19782. }
  19783. return this.strip()
  19784. }, a.prototype.divn = function(e) {
  19785. return this.clone().idivn(e)
  19786. }, a.prototype.egcd = function(e) {
  19787. r(0 === e.negative), r(!e.isZero());
  19788. var t = this,
  19789. i = e.clone();
  19790. t = 0 !== t.negative ? t.umod(e) : t.clone();
  19791. for (var n = new a(1), s = new a(0), o = new a(0), u = new a(1), l = 0; t.isEven() && i.isEven();)
  19792. t.iushrn(1), i.iushrn(1), ++l;
  19793. for (var d = i.clone(), c = t.clone(); !t.isZero();) {
  19794. for (var h = 0, f = 1; 0 == (t.words[0] & f) && h < 26; ++h, f <<= 1);
  19795. if (h > 0)
  19796. for (t.iushrn(h); h-- > 0;)(n.isOdd() || s.isOdd()) && (n.iadd(d), s.isub(c)), n.iushrn(1), s
  19797. .iushrn(1);
  19798. for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1);
  19799. if (p > 0)
  19800. for (i.iushrn(p); p-- > 0;)(o.isOdd() || u.isOdd()) && (o.iadd(d), u.isub(c)), o.iushrn(1), u
  19801. .iushrn(1);
  19802. t.cmp(i) >= 0 ? (t.isub(i), n.isub(o), s.isub(u)) : (i.isub(t), o.isub(n), u.isub(s))
  19803. }
  19804. return {
  19805. a: o,
  19806. b: u,
  19807. gcd: i.iushln(l)
  19808. }
  19809. }, a.prototype._invmp = function(e) {
  19810. r(0 === e.negative), r(!e.isZero());
  19811. var t = this,
  19812. i = e.clone();
  19813. t = 0 !== t.negative ? t.umod(e) : t.clone();
  19814. for (var n, s = new a(1), o = new a(0), u = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) {
  19815. for (var l = 0, d = 1; 0 == (t.words[0] & d) && l < 26; ++l, d <<= 1);
  19816. if (l > 0)
  19817. for (t.iushrn(l); l-- > 0;) s.isOdd() && s.iadd(u), s.iushrn(1);
  19818. for (var c = 0, h = 1; 0 == (i.words[0] & h) && c < 26; ++c, h <<= 1);
  19819. if (c > 0)
  19820. for (i.iushrn(c); c-- > 0;) o.isOdd() && o.iadd(u), o.iushrn(1);
  19821. t.cmp(i) >= 0 ? (t.isub(i), s.isub(o)) : (i.isub(t), o.isub(s))
  19822. }
  19823. return (n = 0 === t.cmpn(1) ? s : o).cmpn(0) < 0 && n.iadd(e), n
  19824. }, a.prototype.gcd = function(e) {
  19825. if (this.isZero()) return e.abs();
  19826. if (e.isZero()) return this.abs();
  19827. var t = this.clone(),
  19828. i = e.clone();
  19829. t.negative = 0, i.negative = 0;
  19830. for (var r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1);
  19831. for (;;) {
  19832. for (; t.isEven();) t.iushrn(1);
  19833. for (; i.isEven();) i.iushrn(1);
  19834. var n = t.cmp(i);
  19835. if (n < 0) {
  19836. var a = t;
  19837. t = i, i = a
  19838. } else if (0 === n || 0 === i.cmpn(1)) break;
  19839. t.isub(i)
  19840. }
  19841. return i.iushln(r)
  19842. }, a.prototype.invm = function(e) {
  19843. return this.egcd(e).a.umod(e)
  19844. }, a.prototype.isEven = function() {
  19845. return 0 == (1 & this.words[0])
  19846. }, a.prototype.isOdd = function() {
  19847. return 1 == (1 & this.words[0])
  19848. }, a.prototype.andln = function(e) {
  19849. return this.words[0] & e
  19850. }, a.prototype.bincn = function(e) {
  19851. r("number" == typeof e);
  19852. var t = e % 26,
  19853. i = (e - t) / 26,
  19854. n = 1 << t;
  19855. if (this.length <= i) return this._expand(i + 1), this.words[i] |= n, this;
  19856. for (var a = n, s = i; 0 !== a && s < this.length; s++) {
  19857. var o = 0 | this.words[s];
  19858. a = (o += a) >>> 26, o &= 67108863, this.words[s] = o
  19859. }
  19860. return 0 !== a && (this.words[s] = a, this.length++), this
  19861. }, a.prototype.isZero = function() {
  19862. return 1 === this.length && 0 === this.words[0]
  19863. }, a.prototype.cmpn = function(e) {
  19864. var t, i = e < 0;
  19865. if (0 !== this.negative && !i) return -1;
  19866. if (0 === this.negative && i) return 1;
  19867. if (this.strip(), this.length > 1) t = 1;
  19868. else {
  19869. i && (e = -e), r(e <= 67108863, "Number is too big");
  19870. var n = 0 | this.words[0];
  19871. t = n === e ? 0 : n < e ? -1 : 1
  19872. }
  19873. return 0 !== this.negative ? 0 | -t : t
  19874. }, a.prototype.cmp = function(e) {
  19875. if (0 !== this.negative && 0 === e.negative) return -1;
  19876. if (0 === this.negative && 0 !== e.negative) return 1;
  19877. var t = this.ucmp(e);
  19878. return 0 !== this.negative ? 0 | -t : t
  19879. }, a.prototype.ucmp = function(e) {
  19880. if (this.length > e.length) return 1;
  19881. if (this.length < e.length) return -1;
  19882. for (var t = 0, i = this.length - 1; i >= 0; i--) {
  19883. var r = 0 | this.words[i],
  19884. n = 0 | e.words[i];
  19885. if (r !== n) {
  19886. r < n ? t = -1 : r > n && (t = 1);
  19887. break
  19888. }
  19889. }
  19890. return t
  19891. }, a.prototype.gtn = function(e) {
  19892. return 1 === this.cmpn(e)
  19893. }, a.prototype.gt = function(e) {
  19894. return 1 === this.cmp(e)
  19895. }, a.prototype.gten = function(e) {
  19896. return this.cmpn(e) >= 0
  19897. }, a.prototype.gte = function(e) {
  19898. return this.cmp(e) >= 0
  19899. }, a.prototype.ltn = function(e) {
  19900. return -1 === this.cmpn(e)
  19901. }, a.prototype.lt = function(e) {
  19902. return -1 === this.cmp(e)
  19903. }, a.prototype.lten = function(e) {
  19904. return this.cmpn(e) <= 0
  19905. }, a.prototype.lte = function(e) {
  19906. return this.cmp(e) <= 0
  19907. }, a.prototype.eqn = function(e) {
  19908. return 0 === this.cmpn(e)
  19909. }, a.prototype.eq = function(e) {
  19910. return 0 === this.cmp(e)
  19911. }, a.red = function(e) {
  19912. return new T(e)
  19913. }, a.prototype.toRed = function(e) {
  19914. return r(!this.red, "Already a number in reduction context"), r(0 === this.negative,
  19915. "red works only with positives"), e.convertTo(this)._forceRed(e)
  19916. }, a.prototype.fromRed = function() {
  19917. return r(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(
  19918. this)
  19919. }, a.prototype._forceRed = function(e) {
  19920. return this.red = e, this
  19921. }, a.prototype.forceRed = function(e) {
  19922. return r(!this.red, "Already a number in reduction context"), this._forceRed(e)
  19923. }, a.prototype.redAdd = function(e) {
  19924. return r(this.red, "redAdd works only with red numbers"), this.red.add(this, e)
  19925. }, a.prototype.redIAdd = function(e) {
  19926. return r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e)
  19927. }, a.prototype.redSub = function(e) {
  19928. return r(this.red, "redSub works only with red numbers"), this.red.sub(this, e)
  19929. }, a.prototype.redISub = function(e) {
  19930. return r(this.red, "redISub works only with red numbers"), this.red.isub(this, e)
  19931. }, a.prototype.redShl = function(e) {
  19932. return r(this.red, "redShl works only with red numbers"), this.red.shl(this, e)
  19933. }, a.prototype.redMul = function(e) {
  19934. return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red
  19935. .mul(this, e)
  19936. }, a.prototype.redIMul = function(e) {
  19937. return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red
  19938. .imul(this, e)
  19939. }, a.prototype.redSqr = function() {
  19940. return r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(
  19941. this)
  19942. }, a.prototype.redISqr = function() {
  19943. return r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(
  19944. this)
  19945. }, a.prototype.redSqrt = function() {
  19946. return r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(
  19947. this)
  19948. }, a.prototype.redInvm = function() {
  19949. return r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(
  19950. this)
  19951. }, a.prototype.redNeg = function() {
  19952. return r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(
  19953. this)
  19954. }, a.prototype.redPow = function(e) {
  19955. return r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e)
  19956. };
  19957. var v = {
  19958. k256: null,
  19959. p224: null,
  19960. p192: null,
  19961. p25519: null
  19962. };
  19963. function y(e, t) {
  19964. this.name = e, this.p = new a(t, 16), this.n = this.p.bitLength(), this.k = new a(1).iushln(this.n)
  19965. .isub(this.p), this.tmp = this._tmp()
  19966. }
  19967. function _() {
  19968. y.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")
  19969. }
  19970. function b() {
  19971. y.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")
  19972. }
  19973. function w() {
  19974. y.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")
  19975. }
  19976. function E() {
  19977. y.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")
  19978. }
  19979. function T(e) {
  19980. if ("string" == typeof e) {
  19981. var t = a._prime(e);
  19982. this.m = t.p, this.prime = t
  19983. } else r(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null
  19984. }
  19985. function S(e) {
  19986. T.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this
  19987. .shift % 26), this.r = new a(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this
  19988. .rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv =
  19989. this.minv.umod(this.r), this.minv = this.r.sub(this.minv)
  19990. }
  19991. y.prototype._tmp = function() {
  19992. var e = new a(null);
  19993. return e.words = new Array(Math.ceil(this.n / 13)), e
  19994. }, y.prototype.ireduce = function(e) {
  19995. var t, i = e;
  19996. do {
  19997. this.split(i, this.tmp), t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength()
  19998. } while (t > this.n);
  19999. var r = t < this.n ? -1 : i.ucmp(this.p);
  20000. return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 0 ? i.isub(this.p) : void 0 !== i.strip ? i
  20001. .strip() : i._strip(), i
  20002. }, y.prototype.split = function(e, t) {
  20003. e.iushrn(this.n, 0, t)
  20004. }, y.prototype.imulK = function(e) {
  20005. return e.imul(this.k)
  20006. }, n(_, y), _.prototype.split = function(e, t) {
  20007. for (var i = Math.min(e.length, 9), r = 0; r < i; r++) t.words[r] = e.words[r];
  20008. if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1);
  20009. var n = e.words[9];
  20010. for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) {
  20011. var a = 0 | e.words[r];
  20012. e.words[r - 10] = (4194303 & a) << 4 | n >>> 22, n = a
  20013. }
  20014. n >>>= 22, e.words[r - 10] = n, 0 === n && e.length > 10 ? e.length -= 10 : e.length -= 9
  20015. }, _.prototype.imulK = function(e) {
  20016. e.words[e.length] = 0, e.words[e.length + 1] = 0, e.length += 2;
  20017. for (var t = 0, i = 0; i < e.length; i++) {
  20018. var r = 0 | e.words[i];
  20019. t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (t / 67108864 | 0)
  20020. }
  20021. return 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e
  20022. }, n(b, y), n(w, y), n(E, y), E.prototype.imulK = function(e) {
  20023. for (var t = 0, i = 0; i < e.length; i++) {
  20024. var r = 19 * (0 | e.words[i]) + t,
  20025. n = 67108863 & r;
  20026. r >>>= 26, e.words[i] = n, t = r
  20027. }
  20028. return 0 !== t && (e.words[e.length++] = t), e
  20029. }, a._prime = function(e) {
  20030. if (v[e]) return v[e];
  20031. var t;
  20032. if ("k256" === e) t = new _;
  20033. else if ("p224" === e) t = new b;
  20034. else if ("p192" === e) t = new w;
  20035. else {
  20036. if ("p25519" !== e) throw new Error("Unknown prime " + e);
  20037. t = new E
  20038. }
  20039. return v[e] = t, t
  20040. }, T.prototype._verify1 = function(e) {
  20041. r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers")
  20042. }, T.prototype._verify2 = function(e, t) {
  20043. r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red,
  20044. "red works only with red numbers")
  20045. }, T.prototype.imod = function(e) {
  20046. return this.prime ? this.prime.ireduce(e)._forceRed(this) : e.umod(this.m)._forceRed(this)
  20047. }, T.prototype.neg = function(e) {
  20048. return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this)
  20049. }, T.prototype.add = function(e, t) {
  20050. this._verify2(e, t);
  20051. var i = e.add(t);
  20052. return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this)
  20053. }, T.prototype.iadd = function(e, t) {
  20054. this._verify2(e, t);
  20055. var i = e.iadd(t);
  20056. return i.cmp(this.m) >= 0 && i.isub(this.m), i
  20057. }, T.prototype.sub = function(e, t) {
  20058. this._verify2(e, t);
  20059. var i = e.sub(t);
  20060. return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this)
  20061. }, T.prototype.isub = function(e, t) {
  20062. this._verify2(e, t);
  20063. var i = e.isub(t);
  20064. return i.cmpn(0) < 0 && i.iadd(this.m), i
  20065. }, T.prototype.shl = function(e, t) {
  20066. return this._verify1(e), this.imod(e.ushln(t))
  20067. }, T.prototype.imul = function(e, t) {
  20068. return this._verify2(e, t), this.imod(e.imul(t))
  20069. }, T.prototype.mul = function(e, t) {
  20070. return this._verify2(e, t), this.imod(e.mul(t))
  20071. }, T.prototype.isqr = function(e) {
  20072. return this.imul(e, e.clone())
  20073. }, T.prototype.sqr = function(e) {
  20074. return this.mul(e, e)
  20075. }, T.prototype.sqrt = function(e) {
  20076. if (e.isZero()) return e.clone();
  20077. var t = this.m.andln(3);
  20078. if (r(t % 2 == 1), 3 === t) {
  20079. var i = this.m.add(new a(1)).iushrn(2);
  20080. return this.pow(e, i)
  20081. }
  20082. for (var n = this.m.subn(1), s = 0; !n.isZero() && 0 === n.andln(1);) s++, n.iushrn(1);
  20083. r(!n.isZero());
  20084. var o = new a(1).toRed(this),
  20085. u = o.redNeg(),
  20086. l = this.m.subn(1).iushrn(1),
  20087. d = this.m.bitLength();
  20088. for (d = new a(2 * d * d).toRed(this); 0 !== this.pow(d, l).cmp(u);) d.redIAdd(u);
  20089. for (var c = this.pow(d, n), h = this.pow(e, n.addn(1).iushrn(1)), f = this.pow(e, n), p =
  20090. s; 0 !== f.cmp(o);) {
  20091. for (var m = f, g = 0; 0 !== m.cmp(o); g++) m = m.redSqr();
  20092. r(g < p);
  20093. var v = this.pow(c, new a(1).iushln(p - g - 1));
  20094. h = h.redMul(v), c = v.redSqr(), f = f.redMul(c), p = g
  20095. }
  20096. return h
  20097. }, T.prototype.invm = function(e) {
  20098. var t = e._invmp(this.m);
  20099. return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t)
  20100. }, T.prototype.pow = function(e, t) {
  20101. if (t.isZero()) return new a(1).toRed(this);
  20102. if (0 === t.cmpn(1)) return e.clone();
  20103. var i = new Array(16);
  20104. i[0] = new a(1).toRed(this), i[1] = e;
  20105. for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e);
  20106. var n = i[0],
  20107. s = 0,
  20108. o = 0,
  20109. u = t.bitLength() % 26;
  20110. for (0 === u && (u = 26), r = t.length - 1; r >= 0; r--) {
  20111. for (var l = t.words[r], d = u - 1; d >= 0; d--) {
  20112. var c = l >> d & 1;
  20113. n !== i[0] && (n = this.sqr(n)), 0 !== c || 0 !== s ? (s <<= 1, s |= c, (4 == ++o || 0 ===
  20114. r && 0 === d) && (n = this.mul(n, i[s]), o = 0, s = 0)) : o = 0
  20115. }
  20116. u = 26
  20117. }
  20118. return n
  20119. }, T.prototype.convertTo = function(e) {
  20120. var t = e.umod(this.m);
  20121. return t === e ? t.clone() : t
  20122. }, T.prototype.convertFrom = function(e) {
  20123. var t = e.clone();
  20124. return t.red = null, t
  20125. }, a.mont = function(e) {
  20126. return new S(e)
  20127. }, n(S, T), S.prototype.convertTo = function(e) {
  20128. return this.imod(e.ushln(this.shift))
  20129. }, S.prototype.convertFrom = function(e) {
  20130. var t = this.imod(e.mul(this.rinv));
  20131. return t.red = null, t
  20132. }, S.prototype.imul = function(e, t) {
  20133. if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e;
  20134. var i = e.imul(t),
  20135. r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
  20136. n = i.isub(r).iushrn(this.shift),
  20137. a = n;
  20138. return n.cmp(this.m) >= 0 ? a = n.isub(this.m) : n.cmpn(0) < 0 && (a = n.iadd(this.m)), a
  20139. ._forceRed(this)
  20140. }, S.prototype.mul = function(e, t) {
  20141. if (e.isZero() || t.isZero()) return new a(0)._forceRed(this);
  20142. var i = e.mul(t),
  20143. r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
  20144. n = i.isub(r).iushrn(this.shift),
  20145. s = n;
  20146. return n.cmp(this.m) >= 0 ? s = n.isub(this.m) : n.cmpn(0) < 0 && (s = n.iadd(this.m)), s
  20147. ._forceRed(this)
  20148. }, S.prototype.invm = function(e) {
  20149. return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)
  20150. }
  20151. }(e, this)
  20152. }).call(this, i(55)(e))
  20153. }, function(e, t, i) {
  20154. "use strict";
  20155. t.a = {
  20156. OK: "OK",
  20157. FORMAT_ERROR: "FormatError",
  20158. FORMAT_UNSUPPORTED: "FormatUnsupported",
  20159. CODEC_UNSUPPORTED: "CodecUnsupported"
  20160. }
  20161. }, function(e, t) {
  20162. var i;
  20163. i = function() {
  20164. return this
  20165. }();
  20166. try {
  20167. i = i || new Function("return this")()
  20168. } catch (e) {
  20169. "object" == typeof window && (i = window)
  20170. }
  20171. e.exports = i
  20172. }, function(e, t) {
  20173. function i(e, t) {
  20174. if (!e) throw new Error(t || "Assertion failed")
  20175. }
  20176. e.exports = i, i.equal = function(e, t, i) {
  20177. if (e != t) throw new Error(i || "Assertion failed: " + e + " != " + t)
  20178. }
  20179. }, function(e, t, i) {
  20180. "use strict";
  20181. var r = t,
  20182. n = i(11),
  20183. a = i(14),
  20184. s = i(108);
  20185. r.assert = a, r.toArray = s.toArray, r.zero2 = s.zero2, r.toHex = s.toHex, r.encode = s.encode, r.getNAF =
  20186. function(e, t, i) {
  20187. var r = new Array(Math.max(e.bitLength(), i) + 1);
  20188. r.fill(0);
  20189. for (var n = 1 << t + 1, a = e.clone(), s = 0; s < r.length; s++) {
  20190. var o, u = a.andln(n - 1);
  20191. a.isOdd() ? (o = u > (n >> 1) - 1 ? (n >> 1) - u : u, a.isubn(o)) : o = 0, r[s] = o, a.iushrn(1)
  20192. }
  20193. return r
  20194. }, r.getJSF = function(e, t) {
  20195. var i = [
  20196. [],
  20197. []
  20198. ];
  20199. e = e.clone(), t = t.clone();
  20200. for (var r, n = 0, a = 0; e.cmpn(-n) > 0 || t.cmpn(-a) > 0;) {
  20201. var s, o, u = e.andln(3) + n & 3,
  20202. l = t.andln(3) + a & 3;
  20203. 3 === u && (u = -1), 3 === l && (l = -1), s = 0 == (1 & u) ? 0 : 3 != (r = e.andln(7) + n & 7) &&
  20204. 5 !== r || 2 !== l ? u : -u, i[0].push(s), o = 0 == (1 & l) ? 0 : 3 != (r = t.andln(7) + a & 7) &&
  20205. 5 !== r || 2 !== u ? l : -l, i[1].push(o), 2 * n === s + 1 && (n = 1 - n), 2 * a === o + 1 && (a =
  20206. 1 - a), e.iushrn(1), t.iushrn(1)
  20207. }
  20208. return i
  20209. }, r.cachedProperty = function(e, t, i) {
  20210. var r = "_" + t;
  20211. e.prototype[t] = function() {
  20212. return void 0 !== this[r] ? this[r] : this[r] = i.call(this)
  20213. }
  20214. }, r.parseBytes = function(e) {
  20215. return "string" == typeof e ? r.toArray(e, "hex") : e
  20216. }, r.intFromLE = function(e) {
  20217. return new n(e, "hex", "le")
  20218. }
  20219. }, function(e, t, i) {
  20220. "use strict";
  20221. function r(e, t) {
  20222. for (var i = 0; i < t.length; i++) {
  20223. var r = t[i];
  20224. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  20225. .defineProperty(e, r.key, r)
  20226. }
  20227. }
  20228. i.d(t, "d", function() {
  20229. return n
  20230. }), i.d(t, "b", function() {
  20231. return a
  20232. }), i.d(t, "a", function() {
  20233. return s
  20234. }), i.d(t, "c", function() {
  20235. return o
  20236. });
  20237. var n = function(e, t, i, r, n) {
  20238. this.dts = e, this.pts = t, this.duration = i, this.originalDts = r, this.isSyncPoint = n, this
  20239. .fileposition = null
  20240. },
  20241. a = function() {
  20242. function e() {
  20243. this.beginDts = 0, this.endDts = 0, this.beginPts = 0, this.endPts = 0, this.originalBeginDts = 0,
  20244. this.originalEndDts = 0, this.syncPoints = [], this.firstSample = null, this.lastSample = null
  20245. }
  20246. return e.prototype.appendSyncPoint = function(e) {
  20247. e.isSyncPoint = !0, this.syncPoints.push(e)
  20248. }, e
  20249. }(),
  20250. s = function() {
  20251. function e() {
  20252. this._list = []
  20253. }
  20254. var t = e.prototype;
  20255. return t.clear = function() {
  20256. this._list = []
  20257. }, t.appendArray = function(e) {
  20258. var t = this._list;
  20259. 0 !== e.length && (t.length > 0 && e[0].originalDts < t[t.length - 1].originalDts && this.clear(),
  20260. Array.prototype.push.apply(t, e))
  20261. }, t.getLastSyncPointBeforeDts = function(e) {
  20262. if (0 == this._list.length) return null;
  20263. var t = this._list,
  20264. i = 0,
  20265. r = t.length - 1,
  20266. n = 0,
  20267. a = 0,
  20268. s = r;
  20269. for (e < t[0].dts && (i = 0, a = s + 1); a <= s;) {
  20270. if ((n = a + Math.floor((s - a) / 2)) === r || e >= t[n].dts && e < t[n + 1].dts) {
  20271. i = n;
  20272. break
  20273. }
  20274. t[n].dts < e ? a = n + 1 : s = n - 1
  20275. }
  20276. return this._list[i]
  20277. }, e
  20278. }(),
  20279. o = function() {
  20280. function e(e) {
  20281. this._type = e, this._list = [], this._lastAppendLocation = -1
  20282. }
  20283. var t, i, n = e.prototype;
  20284. return n.isEmpty = function() {
  20285. return 0 === this._list.length
  20286. }, n.clear = function() {
  20287. this._list = [], this._lastAppendLocation = -1
  20288. }, n._searchNearestSegmentBefore = function(e) {
  20289. var t = this._list;
  20290. if (0 === t.length) return -2;
  20291. var i = t.length - 1,
  20292. r = 0,
  20293. n = 0,
  20294. a = i,
  20295. s = 0;
  20296. if (e < t[0].originalBeginDts) return -1;
  20297. for (; n <= a;) {
  20298. if ((r = n + Math.floor((a - n) / 2)) === i || e > t[r].lastSample.originalDts && e < t[r + 1]
  20299. .originalBeginDts) {
  20300. s = r;
  20301. break
  20302. }
  20303. t[r].originalBeginDts < e ? n = r + 1 : a = r - 1
  20304. }
  20305. return s
  20306. }, n._searchNearestSegmentAfter = function(e) {
  20307. return this._searchNearestSegmentBefore(e) + 1
  20308. }, n.append = function(e) {
  20309. var t = this._list,
  20310. i = e,
  20311. r = this._lastAppendLocation,
  20312. n = 0; - 1 !== r && r < t.length && i.originalBeginDts >= t[r].lastSample.originalDts && (r === t
  20313. .length - 1 || r < t.length - 1 && i.originalBeginDts < t[r + 1].originalBeginDts) ? n = r + 1 :
  20314. t.length > 0 && (n = this._searchNearestSegmentBefore(i.originalBeginDts) + 1), this
  20315. ._lastAppendLocation = n, this._list.splice(n, 0, i)
  20316. }, n.getLastSegmentBefore = function(e) {
  20317. var t = this._searchNearestSegmentBefore(e);
  20318. return t >= 0 ? this._list[t] : null
  20319. }, n.getLastSampleBefore = function(e) {
  20320. var t = this.getLastSegmentBefore(e);
  20321. return null != t ? t.lastSample : null
  20322. }, n.getLastSyncPointBefore = function(e) {
  20323. for (var t = this._searchNearestSegmentBefore(e), i = this._list[t].syncPoints; 0 === i.length &&
  20324. t > 0;) t--, i = this._list[t].syncPoints;
  20325. return i.length > 0 ? i[i.length - 1] : null
  20326. }, t = e, (i = [{
  20327. key: "type",
  20328. get: function() {
  20329. return this._type
  20330. }
  20331. }, {
  20332. key: "length",
  20333. get: function() {
  20334. return this._list.length
  20335. }
  20336. }]) && r(t.prototype, i), Object.defineProperty(t, "prototype", {
  20337. writable: !1
  20338. }), e
  20339. }()
  20340. }, function(e, t, i) {
  20341. "use strict";
  20342. var r = function() {
  20343. function e() {
  20344. this.mimeType = null, this.duration = null, this.hasAudio = null, this.hasVideo = null, this
  20345. .audioCodec = null, this.videoCodec = null, this.audioDataRate = null, this.videoDataRate = null,
  20346. this.audioSampleRate = null, this.audioChannelCount = null, this.width = null, this.height = null,
  20347. this.fps = null, this.profile = null, this.level = null, this.refFrames = null, this.chromaFormat =
  20348. null, this.sarNum = null, this.sarDen = null, this.metadata = null, this.segments = null, this
  20349. .segmentCount = null, this.hasKeyframesIndex = null, this.keyframesIndex = null
  20350. }
  20351. var t = e.prototype;
  20352. return t.isComplete = function() {
  20353. var e = !1 === this.hasAudio || !0 === this.hasAudio && null != this.audioCodec && null != this
  20354. .audioSampleRate && null != this.audioChannelCount,
  20355. t = !1 === this.hasVideo || !0 === this.hasVideo && null != this.videoCodec && null != this
  20356. .width && null != this.height && null != this.fps && null != this.profile && null != this.level &&
  20357. null != this.refFrames && null != this.chromaFormat && null != this.sarNum && null != this.sarDen;
  20358. return null != this.mimeType && null != this.duration && null != this.metadata && null != this
  20359. .hasKeyframesIndex && e && t
  20360. }, t.isSeekable = function() {
  20361. return !0 === this.hasKeyframesIndex
  20362. }, t.getNearestKeyframe = function(e) {
  20363. if (null == this.keyframesIndex) return null;
  20364. var t = this.keyframesIndex,
  20365. i = this._search(t.times, e);
  20366. return {
  20367. index: i,
  20368. milliseconds: t.times[i],
  20369. fileposition: t.filepositions[i]
  20370. }
  20371. }, t._search = function(e, t) {
  20372. var i = 0,
  20373. r = e.length - 1,
  20374. n = 0,
  20375. a = 0,
  20376. s = r;
  20377. for (t < e[0] && (i = 0, a = s + 1); a <= s;) {
  20378. if ((n = a + Math.floor((s - a) / 2)) === r || t >= e[n] && t < e[n + 1]) {
  20379. i = n;
  20380. break
  20381. }
  20382. e[n] < t ? a = n + 1 : s = n - 1
  20383. }
  20384. return i
  20385. }, e
  20386. }();
  20387. t.a = r
  20388. }, function(e, t, i) {
  20389. "use strict";
  20390. var r = i(14),
  20391. n = i(5);
  20392. function a(e, t) {
  20393. return 55296 == (64512 & e.charCodeAt(t)) && !(t < 0 || t + 1 >= e.length) && 56320 == (64512 & e
  20394. .charCodeAt(t + 1))
  20395. }
  20396. function s(e) {
  20397. return (e >>> 24 | e >>> 8 & 65280 | e << 8 & 16711680 | (255 & e) << 24) >>> 0
  20398. }
  20399. function o(e) {
  20400. return 1 === e.length ? "0" + e : e
  20401. }
  20402. function u(e) {
  20403. return 7 === e.length ? "0" + e : 6 === e.length ? "00" + e : 5 === e.length ? "000" + e : 4 === e
  20404. .length ? "0000" + e : 3 === e.length ? "00000" + e : 2 === e.length ? "000000" + e : 1 === e.length ?
  20405. "0000000" + e : e
  20406. }
  20407. t.inherits = n, t.toArray = function(e, t) {
  20408. if (Array.isArray(e)) return e.slice();
  20409. if (!e) return [];
  20410. var i = [];
  20411. if ("string" == typeof e)
  20412. if (t) {
  20413. if ("hex" === t)
  20414. for ((e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), n = 0; n < e
  20415. .length; n += 2) i.push(parseInt(e[n] + e[n + 1], 16))
  20416. } else
  20417. for (var r = 0, n = 0; n < e.length; n++) {
  20418. var s = e.charCodeAt(n);
  20419. s < 128 ? i[r++] = s : s < 2048 ? (i[r++] = s >> 6 | 192, i[r++] = 63 & s | 128) : a(e, n) ? (s =
  20420. 65536 + ((1023 & s) << 10) + (1023 & e.charCodeAt(++n)), i[r++] = s >> 18 | 240, i[r++] = s >>
  20421. 12 & 63 | 128, i[r++] = s >> 6 & 63 | 128, i[r++] = 63 & s | 128) : (i[r++] = s >> 12 | 224,
  20422. i[r++] = s >> 6 & 63 | 128, i[r++] = 63 & s | 128)
  20423. } else
  20424. for (n = 0; n < e.length; n++) i[n] = 0 | e[n];
  20425. return i
  20426. }, t.toHex = function(e) {
  20427. for (var t = "", i = 0; i < e.length; i++) t += o(e[i].toString(16));
  20428. return t
  20429. }, t.htonl = s, t.toHex32 = function(e, t) {
  20430. for (var i = "", r = 0; r < e.length; r++) {
  20431. var n = e[r];
  20432. "little" === t && (n = s(n)), i += u(n.toString(16))
  20433. }
  20434. return i
  20435. }, t.zero2 = o, t.zero8 = u, t.join32 = function(e, t, i, n) {
  20436. var a = i - t;
  20437. r(a % 4 == 0);
  20438. for (var s = new Array(a / 4), o = 0, u = t; o < s.length; o++, u += 4) {
  20439. var l;
  20440. l = "big" === n ? e[u] << 24 | e[u + 1] << 16 | e[u + 2] << 8 | e[u + 3] : e[u + 3] << 24 | e[u +
  20441. 2] << 16 | e[u + 1] << 8 | e[u], s[o] = l >>> 0
  20442. }
  20443. return s
  20444. }, t.split32 = function(e, t) {
  20445. for (var i = new Array(4 * e.length), r = 0, n = 0; r < e.length; r++, n += 4) {
  20446. var a = e[r];
  20447. "big" === t ? (i[n] = a >>> 24, i[n + 1] = a >>> 16 & 255, i[n + 2] = a >>> 8 & 255, i[n + 3] = 255 &
  20448. a) : (i[n + 3] = a >>> 24, i[n + 2] = a >>> 16 & 255, i[n + 1] = a >>> 8 & 255, i[n] = 255 & a)
  20449. }
  20450. return i
  20451. }, t.rotr32 = function(e, t) {
  20452. return e >>> t | e << 32 - t
  20453. }, t.rotl32 = function(e, t) {
  20454. return e << t | e >>> 32 - t
  20455. }, t.sum32 = function(e, t) {
  20456. return e + t >>> 0
  20457. }, t.sum32_3 = function(e, t, i) {
  20458. return e + t + i >>> 0
  20459. }, t.sum32_4 = function(e, t, i, r) {
  20460. return e + t + i + r >>> 0
  20461. }, t.sum32_5 = function(e, t, i, r, n) {
  20462. return e + t + i + r + n >>> 0
  20463. }, t.sum64 = function(e, t, i, r) {
  20464. var n = e[t],
  20465. a = r + e[t + 1] >>> 0,
  20466. s = (a < r ? 1 : 0) + i + n;
  20467. e[t] = s >>> 0, e[t + 1] = a
  20468. }, t.sum64_hi = function(e, t, i, r) {
  20469. return (t + r >>> 0 < t ? 1 : 0) + e + i >>> 0
  20470. }, t.sum64_lo = function(e, t, i, r) {
  20471. return t + r >>> 0
  20472. }, t.sum64_4_hi = function(e, t, i, r, n, a, s, o) {
  20473. var u = 0,
  20474. l = t;
  20475. return u += (l = l + r >>> 0) < t ? 1 : 0, u += (l = l + a >>> 0) < a ? 1 : 0, e + i + n + s + (u += (
  20476. l = l + o >>> 0) < o ? 1 : 0) >>> 0
  20477. }, t.sum64_4_lo = function(e, t, i, r, n, a, s, o) {
  20478. return t + r + a + o >>> 0
  20479. }, t.sum64_5_hi = function(e, t, i, r, n, a, s, o, u, l) {
  20480. var d = 0,
  20481. c = t;
  20482. return d += (c = c + r >>> 0) < t ? 1 : 0, d += (c = c + a >>> 0) < a ? 1 : 0, d += (c = c + o >>> 0) <
  20483. o ? 1 : 0, e + i + n + s + u + (d += (c = c + l >>> 0) < l ? 1 : 0) >>> 0
  20484. }, t.sum64_5_lo = function(e, t, i, r, n, a, s, o, u, l) {
  20485. return t + r + a + o + l >>> 0
  20486. }, t.rotr64_hi = function(e, t, i) {
  20487. return (t << 32 - i | e >>> i) >>> 0
  20488. }, t.rotr64_lo = function(e, t, i) {
  20489. return (e << 32 - i | t >>> i) >>> 0
  20490. }, t.shr64_hi = function(e, t, i) {
  20491. return e >>> i
  20492. }, t.shr64_lo = function(e, t, i) {
  20493. return (e << 32 - i | t >>> i) >>> 0
  20494. }
  20495. }, function(e, t, i) {
  20496. "use strict";
  20497. var r = i(8),
  20498. n = i.n(r),
  20499. a = i(0);
  20500. function s(e, t) {
  20501. for (var i = 0; i < t.length; i++) {
  20502. var r = t[i];
  20503. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  20504. .defineProperty(e, r.key, r)
  20505. }
  20506. }
  20507. var o = function() {
  20508. function e() {}
  20509. var t, i;
  20510. return e.getConfig = function() {
  20511. return {
  20512. globalTag: a.a.GLOBAL_TAG,
  20513. forceGlobalTag: a.a.FORCE_GLOBAL_TAG,
  20514. enableVerbose: a.a.ENABLE_VERBOSE,
  20515. enableDebug: a.a.ENABLE_DEBUG,
  20516. enableInfo: a.a.ENABLE_INFO,
  20517. enableWarn: a.a.ENABLE_WARN,
  20518. enableError: a.a.ENABLE_ERROR,
  20519. enableCallback: a.a.ENABLE_CALLBACK
  20520. }
  20521. }, e.applyConfig = function(e) {
  20522. a.a.GLOBAL_TAG = e.globalTag, a.a.FORCE_GLOBAL_TAG = e.forceGlobalTag, a.a.ENABLE_VERBOSE = e
  20523. .enableVerbose, a.a.ENABLE_DEBUG = e.enableDebug, a.a.ENABLE_INFO = e.enableInfo, a.a
  20524. .ENABLE_WARN = e.enableWarn, a.a.ENABLE_ERROR = e.enableError, a.a.ENABLE_CALLBACK = e
  20525. .enableCallback
  20526. }, e._notifyChange = function() {
  20527. var t = e.emitter;
  20528. if (t.listenerCount("change") > 0) {
  20529. var i = e.getConfig();
  20530. t.emit("change", i)
  20531. }
  20532. }, e.registerListener = function(t) {
  20533. e.emitter.addListener("change", t)
  20534. }, e.removeListener = function(t) {
  20535. e.emitter.removeListener("change", t)
  20536. }, e.addLogListener = function(t) {
  20537. a.a.emitter.addListener("log", t), a.a.emitter.listenerCount("log") > 0 && (a.a.ENABLE_CALLBACK = !
  20538. 0, e._notifyChange())
  20539. }, e.removeLogListener = function(t) {
  20540. a.a.emitter.removeListener("log", t), 0 === a.a.emitter.listenerCount("log") && (a.a
  20541. .ENABLE_CALLBACK = !1, e._notifyChange())
  20542. }, t = e, i = [{
  20543. key: "forceGlobalTag",
  20544. get: function() {
  20545. return a.a.FORCE_GLOBAL_TAG
  20546. },
  20547. set: function(t) {
  20548. a.a.FORCE_GLOBAL_TAG = t, e._notifyChange()
  20549. }
  20550. }, {
  20551. key: "globalTag",
  20552. get: function() {
  20553. return a.a.GLOBAL_TAG
  20554. },
  20555. set: function(t) {
  20556. a.a.GLOBAL_TAG = t, e._notifyChange()
  20557. }
  20558. }, {
  20559. key: "enableAll",
  20560. get: function() {
  20561. return a.a.ENABLE_VERBOSE && a.a.ENABLE_DEBUG && a.a.ENABLE_INFO && a.a.ENABLE_WARN && a.a
  20562. .ENABLE_ERROR
  20563. },
  20564. set: function(t) {
  20565. a.a.ENABLE_VERBOSE = t, a.a.ENABLE_DEBUG = t, a.a.ENABLE_INFO = t, a.a.ENABLE_WARN = t, a.a
  20566. .ENABLE_ERROR = t, e._notifyChange()
  20567. }
  20568. }, {
  20569. key: "enableDebug",
  20570. get: function() {
  20571. return a.a.ENABLE_DEBUG
  20572. },
  20573. set: function(t) {
  20574. a.a.ENABLE_DEBUG = t, e._notifyChange()
  20575. }
  20576. }, {
  20577. key: "enableVerbose",
  20578. get: function() {
  20579. return a.a.ENABLE_VERBOSE
  20580. },
  20581. set: function(t) {
  20582. a.a.ENABLE_VERBOSE = t, e._notifyChange()
  20583. }
  20584. }, {
  20585. key: "enableInfo",
  20586. get: function() {
  20587. return a.a.ENABLE_INFO
  20588. },
  20589. set: function(t) {
  20590. a.a.ENABLE_INFO = t, e._notifyChange()
  20591. }
  20592. }, {
  20593. key: "enableWarn",
  20594. get: function() {
  20595. return a.a.ENABLE_WARN
  20596. },
  20597. set: function(t) {
  20598. a.a.ENABLE_WARN = t, e._notifyChange()
  20599. }
  20600. }, {
  20601. key: "enableError",
  20602. get: function() {
  20603. return a.a.ENABLE_ERROR
  20604. },
  20605. set: function(t) {
  20606. a.a.ENABLE_ERROR = t, e._notifyChange()
  20607. }
  20608. }], null && s(t.prototype, null), i && s(t, i), Object.defineProperty(t, "prototype", {
  20609. writable: !1
  20610. }), e
  20611. }();
  20612. o.emitter = new n.a, t.a = o
  20613. }, function(e, t, i) {
  20614. var r = i(6).Buffer,
  20615. n = i(148).Transform,
  20616. a = i(22).StringDecoder;
  20617. function s(e) {
  20618. n.call(this), this.hashMode = "string" == typeof e, this.hashMode ? this[e] = this._finalOrDigest : this
  20619. .final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this
  20620. ._decoder = null, this._encoding = null
  20621. }
  20622. i(5)(s, n), s.prototype.update = function(e, t, i) {
  20623. "string" == typeof e && (e = r.from(e, t));
  20624. var n = this._update(e);
  20625. return this.hashMode ? this : (i && (n = this._toString(n, i)), n)
  20626. }, s.prototype.setAutoPadding = function() {}, s.prototype.getAuthTag = function() {
  20627. throw new Error("trying to get auth tag in unsupported state")
  20628. }, s.prototype.setAuthTag = function() {
  20629. throw new Error("trying to set auth tag in unsupported state")
  20630. }, s.prototype.setAAD = function() {
  20631. throw new Error("trying to set aad in unsupported state")
  20632. }, s.prototype._transform = function(e, t, i) {
  20633. var r;
  20634. try {
  20635. this.hashMode ? this._update(e) : this.push(this._update(e))
  20636. } catch (e) {
  20637. r = e
  20638. } finally {
  20639. i(r)
  20640. }
  20641. }, s.prototype._flush = function(e) {
  20642. var t;
  20643. try {
  20644. this.push(this.__final())
  20645. } catch (e) {
  20646. t = e
  20647. }
  20648. e(t)
  20649. }, s.prototype._finalOrDigest = function(e) {
  20650. var t = this.__final() || r.alloc(0);
  20651. return e && (t = this._toString(t, e, !0)), t
  20652. }, s.prototype._toString = function(e, t, i) {
  20653. if (this._decoder || (this._decoder = new a(t), this._encoding = t), this._encoding !== t)
  20654. throw new Error("can't switch encodings");
  20655. var r = this._decoder.write(e);
  20656. return i && (r += this._decoder.end()), r
  20657. }, e.exports = s
  20658. }, function(e, t, i) {
  20659. function r(e) {
  20660. var t = {};
  20661. function i(r) {
  20662. if (t[r]) return t[r].exports;
  20663. var n = t[r] = {
  20664. i: r,
  20665. l: !1,
  20666. exports: {}
  20667. };
  20668. return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports
  20669. }
  20670. i.m = e, i.c = t, i.i = function(e) {
  20671. return e
  20672. }, i.d = function(e, t, r) {
  20673. i.o(e, t) || Object.defineProperty(e, t, {
  20674. configurable: !1,
  20675. enumerable: !0,
  20676. get: r
  20677. })
  20678. }, i.r = function(e) {
  20679. Object.defineProperty(e, "__esModule", {
  20680. value: !0
  20681. })
  20682. }, i.n = function(e) {
  20683. var t = e && e.__esModule ? function() {
  20684. return e.default
  20685. } : function() {
  20686. return e
  20687. };
  20688. return i.d(t, "a", t), t
  20689. }, i.o = function(e, t) {
  20690. return Object.prototype.hasOwnProperty.call(e, t)
  20691. }, i.p = "/", i.oe = function(e) {
  20692. throw console.error(e), e
  20693. };
  20694. var r = i(i.s = ENTRY_MODULE);
  20695. return r.default || r
  20696. }
  20697. function n(e) {
  20698. return (e + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
  20699. }
  20700. function a(e, t, r) {
  20701. var a = {};
  20702. a[r] = [];
  20703. var s = t.toString(),
  20704. o = s.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
  20705. if (!o) return a;
  20706. for (var u, l = o[1], d = new RegExp("(\\\\n|\\W)" + n(l) +
  20707. "\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)", "g"); u = d.exec(s);)
  20708. "dll-reference" !== u[3] && a[r].push(u[3]);
  20709. for (d = new RegExp("\\(" + n(l) +
  20710. '\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',
  20711. "g"); u = d.exec(s);) e[u[2]] || (a[r].push(u[1]), e[u[2]] = i(u[1]).m), a[u[2]] = a[u[2]] || [], a[u[
  20712. 2]].push(u[4]);
  20713. for (var c, h = Object.keys(a), f = 0; f < h.length; f++)
  20714. for (var p = 0; p < a[h[f]].length; p++) c = a[h[f]][p], isNaN(1 * c) || (a[h[f]][p] = 1 * a[h[f]][p]);
  20715. return a
  20716. }
  20717. function s(e) {
  20718. return Object.keys(e).reduce(function(t, i) {
  20719. return t || e[i].length > 0
  20720. }, !1)
  20721. }
  20722. e.exports = function(e, t) {
  20723. t = t || {};
  20724. var n = {
  20725. main: i.m
  20726. },
  20727. o = t.all ? {
  20728. main: Object.keys(n.main)
  20729. } : function(e, t) {
  20730. for (var i = {
  20731. main: [t]
  20732. }, r = {
  20733. main: []
  20734. }, n = {
  20735. main: {}
  20736. }; s(i);)
  20737. for (var o = Object.keys(i), u = 0; u < o.length; u++) {
  20738. var l = o[u],
  20739. d = i[l].pop();
  20740. if (n[l] = n[l] || {}, !n[l][d] && e[l][d]) {
  20741. n[l][d] = !0, r[l] = r[l] || [], r[l].push(d);
  20742. for (var c = a(e, e[l][d], l), h = Object.keys(c), f = 0; f < h.length; f++) i[h[f]] = i[h[
  20743. f]] || [], i[h[f]] = i[h[f]].concat(c[h[f]])
  20744. }
  20745. }
  20746. return r
  20747. }(n, e),
  20748. u = "";
  20749. Object.keys(o).filter(function(e) {
  20750. return "main" !== e
  20751. }).forEach(function(e) {
  20752. for (var t = 0; o[e][t];) t++;
  20753. o[e].push(t), n[e][t] =
  20754. "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",
  20755. u = u + "var " + e + " = (" + r.toString().replace("ENTRY_MODULE", JSON.stringify(t)) + ")({" +
  20756. o[e].map(function(t) {
  20757. return JSON.stringify(t) + ": " + n[e][t].toString()
  20758. }).join(",") + "});\n"
  20759. }), u = u + "new ((" + r.toString().replace("ENTRY_MODULE", JSON.stringify(e)) + ")({" + o.main.map(
  20760. function(e) {
  20761. return JSON.stringify(e) + ": " + n.main[e].toString()
  20762. }).join(",") + "}))(self);";
  20763. var l = new window.Blob([u], {
  20764. type: "text/javascript"
  20765. });
  20766. if (t.bare) return l;
  20767. var d = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(l),
  20768. c = new window.Worker(d);
  20769. return c.objectURL = d, c
  20770. }
  20771. }, function(e, t, i) {
  20772. "use strict";
  20773. var r = i(6).Buffer,
  20774. n = r.isEncoding || function(e) {
  20775. switch ((e = "" + e) && e.toLowerCase()) {
  20776. case "hex":
  20777. case "utf8":
  20778. case "utf-8":
  20779. case "ascii":
  20780. case "binary":
  20781. case "base64":
  20782. case "ucs2":
  20783. case "ucs-2":
  20784. case "utf16le":
  20785. case "utf-16le":
  20786. case "raw":
  20787. return !0;
  20788. default:
  20789. return !1
  20790. }
  20791. };
  20792. function a(e) {
  20793. var t;
  20794. switch (this.encoding = function(e) {
  20795. var t = function(e) {
  20796. if (!e) return "utf8";
  20797. for (var t;;) switch (e) {
  20798. case "utf8":
  20799. case "utf-8":
  20800. return "utf8";
  20801. case "ucs2":
  20802. case "ucs-2":
  20803. case "utf16le":
  20804. case "utf-16le":
  20805. return "utf16le";
  20806. case "latin1":
  20807. case "binary":
  20808. return "latin1";
  20809. case "base64":
  20810. case "ascii":
  20811. case "hex":
  20812. return e;
  20813. default:
  20814. if (t) return;
  20815. e = ("" + e).toLowerCase(), t = !0
  20816. }
  20817. }(e);
  20818. if ("string" != typeof t && (r.isEncoding === n || !n(e))) throw new Error("Unknown encoding: " + e);
  20819. return t || e
  20820. }(e), this.encoding) {
  20821. case "utf16le":
  20822. this.text = u, this.end = l, t = 4;
  20823. break;
  20824. case "utf8":
  20825. this.fillLast = o, t = 4;
  20826. break;
  20827. case "base64":
  20828. this.text = d, this.end = c, t = 3;
  20829. break;
  20830. default:
  20831. return this.write = h, void(this.end = f)
  20832. }
  20833. this.lastNeed = 0, this.lastTotal = 0, this.lastChar = r.allocUnsafe(t)
  20834. }
  20835. function s(e) {
  20836. return e <= 127 ? 0 : e >> 5 == 6 ? 2 : e >> 4 == 14 ? 3 : e >> 3 == 30 ? 4 : e >> 6 == 2 ? -1 : -2
  20837. }
  20838. function o(e) {
  20839. var t = this.lastTotal - this.lastNeed,
  20840. i = function(e, t, i) {
  20841. if (128 != (192 & t[0])) return e.lastNeed = 0, "�";
  20842. if (e.lastNeed > 1 && t.length > 1) {
  20843. if (128 != (192 & t[1])) return e.lastNeed = 1, "�";
  20844. if (e.lastNeed > 2 && t.length > 2 && 128 != (192 & t[2])) return e.lastNeed = 2, "�"
  20845. }
  20846. }(this, e);
  20847. return void 0 !== i ? i : this.lastNeed <= e.length ? (e.copy(this.lastChar, t, 0, this.lastNeed), this
  20848. .lastChar.toString(this.encoding, 0, this.lastTotal)) : (e.copy(this.lastChar, t, 0, e.length), void(
  20849. this.lastNeed -= e.length))
  20850. }
  20851. function u(e, t) {
  20852. if ((e.length - t) % 2 == 0) {
  20853. var i = e.toString("utf16le", t);
  20854. if (i) {
  20855. var r = i.charCodeAt(i.length - 1);
  20856. if (r >= 55296 && r <= 56319) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = e[e
  20857. .length - 2], this.lastChar[1] = e[e.length - 1], i.slice(0, -1)
  20858. }
  20859. return i
  20860. }
  20861. return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = e[e.length - 1], e.toString("utf16le", t,
  20862. e.length - 1)
  20863. }
  20864. function l(e) {
  20865. var t = e && e.length ? this.write(e) : "";
  20866. if (this.lastNeed) {
  20867. var i = this.lastTotal - this.lastNeed;
  20868. return t + this.lastChar.toString("utf16le", 0, i)
  20869. }
  20870. return t
  20871. }
  20872. function d(e, t) {
  20873. var i = (e.length - t) % 3;
  20874. return 0 === i ? e.toString("base64", t) : (this.lastNeed = 3 - i, this.lastTotal = 3, 1 === i ? this
  20875. .lastChar[0] = e[e.length - 1] : (this.lastChar[0] = e[e.length - 2], this.lastChar[1] = e[e.length -
  20876. 1]), e.toString("base64", t, e.length - i))
  20877. }
  20878. function c(e) {
  20879. var t = e && e.length ? this.write(e) : "";
  20880. return this.lastNeed ? t + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : t
  20881. }
  20882. function h(e) {
  20883. return e.toString(this.encoding)
  20884. }
  20885. function f(e) {
  20886. return e && e.length ? this.write(e) : ""
  20887. }
  20888. t.StringDecoder = a, a.prototype.write = function(e) {
  20889. if (0 === e.length) return "";
  20890. var t, i;
  20891. if (this.lastNeed) {
  20892. if (void 0 === (t = this.fillLast(e))) return "";
  20893. i = this.lastNeed, this.lastNeed = 0
  20894. } else i = 0;
  20895. return i < e.length ? t ? t + this.text(e, i) : this.text(e, i) : t || ""
  20896. }, a.prototype.end = function(e) {
  20897. var t = e && e.length ? this.write(e) : "";
  20898. return this.lastNeed ? t + "�" : t
  20899. }, a.prototype.text = function(e, t) {
  20900. var i = function(e, t, i) {
  20901. var r = t.length - 1;
  20902. if (r < i) return 0;
  20903. var n = s(t[r]);
  20904. return n >= 0 ? (n > 0 && (e.lastNeed = n - 1), n) : --r < i || -2 === n ? 0 : (n = s(t[r])) >= 0 ?
  20905. (n > 0 && (e.lastNeed = n - 2), n) : --r < i || -2 === n ? 0 : (n = s(t[r])) >= 0 ? (n > 0 && (
  20906. 2 === n ? n = 0 : e.lastNeed = n - 3), n) : 0
  20907. }(this, e, t);
  20908. if (!this.lastNeed) return e.toString("utf8", t);
  20909. this.lastTotal = i;
  20910. var r = e.length - (i - this.lastNeed);
  20911. return e.copy(this.lastChar, 0, r), e.toString("utf8", t, r)
  20912. }, a.prototype.fillLast = function(e) {
  20913. if (this.lastNeed <= e.length) return e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this
  20914. .lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
  20915. e.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, e.length), this.lastNeed -= e.length
  20916. }
  20917. }, function(e, t, i) {
  20918. "use strict";
  20919. var r = i(38),
  20920. n = Object.keys || function(e) {
  20921. var t = [];
  20922. for (var i in e) t.push(i);
  20923. return t
  20924. };
  20925. e.exports = c;
  20926. var a = Object.create(i(32));
  20927. a.inherits = i(5);
  20928. var s = i(81),
  20929. o = i(51);
  20930. a.inherits(c, s);
  20931. for (var u = n(o.prototype), l = 0; l < u.length; l++) {
  20932. var d = u[l];
  20933. c.prototype[d] || (c.prototype[d] = o.prototype[d])
  20934. }
  20935. function c(e) {
  20936. if (!(this instanceof c)) return new c(e);
  20937. s.call(this, e), o.call(this, e), e && !1 === e.readable && (this.readable = !1), e && !1 === e
  20938. .writable && (this.writable = !1), this.allowHalfOpen = !0, e && !1 === e.allowHalfOpen && (this
  20939. .allowHalfOpen = !1), this.once("end", h)
  20940. }
  20941. function h() {
  20942. this.allowHalfOpen || this._writableState.ended || r.nextTick(f, this)
  20943. }
  20944. function f(e) {
  20945. e.end()
  20946. }
  20947. Object.defineProperty(c.prototype, "writableHighWaterMark", {
  20948. enumerable: !1,
  20949. get: function() {
  20950. return this._writableState.highWaterMark
  20951. }
  20952. }), Object.defineProperty(c.prototype, "destroyed", {
  20953. get: function() {
  20954. return void 0 !== this._readableState && void 0 !== this._writableState && this._readableState
  20955. .destroyed && this._writableState.destroyed
  20956. },
  20957. set: function(e) {
  20958. void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState
  20959. .destroyed = e, this._writableState.destroyed = e)
  20960. }
  20961. }), c.prototype._destroy = function(e, t) {
  20962. this.push(null), this.end(), r.nextTick(t, e)
  20963. }
  20964. }, function(e, t, i) {
  20965. "use strict";
  20966. (function(t, r) {
  20967. var n = i(6).Buffer,
  20968. a = t.crypto || t.msCrypto;
  20969. a && a.getRandomValues ? e.exports = function(e, t) {
  20970. if (e > 4294967295) throw new RangeError("requested too many random bytes");
  20971. var i = n.allocUnsafe(e);
  20972. if (e > 0)
  20973. if (e > 65536)
  20974. for (var s = 0; s < e; s += 65536) a.getRandomValues(i.slice(s, s + 65536));
  20975. else a.getRandomValues(i);
  20976. return "function" == typeof t ? r.nextTick(function() {
  20977. t(null, i)
  20978. }) : i
  20979. } : e.exports = function() {
  20980. throw new Error(
  20981. "Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11"
  20982. )
  20983. }
  20984. }).call(this, i(13), i(9))
  20985. }, function(e, t, i) {
  20986. "use strict";
  20987. var r = {};
  20988. function n(e, t, i) {
  20989. i || (i = Error);
  20990. var n = function(e) {
  20991. var i, r;
  20992. function n(i, r, n) {
  20993. return e.call(this, function(e, i, r) {
  20994. return "string" == typeof t ? t : t(e, i, n)
  20995. }(i, r)) || this
  20996. }
  20997. return r = e, (i = n).prototype = Object.create(r.prototype), i.prototype.constructor = i, i
  20998. .__proto__ = r, n
  20999. }(i);
  21000. n.prototype.name = i.name, n.prototype.code = e, r[e] = n
  21001. }
  21002. function a(e, t) {
  21003. if (Array.isArray(e)) {
  21004. var i = e.length;
  21005. return e = e.map(function(e) {
  21006. return String(e)
  21007. }), i > 2 ? "one of ".concat(t, " ").concat(e.slice(0, i - 1).join(", "), ", or ") + e[i - 1] : 2 ===
  21008. i ? "one of ".concat(t, " ").concat(e[0], " or ").concat(e[1]) : "of ".concat(t, " ").concat(e[0])
  21009. }
  21010. return "of ".concat(t, " ").concat(String(e))
  21011. }
  21012. n("ERR_INVALID_OPT_VALUE", function(e, t) {
  21013. return 'The value "' + t + '" is invalid for option "' + e + '"'
  21014. }, TypeError), n("ERR_INVALID_ARG_TYPE", function(e, t, i) {
  21015. var r, n, s;
  21016. if ("string" == typeof t && (n = "not ", t.substr(0, n.length) === n) ? (r = "must not be", t = t
  21017. .replace(/^not /, "")) : r = "must be", function(e, t, i) {
  21018. return (void 0 === i || i > e.length) && (i = e.length), e.substring(i - t.length, i) === t
  21019. }(e, " argument")) s = "The ".concat(e, " ").concat(r, " ").concat(a(t, "type"));
  21020. else {
  21021. var o = function(e, t, i) {
  21022. return "number" != typeof i && (i = 0), !(i + ".".length > e.length) && -1 !== e.indexOf(".", i)
  21023. }(e) ? "property" : "argument";
  21024. s = 'The "'.concat(e, '" ').concat(o, " ").concat(r, " ").concat(a(t, "type"))
  21025. }
  21026. return s + ". Received type ".concat(typeof i)
  21027. }, TypeError), n("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), n("ERR_METHOD_NOT_IMPLEMENTED",
  21028. function(e) {
  21029. return "The " + e + " method is not implemented"
  21030. }), n("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), n("ERR_STREAM_DESTROYED", function(e) {
  21031. return "Cannot call " + e + " after a stream was destroyed"
  21032. }), n("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), n("ERR_STREAM_CANNOT_PIPE",
  21033. "Cannot pipe, not readable"), n("ERR_STREAM_WRITE_AFTER_END", "write after end"), n(
  21034. "ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), n("ERR_UNKNOWN_ENCODING",
  21035. function(e) {
  21036. return "Unknown encoding: " + e
  21037. }, TypeError), n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), e.exports
  21038. .codes = r
  21039. }, function(e, t, i) {
  21040. "use strict";
  21041. (function(t) {
  21042. var r = Object.keys || function(e) {
  21043. var t = [];
  21044. for (var i in e) t.push(i);
  21045. return t
  21046. };
  21047. e.exports = l;
  21048. var n = i(73),
  21049. a = i(77);
  21050. i(5)(l, n);
  21051. for (var s = r(a.prototype), o = 0; o < s.length; o++) {
  21052. var u = s[o];
  21053. l.prototype[u] || (l.prototype[u] = a.prototype[u])
  21054. }
  21055. function l(e) {
  21056. if (!(this instanceof l)) return new l(e);
  21057. n.call(this, e), a.call(this, e), this.allowHalfOpen = !0, e && (!1 === e.readable && (this
  21058. .readable = !1), !1 === e.writable && (this.writable = !1), !1 === e.allowHalfOpen && (this
  21059. .allowHalfOpen = !1, this.once("end", d)))
  21060. }
  21061. function d() {
  21062. this._writableState.ended || t.nextTick(c, this)
  21063. }
  21064. function c(e) {
  21065. e.end()
  21066. }
  21067. Object.defineProperty(l.prototype, "writableHighWaterMark", {
  21068. enumerable: !1,
  21069. get: function() {
  21070. return this._writableState.highWaterMark
  21071. }
  21072. }), Object.defineProperty(l.prototype, "writableBuffer", {
  21073. enumerable: !1,
  21074. get: function() {
  21075. return this._writableState && this._writableState.getBuffer()
  21076. }
  21077. }), Object.defineProperty(l.prototype, "writableLength", {
  21078. enumerable: !1,
  21079. get: function() {
  21080. return this._writableState.length
  21081. }
  21082. }), Object.defineProperty(l.prototype, "destroyed", {
  21083. enumerable: !1,
  21084. get: function() {
  21085. return void 0 !== this._readableState && void 0 !== this._writableState && this._readableState
  21086. .destroyed && this._writableState.destroyed
  21087. },
  21088. set: function(e) {
  21089. void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState
  21090. .destroyed = e, this._writableState.destroyed = e)
  21091. }
  21092. })
  21093. }).call(this, i(9))
  21094. }, function(e, t, i) {
  21095. var r = i(6).Buffer;
  21096. function n(e, t) {
  21097. this._block = r.alloc(e), this._finalSize = t, this._blockSize = e, this._len = 0
  21098. }
  21099. n.prototype.update = function(e, t) {
  21100. "string" == typeof e && (t = t || "utf8", e = r.from(e, t));
  21101. for (var i = this._block, n = this._blockSize, a = e.length, s = this._len, o = 0; o < a;) {
  21102. for (var u = s % n, l = Math.min(a - o, n - u), d = 0; d < l; d++) i[u + d] = e[o + d];
  21103. o += l, (s += l) % n == 0 && this._update(i)
  21104. }
  21105. return this._len += a, this
  21106. }, n.prototype.digest = function(e) {
  21107. var t = this._len % this._blockSize;
  21108. this._block[t] = 128, this._block.fill(0, t + 1), t >= this._finalSize && (this._update(this._block),
  21109. this._block.fill(0));
  21110. var i = 8 * this._len;
  21111. if (i <= 4294967295) this._block.writeUInt32BE(i, this._blockSize - 4);
  21112. else {
  21113. var r = (4294967295 & i) >>> 0,
  21114. n = (i - r) / 4294967296;
  21115. this._block.writeUInt32BE(n, this._blockSize - 8), this._block.writeUInt32BE(r, this._blockSize - 4)
  21116. }
  21117. this._update(this._block);
  21118. var a = this._hash();
  21119. return e ? a.toString(e) : a
  21120. }, n.prototype._update = function() {
  21121. throw new Error("_update must be implemented by subclass")
  21122. }, e.exports = n
  21123. }, function(e, t, i) {
  21124. "use strict";
  21125. var r = {};
  21126. function n(e, t, i) {
  21127. i || (i = Error);
  21128. var n = function(e) {
  21129. var i, r;
  21130. function n(i, r, n) {
  21131. return e.call(this, function(e, i, r) {
  21132. return "string" == typeof t ? t : t(e, i, n)
  21133. }(i, r)) || this
  21134. }
  21135. return r = e, (i = n).prototype = Object.create(r.prototype), i.prototype.constructor = i, i
  21136. .__proto__ = r, n
  21137. }(i);
  21138. n.prototype.name = i.name, n.prototype.code = e, r[e] = n
  21139. }
  21140. function a(e, t) {
  21141. if (Array.isArray(e)) {
  21142. var i = e.length;
  21143. return e = e.map(function(e) {
  21144. return String(e)
  21145. }), i > 2 ? "one of ".concat(t, " ").concat(e.slice(0, i - 1).join(", "), ", or ") + e[i - 1] : 2 ===
  21146. i ? "one of ".concat(t, " ").concat(e[0], " or ").concat(e[1]) : "of ".concat(t, " ").concat(e[0])
  21147. }
  21148. return "of ".concat(t, " ").concat(String(e))
  21149. }
  21150. n("ERR_INVALID_OPT_VALUE", function(e, t) {
  21151. return 'The value "' + t + '" is invalid for option "' + e + '"'
  21152. }, TypeError), n("ERR_INVALID_ARG_TYPE", function(e, t, i) {
  21153. var r, n, s;
  21154. if ("string" == typeof t && (n = "not ", t.substr(0, n.length) === n) ? (r = "must not be", t = t
  21155. .replace(/^not /, "")) : r = "must be", function(e, t, i) {
  21156. return (void 0 === i || i > e.length) && (i = e.length), e.substring(i - t.length, i) === t
  21157. }(e, " argument")) s = "The ".concat(e, " ").concat(r, " ").concat(a(t, "type"));
  21158. else {
  21159. var o = function(e, t, i) {
  21160. return "number" != typeof i && (i = 0), !(i + ".".length > e.length) && -1 !== e.indexOf(".", i)
  21161. }(e) ? "property" : "argument";
  21162. s = 'The "'.concat(e, '" ').concat(o, " ").concat(r, " ").concat(a(t, "type"))
  21163. }
  21164. return s + ". Received type ".concat(typeof i)
  21165. }, TypeError), n("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), n("ERR_METHOD_NOT_IMPLEMENTED",
  21166. function(e) {
  21167. return "The " + e + " method is not implemented"
  21168. }), n("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), n("ERR_STREAM_DESTROYED", function(e) {
  21169. return "Cannot call " + e + " after a stream was destroyed"
  21170. }), n("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), n("ERR_STREAM_CANNOT_PIPE",
  21171. "Cannot pipe, not readable"), n("ERR_STREAM_WRITE_AFTER_END", "write after end"), n(
  21172. "ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), n("ERR_UNKNOWN_ENCODING",
  21173. function(e) {
  21174. return "Unknown encoding: " + e
  21175. }, TypeError), n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), e.exports
  21176. .codes = r
  21177. }, function(e, t, i) {
  21178. "use strict";
  21179. (function(t) {
  21180. var r = Object.keys || function(e) {
  21181. var t = [];
  21182. for (var i in e) t.push(i);
  21183. return t
  21184. };
  21185. e.exports = l;
  21186. var n = i(102),
  21187. a = i(106);
  21188. i(5)(l, n);
  21189. for (var s = r(a.prototype), o = 0; o < s.length; o++) {
  21190. var u = s[o];
  21191. l.prototype[u] || (l.prototype[u] = a.prototype[u])
  21192. }
  21193. function l(e) {
  21194. if (!(this instanceof l)) return new l(e);
  21195. n.call(this, e), a.call(this, e), this.allowHalfOpen = !0, e && (!1 === e.readable && (this
  21196. .readable = !1), !1 === e.writable && (this.writable = !1), !1 === e.allowHalfOpen && (this
  21197. .allowHalfOpen = !1, this.once("end", d)))
  21198. }
  21199. function d() {
  21200. this._writableState.ended || t.nextTick(c, this)
  21201. }
  21202. function c(e) {
  21203. e.end()
  21204. }
  21205. Object.defineProperty(l.prototype, "writableHighWaterMark", {
  21206. enumerable: !1,
  21207. get: function() {
  21208. return this._writableState.highWaterMark
  21209. }
  21210. }), Object.defineProperty(l.prototype, "writableBuffer", {
  21211. enumerable: !1,
  21212. get: function() {
  21213. return this._writableState && this._writableState.getBuffer()
  21214. }
  21215. }), Object.defineProperty(l.prototype, "writableLength", {
  21216. enumerable: !1,
  21217. get: function() {
  21218. return this._writableState.length
  21219. }
  21220. }), Object.defineProperty(l.prototype, "destroyed", {
  21221. enumerable: !1,
  21222. get: function() {
  21223. return void 0 !== this._readableState && void 0 !== this._writableState && this._readableState
  21224. .destroyed && this._writableState.destroyed
  21225. },
  21226. set: function(e) {
  21227. void 0 !== this._readableState && void 0 !== this._writableState && (this._readableState
  21228. .destroyed = e, this._writableState.destroyed = e)
  21229. }
  21230. })
  21231. }).call(this, i(9))
  21232. }, function(e, t, i) {
  21233. "use strict";
  21234. var r = function() {
  21235. function e() {
  21236. this.listeners = {}
  21237. }
  21238. var t = e.prototype;
  21239. return t.on = function(e, t) {
  21240. this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
  21241. }, t.off = function(e, t) {
  21242. if (!this.listeners[e]) return !1;
  21243. var i = this.listeners[e].indexOf(t);
  21244. return this.listeners[e] = this.listeners[e].slice(0), this.listeners[e].splice(i, 1), i > -1
  21245. }, t.trigger = function(e) {
  21246. var t = this.listeners[e];
  21247. if (t)
  21248. if (2 === arguments.length)
  21249. for (var i = t.length, r = 0; r < i; ++r) t[r].call(this, arguments[1]);
  21250. else
  21251. for (var n = Array.prototype.slice.call(arguments, 1), a = t.length, s = 0; s < a; ++s) t[s]
  21252. .apply(this, n)
  21253. }, t.dispose = function() {
  21254. this.listeners = {}
  21255. }, t.pipe = function(e) {
  21256. this.on("data", function(t) {
  21257. e.push(t)
  21258. })
  21259. }, e
  21260. }();
  21261. e.exports = r
  21262. }, function(e, t, i) {
  21263. "use strict";
  21264. var r = i(5),
  21265. n = i(44),
  21266. a = i(47),
  21267. s = i(48),
  21268. o = i(20);
  21269. function u(e) {
  21270. o.call(this, "digest"), this._hash = e
  21271. }
  21272. r(u, o), u.prototype._update = function(e) {
  21273. this._hash.update(e)
  21274. }, u.prototype._final = function() {
  21275. return this._hash.digest()
  21276. }, e.exports = function(e) {
  21277. return "md5" === (e = e.toLowerCase()) ? new n : "rmd160" === e || "ripemd160" === e ? new a : new u(s(
  21278. e))
  21279. }
  21280. }, function(e, t, i) {
  21281. function r(e) {
  21282. return Object.prototype.toString.call(e)
  21283. }
  21284. t.isArray = function(e) {
  21285. return Array.isArray ? Array.isArray(e) : "[object Array]" === r(e)
  21286. }, t.isBoolean = function(e) {
  21287. return "boolean" == typeof e
  21288. }, t.isNull = function(e) {
  21289. return null === e
  21290. }, t.isNullOrUndefined = function(e) {
  21291. return null == e
  21292. }, t.isNumber = function(e) {
  21293. return "number" == typeof e
  21294. }, t.isString = function(e) {
  21295. return "string" == typeof e
  21296. }, t.isSymbol = function(e) {
  21297. return "symbol" == typeof e
  21298. }, t.isUndefined = function(e) {
  21299. return void 0 === e
  21300. }, t.isRegExp = function(e) {
  21301. return "[object RegExp]" === r(e)
  21302. }, t.isObject = function(e) {
  21303. return "object" == typeof e && null !== e
  21304. }, t.isDate = function(e) {
  21305. return "[object Date]" === r(e)
  21306. }, t.isError = function(e) {
  21307. return "[object Error]" === r(e) || e instanceof Error
  21308. }, t.isFunction = function(e) {
  21309. return "function" == typeof e
  21310. }, t.isPrimitive = function(e) {
  21311. return null === e || "boolean" == typeof e || "number" == typeof e || "string" == typeof e ||
  21312. "symbol" == typeof e || void 0 === e
  21313. }, t.isBuffer = i(10).Buffer.isBuffer
  21314. }, function(e, t, i) {
  21315. (function(t) {
  21316. e.exports = function(e, i) {
  21317. for (var r = Math.min(e.length, i.length), n = new t(r), a = 0; a < r; ++a) n[a] = e[a] ^ i[a];
  21318. return n
  21319. }
  21320. }).call(this, i(10).Buffer)
  21321. }, function(e, t, i) {
  21322. "use strict";
  21323. var r = i(18),
  21324. n = i(14);
  21325. function a() {
  21326. this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, this.outSize =
  21327. this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, this.padLength = this
  21328. .constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, this._delta32 = this
  21329. .blockSize / 32
  21330. }
  21331. t.BlockHash = a, a.prototype.update = function(e, t) {
  21332. if (e = r.toArray(e, t), this.pending ? this.pending = this.pending.concat(e) : this.pending = e, this
  21333. .pendingTotal += e.length, this.pending.length >= this._delta8) {
  21334. var i = (e = this.pending).length % this._delta8;
  21335. this.pending = e.slice(e.length - i, e.length), 0 === this.pending.length && (this.pending = null),
  21336. e = r.join32(e, 0, e.length - i, this.endian);
  21337. for (var n = 0; n < e.length; n += this._delta32) this._update(e, n, n + this._delta32)
  21338. }
  21339. return this
  21340. }, a.prototype.digest = function(e) {
  21341. return this.update(this._pad()), n(null === this.pending), this._digest(e)
  21342. }, a.prototype._pad = function() {
  21343. var e = this.pendingTotal,
  21344. t = this._delta8,
  21345. i = t - (e + this.padLength) % t,
  21346. r = new Array(i + this.padLength);
  21347. r[0] = 128;
  21348. for (var n = 1; n < i; n++) r[n] = 0;
  21349. if (e <<= 3, "big" === this.endian) {
  21350. for (var a = 8; a < this.padLength; a++) r[n++] = 0;
  21351. r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = e >>> 24 & 255, r[n++] = e >>> 16 & 255, r[
  21352. n++] = e >>> 8 & 255, r[n++] = 255 & e
  21353. } else
  21354. for (r[n++] = 255 & e, r[n++] = e >>> 8 & 255, r[n++] = e >>> 16 & 255, r[n++] = e >>> 24 & 255, r[
  21355. n++] = 0, r[n++] = 0, r[n++] = 0, r[n++] = 0, a = 8; a < this.padLength; a++) r[n++] = 0;
  21356. return r
  21357. }
  21358. }, function(e, t, i) {
  21359. "use strict";
  21360. var r = i(5),
  21361. n = i(64).Reporter,
  21362. a = i(62).Buffer;
  21363. function s(e, t) {
  21364. n.call(this, t), a.isBuffer(e) ? (this.base = e, this.offset = 0, this.length = e.length) : this.error(
  21365. "Input not Buffer")
  21366. }
  21367. function o(e, t) {
  21368. if (Array.isArray(e)) this.length = 0, this.value = e.map(function(e) {
  21369. return o.isEncoderBuffer(e) || (e = new o(e, t)), this.length += e.length, e
  21370. }, this);
  21371. else if ("number" == typeof e) {
  21372. if (!(0 <= e && e <= 255)) return t.error("non-byte EncoderBuffer value");
  21373. this.value = e, this.length = 1
  21374. } else if ("string" == typeof e) this.value = e, this.length = a.byteLength(e);
  21375. else {
  21376. if (!a.isBuffer(e)) return t.error("Unsupported type: " + typeof e);
  21377. this.value = e, this.length = e.length
  21378. }
  21379. }
  21380. r(s, n), t.DecoderBuffer = s, s.isDecoderBuffer = function(e) {
  21381. return e instanceof s || "object" == typeof e && a.isBuffer(e.base) && "DecoderBuffer" === e.constructor
  21382. .name && "number" == typeof e.offset && "number" == typeof e.length && "function" == typeof e.save &&
  21383. "function" == typeof e.restore && "function" == typeof e.isEmpty && "function" == typeof e
  21384. .readUInt8 && "function" == typeof e.skip && "function" == typeof e.raw
  21385. }, s.prototype.save = function() {
  21386. return {
  21387. offset: this.offset,
  21388. reporter: n.prototype.save.call(this)
  21389. }
  21390. }, s.prototype.restore = function(e) {
  21391. var t = new s(this.base);
  21392. return t.offset = e.offset, t.length = this.offset, this.offset = e.offset, n.prototype.restore.call(
  21393. this, e.reporter), t
  21394. }, s.prototype.isEmpty = function() {
  21395. return this.offset === this.length
  21396. }, s.prototype.readUInt8 = function(e) {
  21397. return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, !0) : this.error(e ||
  21398. "DecoderBuffer overrun")
  21399. }, s.prototype.skip = function(e, t) {
  21400. if (!(this.offset + e <= this.length)) return this.error(t || "DecoderBuffer overrun");
  21401. var i = new s(this.base);
  21402. return i._reporterState = this._reporterState, i.offset = this.offset, i.length = this.offset + e, this
  21403. .offset += e, i
  21404. }, s.prototype.raw = function(e) {
  21405. return this.base.slice(e ? e.offset : this.offset, this.length)
  21406. }, t.EncoderBuffer = o, o.isEncoderBuffer = function(e) {
  21407. return e instanceof o || "object" == typeof e && "EncoderBuffer" === e.constructor.name && "number" ==
  21408. typeof e.length && "function" == typeof e.join
  21409. }, o.prototype.join = function(e, t) {
  21410. return e || (e = a.alloc(this.length)), t || (t = 0), 0 === this.length || (Array.isArray(this.value) ?
  21411. this.value.forEach(function(i) {
  21412. i.join(e, t), t += i.length
  21413. }) : ("number" == typeof this.value ? e[t] = this.value : "string" == typeof this.value ? e.write(
  21414. this.value, t) : a.isBuffer(this.value) && this.value.copy(e, t), t += this.length)), e
  21415. }
  21416. }, function(e, t, i) {
  21417. "use strict";
  21418. var r = i(8),
  21419. n = i.n(r),
  21420. a = i(0),
  21421. s = i(7),
  21422. o = i(17);
  21423. function u(e, t, i) {
  21424. var r = e;
  21425. if (t + i < r.length) {
  21426. for (; i--;)
  21427. if (128 != (192 & r[++t])) return !1;
  21428. return !0
  21429. }
  21430. return !1
  21431. }
  21432. var l, d = function(e) {
  21433. for (var t = [], i = e, r = 0, n = e.length; r < n;)
  21434. if (i[r] < 128) t.push(String.fromCharCode(i[r])), ++r;
  21435. else {
  21436. if (i[r] < 192);
  21437. else if (i[r] < 224) {
  21438. if (u(i, r, 1)) {
  21439. var a = (31 & i[r]) << 6 | 63 & i[r + 1];
  21440. if (a >= 128) {
  21441. t.push(String.fromCharCode(65535 & a)), r += 2;
  21442. continue
  21443. }
  21444. }
  21445. } else if (i[r] < 240) {
  21446. if (u(i, r, 2)) {
  21447. var s = (15 & i[r]) << 12 | (63 & i[r + 1]) << 6 | 63 & i[r + 2];
  21448. if (s >= 2048 && 55296 != (63488 & s)) {
  21449. t.push(String.fromCharCode(65535 & s)), r += 3;
  21450. continue
  21451. }
  21452. }
  21453. } else if (i[r] < 248 && u(i, r, 3)) {
  21454. var o = (7 & i[r]) << 18 | (63 & i[r + 1]) << 12 | (63 & i[r + 2]) << 6 | 63 & i[r + 3];
  21455. if (o > 65536 && o < 1114112) {
  21456. o -= 65536, t.push(String.fromCharCode(o >>> 10 | 55296)), t.push(String.fromCharCode(1023 & o |
  21457. 56320)), r += 4;
  21458. continue
  21459. }
  21460. }
  21461. t.push(String.fromCharCode(65533)), ++r
  21462. } return t.join("")
  21463. },
  21464. c = i(4),
  21465. h = (l = new ArrayBuffer(2), new DataView(l).setInt16(0, 256, !0), 256 === new Int16Array(l)[0]),
  21466. f = function() {
  21467. function e() {}
  21468. return e.parseScriptData = function(t, i, r) {
  21469. var n = {};
  21470. try {
  21471. var s = e.parseValue(t, i, r),
  21472. o = e.parseValue(t, i + s.size, r - s.size);
  21473. n[s.data] = o.data
  21474. } catch (e) {
  21475. a.a.e("AMF", e.toString())
  21476. }
  21477. return n
  21478. }, e.parseObject = function(t, i, r) {
  21479. if (r < 3) throw new c.a("Data not enough when parse ScriptDataObject");
  21480. var n = e.parseString(t, i, r),
  21481. a = e.parseValue(t, i + n.size, r - n.size),
  21482. s = a.objectEnd;
  21483. return {
  21484. data: {
  21485. name: n.data,
  21486. value: a.data
  21487. },
  21488. size: n.size + a.size,
  21489. objectEnd: s
  21490. }
  21491. }, e.parseVariable = function(t, i, r) {
  21492. return e.parseObject(t, i, r)
  21493. }, e.parseString = function(e, t, i) {
  21494. if (i < 2) throw new c.a("Data not enough when parse String");
  21495. var r = new DataView(e, t, i).getUint16(0, !h);
  21496. return {
  21497. data: r > 0 ? d(new Uint8Array(e, t + 2, r)) : "",
  21498. size: 2 + r
  21499. }
  21500. }, e.parseLongString = function(e, t, i) {
  21501. if (i < 4) throw new c.a("Data not enough when parse LongString");
  21502. var r = new DataView(e, t, i).getUint32(0, !h);
  21503. return {
  21504. data: r > 0 ? d(new Uint8Array(e, t + 4, r)) : "",
  21505. size: 4 + r
  21506. }
  21507. }, e.parseDate = function(e, t, i) {
  21508. if (i < 10) throw new c.a("Data size invalid when parse Date");
  21509. var r = new DataView(e, t, i),
  21510. n = r.getFloat64(0, !h),
  21511. a = r.getInt16(8, !h);
  21512. return {
  21513. data: new Date(n += 60 * a * 1e3),
  21514. size: 10
  21515. }
  21516. }, e.parseValue = function(t, i, r) {
  21517. if (r < 1) throw new c.a("Data not enough when parse Value");
  21518. var n, s = new DataView(t, i, r),
  21519. o = 1,
  21520. u = s.getUint8(0),
  21521. l = !1;
  21522. try {
  21523. switch (u) {
  21524. case 0:
  21525. n = s.getFloat64(1, !h), o += 8;
  21526. break;
  21527. case 1:
  21528. n = !!s.getUint8(1), o += 1;
  21529. break;
  21530. case 2:
  21531. var d = e.parseString(t, i + 1, r - 1);
  21532. n = d.data, o += d.size;
  21533. break;
  21534. case 3:
  21535. n = {};
  21536. var f = 0;
  21537. for (9 == (16777215 & s.getUint32(r - 4, !h)) && (f = 3); o < r - 4;) {
  21538. var p = e.parseObject(t, i + o, r - o - f);
  21539. if (p.objectEnd) break;
  21540. n[p.data.name] = p.data.value, o += p.size
  21541. }
  21542. o <= r - 3 && 9 == (16777215 & s.getUint32(o - 1, !h)) && (o += 3);
  21543. break;
  21544. case 8:
  21545. n = {}, o += 4;
  21546. var m = 0;
  21547. for (9 == (16777215 & s.getUint32(r - 4, !h)) && (m = 3); o < r - 8;) {
  21548. var g = e.parseVariable(t, i + o, r - o - m);
  21549. if (g.objectEnd) break;
  21550. n[g.data.name] = g.data.value, o += g.size
  21551. }
  21552. o <= r - 3 && 9 == (16777215 & s.getUint32(o - 1, !h)) && (o += 3);
  21553. break;
  21554. case 9:
  21555. n = void 0, o = 1, l = !0;
  21556. break;
  21557. case 10:
  21558. n = [];
  21559. var v = s.getUint32(1, !h);
  21560. o += 4;
  21561. for (var y = 0; y < v; y++) {
  21562. var _ = e.parseValue(t, i + o, r - o);
  21563. n.push(_.data), o += _.size
  21564. }
  21565. break;
  21566. case 11:
  21567. var b = e.parseDate(t, i + 1, r - 1);
  21568. n = b.data, o += b.size;
  21569. break;
  21570. case 12:
  21571. var w = e.parseString(t, i + 1, r - 1);
  21572. n = w.data, o += w.size;
  21573. break;
  21574. default:
  21575. o = r, a.a.w("AMF", "Unsupported AMF value type " + u)
  21576. }
  21577. } catch (e) {
  21578. a.a.e("AMF", e.toString())
  21579. }
  21580. return {
  21581. data: n,
  21582. size: o,
  21583. objectEnd: l
  21584. }
  21585. }, e
  21586. }(),
  21587. p = function() {
  21588. function e(e) {
  21589. this.TAG = "ExpGolomb", this._buffer = e, this._buffer_index = 0, this._total_bytes = e.byteLength,
  21590. this._total_bits = 8 * e.byteLength, this._current_word = 0, this._current_word_bits_left = 0
  21591. }
  21592. var t = e.prototype;
  21593. return t.destroy = function() {
  21594. this._buffer = null
  21595. }, t._fillCurrentWord = function() {
  21596. var e = this._total_bytes - this._buffer_index;
  21597. if (e <= 0) throw new c.a("ExpGolomb: _fillCurrentWord() but no bytes available");
  21598. var t = Math.min(4, e),
  21599. i = new Uint8Array(4);
  21600. i.set(this._buffer.subarray(this._buffer_index, this._buffer_index + t)), this._current_word =
  21601. new DataView(i.buffer).getUint32(0, !1), this._buffer_index += t, this._current_word_bits_left =
  21602. 8 * t
  21603. }, t.readBits = function(e) {
  21604. if (e > 32) throw new c.b("ExpGolomb: readBits() bits exceeded max 32bits!");
  21605. if (e <= this._current_word_bits_left) {
  21606. var t = this._current_word >>> 32 - e;
  21607. return this._current_word <<= e, this._current_word_bits_left -= e, t
  21608. }
  21609. var i = this._current_word_bits_left ? this._current_word : 0;
  21610. i >>>= 32 - this._current_word_bits_left;
  21611. var r = e - this._current_word_bits_left;
  21612. this._fillCurrentWord();
  21613. var n = Math.min(r, this._current_word_bits_left),
  21614. a = this._current_word >>> 32 - n;
  21615. return this._current_word <<= n, this._current_word_bits_left -= n, i << n | a
  21616. }, t.readBool = function() {
  21617. return 1 === this.readBits(1)
  21618. }, t.readByte = function() {
  21619. return this.readBits(8)
  21620. }, t._skipLeadingZero = function() {
  21621. var e;
  21622. for (e = 0; e < this._current_word_bits_left; e++)
  21623. if (0 != (this._current_word & 2147483648 >>> e)) return this._current_word <<= e, this
  21624. ._current_word_bits_left -= e, e;
  21625. return this._fillCurrentWord(), e + this._skipLeadingZero()
  21626. }, t.readUEG = function() {
  21627. var e = this._skipLeadingZero();
  21628. return this.readBits(e + 1) - 1
  21629. }, t.readSEG = function() {
  21630. var e = this.readUEG();
  21631. return 1 & e ? e + 1 >>> 1 : -1 * (e >>> 1)
  21632. }, e
  21633. }(),
  21634. m = function() {
  21635. function e() {}
  21636. return e._ebsp2rbsp = function(e) {
  21637. for (var t = e, i = t.byteLength, r = new Uint8Array(i), n = 0, a = 0; a < i; a++) a >= 2 && 3 ===
  21638. t[a] && 0 === t[a - 1] && 0 === t[a - 2] || (r[n] = t[a], n++);
  21639. return new Uint8Array(r.buffer, 0, n)
  21640. }, e.parseSPS = function(t) {
  21641. var i = e._ebsp2rbsp(t),
  21642. r = new p(i);
  21643. r.readByte();
  21644. var n = r.readByte();
  21645. r.readByte();
  21646. var a = r.readByte();
  21647. r.readUEG();
  21648. var s = e.getProfileString(n),
  21649. o = e.getLevelString(a),
  21650. u = 1,
  21651. l = 420,
  21652. d = 8;
  21653. if ((100 === n || 110 === n || 122 === n || 244 === n || 44 === n || 83 === n || 86 === n || 118 ===
  21654. n || 128 === n || 138 === n || 144 === n) && (3 === (u = r.readUEG()) && r.readBits(1), u <=
  21655. 3 && (l = [0, 420, 422, 444][u]), d = r.readUEG() + 8, r.readUEG(), r.readBits(1), r.readBool()
  21656. ))
  21657. for (var c = 3 !== u ? 8 : 12, h = 0; h < c; h++) r.readBool() && (h < 6 ? e._skipScalingList(r,
  21658. 16) : e._skipScalingList(r, 64));
  21659. r.readUEG();
  21660. var f = r.readUEG();
  21661. if (0 === f) r.readUEG();
  21662. else if (1 === f) {
  21663. r.readBits(1), r.readSEG(), r.readSEG();
  21664. for (var m = r.readUEG(), g = 0; g < m; g++) r.readSEG()
  21665. }
  21666. var v = r.readUEG();
  21667. r.readBits(1);
  21668. var y = r.readUEG(),
  21669. _ = r.readUEG(),
  21670. b = r.readBits(1);
  21671. 0 === b && r.readBits(1), r.readBits(1);
  21672. var w = 0,
  21673. E = 0,
  21674. T = 0,
  21675. S = 0;
  21676. r.readBool() && (w = r.readUEG(), E = r.readUEG(), T = r.readUEG(), S = r.readUEG());
  21677. var A = 1,
  21678. k = 1,
  21679. R = 0,
  21680. M = !0,
  21681. O = 0,
  21682. C = 0;
  21683. if (r.readBool()) {
  21684. if (r.readBool()) {
  21685. var D = r.readByte();
  21686. D > 0 && D < 16 ? (A = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2][D - 1],
  21687. k = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1][D - 1]) : 255 === D && (A =
  21688. r.readByte() << 8 | r.readByte(), k = r.readByte() << 8 | r.readByte())
  21689. }
  21690. if (r.readBool() && r.readBool(), r.readBool() && (r.readBits(4), r.readBool() && r.readBits(24)),
  21691. r.readBool() && (r.readUEG(), r.readUEG()), r.readBool()) {
  21692. var I = r.readBits(32),
  21693. L = r.readBits(32);
  21694. M = r.readBool(), R = (O = L) / (C = 2 * I)
  21695. }
  21696. }
  21697. var x = 1;
  21698. 1 === A && 1 === k || (x = A / k);
  21699. var P = 0,
  21700. U = 0;
  21701. 0 === u ? (P = 1, U = 2 - b) : (P = 3 === u ? 1 : 2, U = (1 === u ? 2 : 1) * (2 - b));
  21702. var N = 16 * (y + 1),
  21703. B = 16 * (_ + 1) * (2 - b);
  21704. N -= (w + E) * P, B -= (T + S) * U;
  21705. var F = Math.ceil(N * x);
  21706. return r.destroy(), r = null, {
  21707. avc_profile: n,
  21708. profile_string: s,
  21709. avc_level: a,
  21710. level_string: o,
  21711. bit_depth: d,
  21712. ref_frames: v,
  21713. chroma_format: l,
  21714. chroma_format_string: e.getChromaFormatString(l),
  21715. frame_rate: {
  21716. fixed: M,
  21717. fps: R,
  21718. fps_den: C,
  21719. fps_num: O
  21720. },
  21721. sar_ratio: {
  21722. width: A,
  21723. height: k
  21724. },
  21725. codec_size: {
  21726. width: N,
  21727. height: B
  21728. },
  21729. present_size: {
  21730. width: F,
  21731. height: B
  21732. }
  21733. }
  21734. }, e._skipScalingList = function(e, t) {
  21735. for (var i = 8, r = 8, n = 0; n < t; n++) 0 !== r && (r = (i + e.readSEG() + 256) % 256), i = 0 ===
  21736. r ? i : r
  21737. }, e.getProfileString = function(e) {
  21738. switch (e) {
  21739. case 66:
  21740. return "Baseline";
  21741. case 77:
  21742. return "Main";
  21743. case 88:
  21744. return "Extended";
  21745. case 100:
  21746. return "High";
  21747. case 110:
  21748. return "High10";
  21749. case 122:
  21750. return "High422";
  21751. case 244:
  21752. return "High444";
  21753. default:
  21754. return "Unknown"
  21755. }
  21756. }, e.getLevelString = function(e) {
  21757. return (e / 10).toFixed(1)
  21758. }, e.getChromaFormatString = function(e) {
  21759. switch (e) {
  21760. case 420:
  21761. return "4:2:0";
  21762. case 422:
  21763. return "4:2:2";
  21764. case 444:
  21765. return "4:4:4";
  21766. default:
  21767. return "Unknown"
  21768. }
  21769. }, e
  21770. }(),
  21771. g = i(1),
  21772. v = i(12);
  21773. function y(e, t) {
  21774. for (var i = 0; i < t.length; i++) {
  21775. var r = t[i];
  21776. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  21777. .defineProperty(e, r.key, r)
  21778. }
  21779. }
  21780. var _ = function() {
  21781. function e(e, t) {
  21782. this.TAG = "FLVDemuxer", this._config = t, this._onError = null, this._onMediaInfo = null, this
  21783. ._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this
  21784. ._onDataAvailable = null, this._dataOffset = e.dataOffset, this._firstParse = !0, this._dispatch = !
  21785. 1, this._hasAudio = e.hasAudioTrack, this._hasVideo = e.hasVideoTrack, this
  21786. ._hasAudioFlagOverrided = !1, this._hasVideoFlagOverrided = !1, this
  21787. ._audioInitialMetadataDispatched = !1, this._videoInitialMetadataDispatched = !1, this._mediaInfo =
  21788. new o.a, this._mediaInfo.hasAudio = this._hasAudio, this._mediaInfo.hasVideo = this._hasVideo, this
  21789. ._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this._naluLengthSize = 4,
  21790. this._timestampBase = 0, this._timescale = 1e3, this._duration = 0, this._durationOverrided = !1,
  21791. this._referenceFrameRate = {
  21792. fixed: !0,
  21793. fps: 23.976,
  21794. fps_num: 23976,
  21795. fps_den: 1e3
  21796. }, this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3], this._mpegSamplingRates = [96e3,
  21797. 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350
  21798. ], this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0], this._mpegAudioV20SampleRateTable = [
  21799. 22050, 24e3, 16e3, 0
  21800. ], this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0], this._mpegAudioL1BitRateTable = [0,
  21801. 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1
  21802. ], this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,
  21803. 384, -1
  21804. ], this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256,
  21805. 320, -1
  21806. ], this._videoTrack = {
  21807. type: "video",
  21808. id: 1,
  21809. sequenceNumber: 0,
  21810. samples: [],
  21811. length: 0
  21812. }, this._audioTrack = {
  21813. type: "audio",
  21814. id: 2,
  21815. sequenceNumber: 0,
  21816. samples: [],
  21817. length: 0
  21818. }, this._littleEndian = function() {
  21819. var e = new ArrayBuffer(2);
  21820. return new DataView(e).setInt16(0, 256, !0), 256 === new Int16Array(e)[0]
  21821. }(), this._onReceiveH265MediaFLVFrame = null, this._onAudioError = null, this._videoCodecId = 0,
  21822. this._audioCodecId = 0, this._AVC_SPS = null, this._AVC_PPS = null, this._HEVC_VPS = null, this
  21823. ._HEVC_SPS = null, this._HEVC_PPS = null, this._StartCode = [0, 0, 0, 1], this._SampleRate = 8e3,
  21824. this._ChannelNum = 1, this._AudioMaxFrameSize = 0, this._DebugBuf = null, this._DebugBufPos = 0,
  21825. this._lastAudioPts = 0, this._lastVideoPts = 0, this._index = 0, this._allowAudio = !1, this
  21826. .sei_data = null
  21827. }
  21828. var t, i, r = e.prototype;
  21829. return r.destroy = function() {
  21830. this._mediaInfo = null, this._metadata = null, this._audioMetadata = null, this._videoMetadata =
  21831. null, this._videoTrack = null, this._audioTrack = null, this._onError = null, this._onMediaInfo =
  21832. null, this._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata =
  21833. null, this._onDataAvailable = null, this._onAudioError = null, this._onReceiveSEIData = null, this
  21834. ._onReceiveH265MediaFLVFrame = null
  21835. }, e.probe = function(e) {
  21836. var t = new Uint8Array(e),
  21837. i = {
  21838. match: !1
  21839. };
  21840. if (70 !== t[0] || 76 !== t[1] || 86 !== t[2] || 1 !== t[3]) return i;
  21841. var r, n = (4 & t[4]) >>> 2 != 0,
  21842. a = 0 != (1 & t[4]),
  21843. s = (r = t)[5] << 24 | r[6] << 16 | r[7] << 8 | r[8];
  21844. return s < 9 ? i : {
  21845. match: !0,
  21846. consumed: s,
  21847. dataOffset: s,
  21848. hasAudioTrack: n,
  21849. hasVideoTrack: a
  21850. }
  21851. }, r.bindDataSource = function(e) {
  21852. return e.onDataArrival = this.parseChunks.bind(this), this
  21853. }, r.resetMediaInfo = function() {
  21854. this._mediaInfo = new o.a
  21855. }, r._isInitialMetadataDispatched = function() {
  21856. return this._hasAudio && this._hasVideo ? this._audioInitialMetadataDispatched && this
  21857. ._videoInitialMetadataDispatched : this._hasAudio && !this._hasVideo ? this
  21858. ._audioInitialMetadataDispatched : !(this._hasAudio || !this._hasVideo) && this
  21859. ._videoInitialMetadataDispatched
  21860. }, r.parseChunks = function(t, i) {
  21861. if (!(this._onError && this._onMediaInfo && this._onTrackMetadata && this._onDataAvailable))
  21862. throw new c.a(
  21863. "Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
  21864. var r = 0,
  21865. n = this._littleEndian;
  21866. if (0 === i) {
  21867. if (!(t.byteLength > 13)) return 0;
  21868. r = e.probe(t).dataOffset
  21869. }
  21870. for (this._firstParse && (this._firstParse = !1, i + r !== this._dataOffset && a.a.w(this.TAG,
  21871. "First time parsing but chunk byteStart invalid!"), 0 !== new DataView(t, r).getUint32(0, !
  21872. n) && a.a.w(this.TAG, "PrevTagSize0 !== 0 !!!"), r += 4); r < t.byteLength;) {
  21873. this._dispatch = !0;
  21874. var s = new DataView(t, r);
  21875. if (r + 11 + 4 > t.byteLength) break;
  21876. var o = s.getUint8(0),
  21877. u = 16777215 & s.getUint32(0, !n);
  21878. if (r + 11 + u + 4 > t.byteLength) break;
  21879. if (8 === o || 9 === o || 18 === o) {
  21880. var l = s.getUint8(4),
  21881. d = s.getUint8(5),
  21882. h = s.getUint8(6) | d << 8 | l << 16 | s.getUint8(7) << 24;
  21883. 0 != (16777215 & s.getUint32(7, !n)) && a.a.w(this.TAG, "Meet tag which has StreamID != 0!");
  21884. var f = r + 11;
  21885. switch (o) {
  21886. case 8:
  21887. h - this._lastAudioPts <= 0 && (this._index > 1 && (this._hasAudioFlagOverrided = !0, this
  21888. ._mediaInfo.hasAudio = !1, this._hasAudio = !1, this._onAudioError()), this._index++),
  21889. this._lastAudioPts = h, this._audioCodecId = this._parseAudioData(t, f, u, h);
  21890. break;
  21891. case 9:
  21892. this._lastVideoPts = h, this._parseVideoData(t, f, u, h, i + r);
  21893. break;
  21894. case 18:
  21895. this._parseScriptData(t, f, u)
  21896. }
  21897. var p = s.getUint32(11 + u, !n);
  21898. p !== 11 + u && a.a.w(this.TAG, "Invalid PrevTagSize " + p), r += 11 + u + 4
  21899. } else a.a.w(this.TAG, "Unsupported tag type " + o + ", skipped"), r += 11 + u + 4
  21900. }
  21901. return this._isInitialMetadataDispatched() && this._dispatch && (this._audioTrack.samples.length ||
  21902. this._videoTrack.samples.length) && (7 === this._videoCodecId || 0 === this._videoCodecId ?
  21903. "auto" === this._config.decodeType ? this._onDataAvailable(this._audioTrack, this._videoTrack) :
  21904. (this._videoTrack.samples.length > 0 && this._onDataAvailableToSoftwareDecodeVideo(27, this
  21905. ._videoTrack), this._audioTrack.samples.length > 0 && this
  21906. ._onDataAvailableToSoftwareDecodeAudio(10 === this._audioCodecId ? 86018 : 0, this
  21907. ._audioTrack)) : 12 === this._videoCodecId && (this._videoTrack.samples.length > 0 && this
  21908. ._onDataAvailableToSoftwareDecodeVideo(173, this._videoTrack), this._audioTrack.samples
  21909. .length > 0 && this._onDataAvailableToSoftwareDecodeAudio(10 === this._audioCodecId ? 86018 :
  21910. 0, this._audioTrack))), r
  21911. }, r._parseScriptData = function(e, t, i) {
  21912. new DataView(e, t, i);
  21913. var r = f.parseScriptData(e, t, i);
  21914. if (r.hasOwnProperty("onMetaData")) {
  21915. if (null == r.onMetaData || "object" != typeof r.onMetaData) return void a.a.w(this.TAG,
  21916. "Invalid onMetaData structure!");
  21917. this._metadata && a.a.w(this.TAG, "Found another onMetaData tag!"), this._metadata = r;
  21918. var n = this._metadata.onMetaData;
  21919. if (this._onMetaDataArrived && this._onMetaDataArrived(Object.assign({}, n)), "boolean" ==
  21920. typeof n.hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = n.hasAudio, this
  21921. ._mediaInfo.hasAudio = this._hasAudio), "boolean" == typeof n.hasVideo && !1 === this
  21922. ._hasVideoFlagOverrided && (this._hasVideo = n.hasVideo, this._mediaInfo.hasVideo = this
  21923. ._hasVideo), "number" == typeof n.audiodatarate && (this._mediaInfo.audioDataRate = n
  21924. .audiodatarate), "number" == typeof n.videodatarate && (this._mediaInfo.videoDataRate = n
  21925. .videodatarate), "number" == typeof n.width && (this._mediaInfo.width = n.width), "number" ==
  21926. typeof n.height && (this._mediaInfo.height = n.height), "number" == typeof n.duration) {
  21927. if (!this._durationOverrided) {
  21928. var s = Math.floor(n.duration * this._timescale);
  21929. this._duration = s, this._mediaInfo.duration = s
  21930. }
  21931. } else this._mediaInfo.duration = 0;
  21932. if ("number" == typeof n.framerate) {
  21933. var o = Math.floor(1e3 * n.framerate);
  21934. if (o > 0) {
  21935. var u = o / 1e3;
  21936. this._referenceFrameRate.fixed = !0, this._referenceFrameRate.fps = u, this
  21937. ._referenceFrameRate.fps_num = o, this._referenceFrameRate.fps_den = 1e3, this._mediaInfo
  21938. .fps = u
  21939. }
  21940. }
  21941. if ("object" == typeof n.keyframes) {
  21942. this._mediaInfo.hasKeyframesIndex = !0;
  21943. var l = n.keyframes;
  21944. this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(l), n.keyframes = null
  21945. } else this._mediaInfo.hasKeyframesIndex = !1;
  21946. this._dispatch = !1, this._mediaInfo.metadata = n, a.a.v(this.TAG, "Parsed onMetaData"), this
  21947. ._mediaInfo.isComplete() && this._onMediaInfo(this._mediaInfo)
  21948. }
  21949. Object.keys(r).length > 0 && this._onScriptDataArrived && this._onScriptDataArrived(Object
  21950. .assign({}, r))
  21951. }, r._parseKeyframesIndex = function(e) {
  21952. for (var t = [], i = [], r = 1; r < e.times.length; r++) {
  21953. var n = this._timestampBase + Math.floor(1e3 * e.times[r]);
  21954. t.push(n), i.push(e.filepositions[r])
  21955. }
  21956. return {
  21957. times: t,
  21958. filepositions: i
  21959. }
  21960. }, r._parseAudioData = function(e, t, i, r) {
  21961. if (i <= 1) return a.a.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!"), 0;
  21962. if (!0 === this._hasAudioFlagOverrided && !1 === this._hasAudio) return 0;
  21963. this._littleEndian;
  21964. var n = new DataView(e, t, i).getUint8(0),
  21965. s = n >>> 4;
  21966. if (2 !== s && 10 !== s) return this._onError(v.a.CODEC_UNSUPPORTED,
  21967. "Flv: Unsupported audio codec idx: " + s), 0;
  21968. var o, u = (12 & n) >>> 2;
  21969. if (!(u >= 0 && u <= 4)) return this._onError(v.a.FORMAT_ERROR,
  21970. "Flv: Invalid audio sample rate idx: " + u), 0;
  21971. o = this._flvSoundRateTable[u];
  21972. var l = 1 & n,
  21973. d = this._audioMetadata,
  21974. c = this._audioTrack;
  21975. if (d || (!1 === this._hasAudio && !1 === this._hasAudioFlagOverrided && (this._hasAudio = !0, this
  21976. ._mediaInfo.hasAudio = !0), (d = this._audioMetadata = {}).type = "audio", d.id = c.id, d
  21977. .timescale = this._timescale, d.duration = this._duration, d.audioSampleRate = o, d
  21978. .channelCount = 0 === l ? 1 : 2), 10 === s) {
  21979. var h = this._parseAACAudioData(e, t + 1, i - 1);
  21980. if (null == h) return 0;
  21981. if (0 === h.packetType) {
  21982. d.config && a.a.w(this.TAG, "Found another AudioSpecificConfig!");
  21983. var f = h.data;
  21984. d.audioSampleRate = f.samplingRate, d.channelCount = f.channelCount, d.codec = f.codec, d
  21985. .originalCodec = f.originalCodec, d.config = f.config, d.refSampleDuration = 1024 / d
  21986. .audioSampleRate * d.timescale, a.a.v(this.TAG, "Parsed AudioSpecificConfig"), this
  21987. ._SampleRate = f.samplingRate, this._ChannelNum = f.channelCount, this
  21988. ._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.samples.length || this
  21989. ._videoTrack.samples.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) :
  21990. this._audioInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata("audio",
  21991. d);
  21992. var p = this._mediaInfo;
  21993. p.audioCodec = d.originalCodec, p.audioSampleRate = d.audioSampleRate, p.audioChannelCount = d
  21994. .channelCount, p.hasVideo ? null != p.videoCodec && (p.mimeType = 'video/x-flv; codecs="' + p
  21995. .videoCodec + "," + p.audioCodec + '"') : p.mimeType = 'video/x-flv; codecs="' + p
  21996. .audioCodec + '"', p.isComplete() && this._onMediaInfo(p)
  21997. } else if (1 === h.packetType) {
  21998. var m = this._timestampBase + r,
  21999. g = {
  22000. unit: h.data,
  22001. length: h.data.byteLength,
  22002. dts: m,
  22003. pts: m
  22004. };
  22005. c.samples.push(g), c.length += h.data.length, h.data.length > this._AudioMaxFrameSize && (this
  22006. ._AudioMaxFrameSize = h.data.length)
  22007. } else a.a.e(this.TAG, "Flv: Unsupported AAC data type " + h.packetType)
  22008. } else if (2 === s) {
  22009. if (!d.codec) {
  22010. var y = this._parseMP3AudioData(e, t + 1, i - 1, !0);
  22011. if (null == y) return 0;
  22012. d.audioSampleRate = y.samplingRate, d.channelCount = y.channelCount, d.codec = y.codec, d
  22013. .originalCodec = y.originalCodec, d.refSampleDuration = 1152 / d.audioSampleRate * d
  22014. .timescale, a.a.v(this.TAG, "Parsed MPEG Audio Frame Header"), this
  22015. ._audioInitialMetadataDispatched = !0, this._onTrackMetadata("audio", d);
  22016. var _ = this._mediaInfo;
  22017. _.audioCodec = d.codec, _.audioSampleRate = d.audioSampleRate, _.audioChannelCount = d
  22018. .channelCount, _.audioDataRate = y.bitRate, _.hasVideo ? null != _.videoCodec && (_.mimeType =
  22019. 'video/x-flv; codecs="' + _.videoCodec + "," + _.audioCodec + '"') : _.mimeType =
  22020. 'video/x-flv; codecs="' + _.audioCodec + '"', _.isComplete() && this._onMediaInfo(_)
  22021. }
  22022. var b = this._parseMP3AudioData(e, t + 1, i - 1, !1);
  22023. if (null == b) return 0;
  22024. var w = this._timestampBase + r,
  22025. E = {
  22026. unit: b,
  22027. length: b.byteLength,
  22028. dts: w,
  22029. pts: w
  22030. };
  22031. c.samples.push(E), c.length += b.length
  22032. }
  22033. return s
  22034. }, r._parseAACAudioData = function(e, t, i) {
  22035. if (!(i <= 1)) {
  22036. var r = {},
  22037. n = new Uint8Array(e, t, i);
  22038. return r.packetType = n[0], 0 === n[0] ? r.data = this._parseAACAudioSpecificConfig(e, t + 1, i -
  22039. 1) : r.data = n.subarray(1), r
  22040. }
  22041. a.a.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!")
  22042. }, r._parseAACAudioSpecificConfig = function(e, t, i) {
  22043. var r, n, a = new Uint8Array(e, t, i),
  22044. s = null,
  22045. o = 0,
  22046. u = null;
  22047. if (o = r = a[0] >>> 3, (n = (7 & a[0]) << 1 | a[1] >>> 7) < 0 || n >= this._mpegSamplingRates
  22048. .length) this._onError(v.a.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!");
  22049. else {
  22050. var l = this._mpegSamplingRates[n],
  22051. d = (120 & a[1]) >>> 3;
  22052. if (!(d < 0 || d >= 8)) {
  22053. 5 === o && (u = (7 & a[1]) << 1 | a[2] >>> 7, a[2]);
  22054. var c = self.navigator.userAgent.toLowerCase();
  22055. return -1 !== c.indexOf("firefox") ? n >= 6 ? (o = 5, s = new Array(4), u = n - 3) : (o = 2, s =
  22056. new Array(2), u = n) : -1 !== c.indexOf("android") ? (o = 2, s = new Array(2), u = n) : (o =
  22057. 5, u = n, s = new Array(4), n >= 6 ? u = n - 3 : 1 === d && (o = 2, s = new Array(2), u = n)
  22058. ), s[0] = o << 3, s[0] |= (15 & n) >>> 1, s[1] = (15 & n) << 7, s[1] |= (15 & d) << 3, 5 ===
  22059. o && (s[1] |= (15 & u) >>> 1, s[2] = (1 & u) << 7, s[2] |= 8, s[3] = 0), {
  22060. config: s,
  22061. samplingRate: l,
  22062. channelCount: d,
  22063. codec: "mp4a.40." + o,
  22064. originalCodec: "mp4a.40." + r
  22065. }
  22066. }
  22067. this._onError(v.a.FORMAT_ERROR, "Flv: AAC invalid channel configuration")
  22068. }
  22069. }, r._parseMP3AudioData = function(e, t, i, r) {
  22070. if (!(i < 4)) {
  22071. this._littleEndian;
  22072. var n = new Uint8Array(e, t, i),
  22073. s = null;
  22074. if (r) {
  22075. if (255 !== n[0]) return;
  22076. var o = n[1] >>> 3 & 3,
  22077. u = (6 & n[1]) >> 1,
  22078. l = (240 & n[2]) >>> 4,
  22079. d = (12 & n[2]) >>> 2,
  22080. c = 3 != (n[3] >>> 6 & 3) ? 2 : 1,
  22081. h = 0,
  22082. f = 0;
  22083. switch (o) {
  22084. case 0:
  22085. h = this._mpegAudioV25SampleRateTable[d];
  22086. break;
  22087. case 2:
  22088. h = this._mpegAudioV20SampleRateTable[d];
  22089. break;
  22090. case 3:
  22091. h = this._mpegAudioV10SampleRateTable[d]
  22092. }
  22093. switch (u) {
  22094. case 1:
  22095. l < this._mpegAudioL3BitRateTable.length && (f = this._mpegAudioL3BitRateTable[l]);
  22096. break;
  22097. case 2:
  22098. l < this._mpegAudioL2BitRateTable.length && (f = this._mpegAudioL2BitRateTable[l]);
  22099. break;
  22100. case 3:
  22101. l < this._mpegAudioL1BitRateTable.length && (f = this._mpegAudioL1BitRateTable[l])
  22102. }
  22103. s = {
  22104. bitRate: f,
  22105. samplingRate: h,
  22106. channelCount: c,
  22107. codec: "mp3",
  22108. originalCodec: "mp3"
  22109. }
  22110. } else s = n;
  22111. return s
  22112. }
  22113. a.a.w(this.TAG, "Flv: Invalid MP3 packet, header missing!")
  22114. }, r._parseVideoData = function(e, t, i, r, n) {
  22115. if (i <= 1) a.a.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!");
  22116. else if (!0 !== this._hasVideoFlagOverrided || !1 !== this._hasVideo) {
  22117. var s = new Uint8Array(e, t, i)[0],
  22118. o = (240 & s) >>> 4;
  22119. this._videoCodecId = 15 & s, 7 === this._videoCodecId || 12 === this._videoCodecId ? (g.h(7 ===
  22120. this._videoCodecId ? "H264" : "H265"), this._parseAVCAndHEVCVideoPacket(e, t + 1, i - 1, r,
  22121. n, o)) : this._onError(v.a.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " +
  22122. codecId)
  22123. }
  22124. }, r._parseAVCAndHEVCVideoPacket = function(e, t, i, r, n, s) {
  22125. if (i < 4) a.a.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");
  22126. else {
  22127. var o = this._littleEndian,
  22128. u = new DataView(e, t, i),
  22129. l = u.getUint8(0),
  22130. d = (16777215 & u.getUint32(0, !o)) << 8 >> 8;
  22131. if (0 === l) 7 === this._videoCodecId ? this._parseAVCDecoderConfigurationRecord(e, t + 4, i -
  22132. 4) : this._parseHEVCDecoderConfigurationRecord(e, t + 4, i - 4);
  22133. else if (1 === l) 7 === this._videoCodecId ? this._parseAVCVideoData(e, t + 4, i - 4, r, n, s,
  22134. d) : this._parseHEVCVideoData(e, t + 4, i - 4, r, n, s, d);
  22135. else if (2 !== l) return void this._onError(v.a.FORMAT_ERROR, "Flv: Invalid video packet type " +
  22136. l)
  22137. }
  22138. }, r._parseAVCDecoderConfigurationRecord = function(e, t, i) {
  22139. if (i < 7) a.a.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
  22140. else {
  22141. var r = this._videoMetadata,
  22142. n = this._videoTrack,
  22143. s = this._littleEndian,
  22144. o = new DataView(e, t, i);
  22145. if (r) void 0 !== r.avcc && a.a.w(this.TAG, "Found another AVCDecoderConfigurationRecord!");
  22146. else {
  22147. !1 === this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this
  22148. ._mediaInfo.hasVideo = !0), (r = this._videoMetadata = {}).type = "video", r.id = n.id, r
  22149. .timescale = this._timescale, r.duration = this._duration;
  22150. var u = o.getUint8(0),
  22151. l = o.getUint8(1);
  22152. if (o.getUint8(2), o.getUint8(3), 1 === u && 0 !== l)
  22153. if (this._naluLengthSize = 1 + (3 & o.getUint8(4)), 3 === this._naluLengthSize || 4 === this
  22154. ._naluLengthSize) {
  22155. var d = 31 & o.getUint8(5);
  22156. if (0 !== d) {
  22157. d > 1 && a.a.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + d);
  22158. for (var c = 6, h = 0; h < d; h++) {
  22159. var f = o.getUint16(c, !s);
  22160. if (c += 2, 0 !== f) {
  22161. var p = new Uint8Array(e, t + c, f);
  22162. this._AVC_SPS = new Uint8Array(f + 4), c += f, this._AVC_SPS.set(this._StartCode, 0),
  22163. this._AVC_SPS.set(p, 4);
  22164. var g = m.parseSPS(p);
  22165. if (0 === h) {
  22166. r.codecWidth = g.codec_size.width, r.codecHeight = g.codec_size.height, r
  22167. .presentWidth = g.present_size.width, r.presentHeight = g.present_size.height, r
  22168. .profile = g.profile_string, r.level = g.level_string, r.bitDepth = g.bit_depth, r
  22169. .chromaFormat = g.chroma_format, r.sarRatio = g.sar_ratio, r.frameRate = g
  22170. .frame_rate, !1 !== g.frame_rate.fixed && 0 !== g.frame_rate.fps_num && 0 !== g
  22171. .frame_rate.fps_den || (r.frameRate = this._referenceFrameRate);
  22172. var y = r.frameRate.fps_den,
  22173. _ = r.frameRate.fps_num;
  22174. r.refSampleDuration = r.timescale * (y / _);
  22175. for (var b = p.subarray(1, 4), w = "avc1.", E = 0; E < 3; E++) {
  22176. var T = b[E].toString(16);
  22177. T.length < 2 && (T = "0" + T), w += T
  22178. }
  22179. r.codec = w;
  22180. var S = this._mediaInfo;
  22181. S.width = r.codecWidth, S.height = r.codecHeight, S.fps = r.frameRate.fps, S
  22182. .profile = r.profile, S.level = r.level, S.refFrames = g.ref_frames, S
  22183. .chromaFormat = g.chroma_format_string, S.sarNum = r.sarRatio.width, S.sarDen = r
  22184. .sarRatio.height, S.videoCodec = w, S.hasAudio ? null != S.audioCodec && (S
  22185. .mimeType = 'video/x-flv; codecs="' + S.videoCodec + "," + S.audioCodec + '"') :
  22186. S.mimeType = 'video/x-flv; codecs="' + S.videoCodec + '"', S.isComplete() && this
  22187. ._onMediaInfo(S)
  22188. }
  22189. }
  22190. }
  22191. var A = o.getUint8(c);
  22192. if (0 !== A) {
  22193. A > 1 && a.a.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " +
  22194. A), c++;
  22195. for (var k = 0; k < A; k++) {
  22196. var R = o.getUint16(c, !s);
  22197. if (c += 2, 0 !== R) {
  22198. var M = new Uint8Array(e, t + c, R);
  22199. this._AVC_PPS = new Uint8Array(R + 4), this._AVC_PPS.set(this._StartCode, 0), this
  22200. ._AVC_PPS.set(M, 4), c += R
  22201. }
  22202. }
  22203. r.avcc = new Uint8Array(i), r.avcc.set(new Uint8Array(e, t, i), 0), a.a.v(this.TAG,
  22204. "Parsed AVCDecoderConfigurationRecord"), this._isInitialMetadataDispatched() ? this
  22205. ._dispatch && (this._audioTrack.length || this._videoTrack.length) && this
  22206. ._onDataAvailable(this._audioTrack, this._videoTrack) : this
  22207. ._videoInitialMetadataDispatched = !0, this._dispatch = !1, this._onTrackMetadata(
  22208. "video", r), a.a.i(this.TAG, "Video resolution: " + r.codecWidth + " x " + r
  22209. .codecHeight)
  22210. } else this._onError(v.a.FORMAT_ERROR,
  22211. "Flv: Invalid AVCDecoderConfigurationRecord: No PPS")
  22212. } else this._onError(v.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS")
  22213. } else this._onError(v.a.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this
  22214. ._naluLengthSize - 1));
  22215. else this._onError(v.a.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord")
  22216. }
  22217. }
  22218. }, r._parseHEVCDecoderConfigurationRecord = function(e, t, i) {
  22219. if (i < 7) a.a.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
  22220. else {
  22221. var r = this._videoMetadata,
  22222. n = this._videoTrack,
  22223. s = this._littleEndian,
  22224. o = new DataView(e, t, i);
  22225. r ? void 0 !== r.avcc && a.a.w(this.TAG, "Found another AVCDecoderConfigurationRecord!") : (!1 ===
  22226. this._hasVideo && !1 === this._hasVideoFlagOverrided && (this._hasVideo = !0, this._mediaInfo
  22227. .hasVideo = !0), (r = this._videoMetadata = {}).type = "video", r.id = n.id, r.timescale =
  22228. this._timescale, r.duration = this._duration);
  22229. var u = o.getUint8(0),
  22230. l = o.getUint8(1),
  22231. d = o.getUint8(2),
  22232. c = o.getUint8(3);
  22233. if (0 === u && 0 === l && 0 === d && 1 === c);
  22234. else {
  22235. var h = 22,
  22236. f = o.getUint8(h);
  22237. h += 1;
  22238. for (var p = 0; p < f; p++) {
  22239. var m = o.getUint8(h);
  22240. h += 1, o.getUint16(h, !s), h += 2;
  22241. var g = o.getUint16(h, !s);
  22242. if (h += 2, 32 === m || 160 == m) {
  22243. var v = new Uint8Array(e, t + h, g);
  22244. this._HEVC_VPS = new Uint8Array(g + 4), this._HEVC_VPS.set(this._StartCode, 0), this
  22245. ._HEVC_VPS.set(v, 4)
  22246. } else if (33 === m || 161 == m) {
  22247. var y = new Uint8Array(e, t + h, g);
  22248. this._HEVC_SPS = new Uint8Array(g + 4), this._HEVC_SPS.set(this._StartCode, 0), this
  22249. ._HEVC_SPS.set(y, 4)
  22250. } else if (34 === m || 162 == m) {
  22251. var _ = new Uint8Array(e, t + h, g);
  22252. this._HEVC_PPS = new Uint8Array(g + 4), this._HEVC_PPS.set(this._StartCode, 0), this
  22253. ._HEVC_PPS.set(_, 4)
  22254. }
  22255. h += g
  22256. }
  22257. }
  22258. this._isInitialMetadataDispatched() ? this._dispatch && (this._audioTrack.length || this
  22259. ._videoTrack.length) && this._onDataAvailable(this._audioTrack, this._videoTrack) : this
  22260. ._videoInitialMetadataDispatched = !0, this._dispatch = !1
  22261. }
  22262. }, r._parseAVCVideoData = function(e, t, i, r, n, s, o) {
  22263. var u = 0,
  22264. l = this._littleEndian,
  22265. d = new DataView(e, t, i),
  22266. c = [],
  22267. h = 0,
  22268. f = 0,
  22269. p = this._naluLengthSize,
  22270. m = this._timestampBase + r,
  22271. g = 1 === s,
  22272. v = !0;
  22273. for (7 == this._videoCodecId && ("auto" !== this._config.decodeType && "hard" !== this._config
  22274. .decodeType || (v = !1)); f < i;) {
  22275. if (f + 4 >= i) {
  22276. a.a.w(this.TAG, "Malformed Nalu near timestamp " + m + ", offset = " + f + ", dataSize = " + i);
  22277. break
  22278. }
  22279. var y = d.getUint32(f, !l);
  22280. if (3 === p && (y >>>= 8), y > i - p) return void a.a.w(this.TAG,
  22281. "Malformed Nalus near timestamp " + m + ", NaluSize > DataSize!");
  22282. if (5 == (u = 31 & d.getUint8(f + p)) && (g = !0, c.length < 1 && this._AVC_SPS && this._AVC_SPS
  22283. .length > 0))
  22284. if (v) {
  22285. var _ = {
  22286. type: 7,
  22287. data: this._AVC_SPS
  22288. };
  22289. c.push(_), h += _.data.length;
  22290. var b = {
  22291. type: 8,
  22292. data: this._AVC_PPS
  22293. };
  22294. c.push(b), h += b.data.length
  22295. } else {
  22296. var w = this._AVC_SPS.subarray(0, this._AVC_SPS.length),
  22297. E = w.length - 4;
  22298. w[0] = E >> 24, w[1] = E >> 16, w[2] = E >> 8, w[3] = 255 & E;
  22299. var T = {
  22300. type: 7,
  22301. data: w
  22302. };
  22303. c.push(T), h += T.data.length;
  22304. var S = this._AVC_PPS.subarray(0, this._AVC_PPS.length),
  22305. A = S.length - 4;
  22306. S[0] = A >> 24, S[1] = A >> 16, S[2] = A >> 8, S[3] = 255 & A;
  22307. var k = {
  22308. type: 8,
  22309. data: S
  22310. };
  22311. c.push(k), h += k.data.length
  22312. } if (6 === u && c.length < 1) {
  22313. var R = d.getUint8(f + p + 1);
  22314. if (d.getUint8(f + p + 4), 100 === R) {
  22315. for (var M = 0, O = 0, C = 0; C < 10; C++) {
  22316. var D = 255 & d.getUint8(f + p + 1 + 1 + O);
  22317. if (O++, M += D, 255 !== D) break
  22318. }
  22319. var I = void 0,
  22320. L = null;
  22321. return (M > 16 || M >= 3) && (I = new Uint8Array(e, t + f + p + 1 + O + 1, M - 1), L =
  22322. new TextDecoder("utf-8").decode(I)), this.sei_data = L
  22323. }
  22324. return this.sei_data = null
  22325. }
  22326. var x = new Uint8Array(e, t + f, p + y),
  22327. P = {
  22328. type: u,
  22329. data: x
  22330. };
  22331. c.push(P), h += x.byteLength, f += p + y
  22332. }
  22333. if (6 === u && "soft" !== this._config.decodeType) return console.log("{unitType:" + u +
  22334. ",decodeType:" + this._config.decodeType);
  22335. if (c.length) {
  22336. var U = this._videoTrack,
  22337. N = {
  22338. units: c,
  22339. length: h,
  22340. isKeyframe: g,
  22341. dts: m,
  22342. cts: o,
  22343. pts: m + o,
  22344. sei: this.sei_data
  22345. };
  22346. g && (N.fileposition = n), U.samples.push(N), U.length += h, this.sei_data = null
  22347. }
  22348. }, r._makeH265Header = function(e) {
  22349. var t = 2;
  22350. switch (e) {
  22351. case 78:
  22352. case 80:
  22353. t = 1;
  22354. break;
  22355. case 64:
  22356. case 66:
  22357. case 32:
  22358. case 34:
  22359. case 36:
  22360. case 38:
  22361. case 40:
  22362. case 42:
  22363. t = 1
  22364. }
  22365. return t
  22366. }, r._parseHEVCVideoData = function(e, t, i, r, n, s, o) {
  22367. var u = this._littleEndian,
  22368. l = new DataView(e, t, i),
  22369. d = this._timestampBase + r,
  22370. c = 1 === s,
  22371. h = [],
  22372. f = 0;
  22373. for (this._naluLengthSize; f < i;) {
  22374. if (f + 4 >= i) {
  22375. a.a.w(this.TAG, "Malformed Nalu near timestamp " + d + ", offset = " + f + ", dataSize = " + i);
  22376. break
  22377. }
  22378. var p = l.getUint8(f),
  22379. m = l.getUint8(f + 1),
  22380. g = l.getUint8(f + 2),
  22381. v = l.getUint8(f + 3);
  22382. if (0 === p && 0 === m && 0 === g && 1 === v);
  22383. else {
  22384. var y = l.getUint32(f, !u);
  22385. f += 4;
  22386. var _ = l.getUint8(f);
  22387. if (f += 1, y > i - 4) return void a.a.w(this.TAG, "Malformed Nalus near timestamp " + d +
  22388. ", NaluSize > DataSize!");
  22389. if (y + f - 1 > i) break;
  22390. var b = l.getUint8(f - 1),
  22391. w = this._makeH265Header(b);
  22392. if ((32 === b || 34 === b || 36 === b || 38 === b || 40 === b || 42 === b) && h.length < 1) {
  22393. if (this._HEVC_VPS) {
  22394. var E = {
  22395. type: 5,
  22396. data: this._HEVC_VPS
  22397. };
  22398. h.push(E), this._HEVC_VPS.length
  22399. }
  22400. if (this._HEVC_SPS) {
  22401. var T = {
  22402. type: 6,
  22403. data: this._HEVC_SPS
  22404. };
  22405. h.push(T), this._HEVC_SPS.length
  22406. }
  22407. if (this._HEVC_PPS) {
  22408. var S = {
  22409. type: 7,
  22410. data: this._HEVC_PPS
  22411. };
  22412. h.push(S), this._HEVC_PPS.length
  22413. }
  22414. }
  22415. if (1 === w && this._HEVC_VPS && this._HEVC_VPS[0], 78 != _ && t + f - 1 - 4 >= 0 && y > 0) {
  22416. var A = new Uint8Array(e, t + f - 1 - 4, y + 4);
  22417. A[0] = 0, A[1] = 0, A[2] = 0, A[3] = 1;
  22418. var k = {
  22419. type: 5,
  22420. data: A
  22421. };
  22422. h.push(k), A.length
  22423. }
  22424. f += y - 1
  22425. }
  22426. }
  22427. if (h.length) {
  22428. var R = this._videoTrack,
  22429. M = {
  22430. units: h,
  22431. length: 0,
  22432. isKeyframe: c,
  22433. dts: d,
  22434. cts: o,
  22435. pts: d + o
  22436. };
  22437. c && (M.fileposition = n), R.samples.push(M), R.length += 0
  22438. }
  22439. }, r._onDataAvailableToSoftwareDecodeVideo = function(e, t) {
  22440. var i = t.samples,
  22441. r = -1;
  22442. for (i.length > 1 && (r = 0); i.length;) {
  22443. for (var n = i.shift(), a = 0, s = 0; s < n.units.length; s++) a += n.units[s].data.length;
  22444. for (var o = 0, u = new Uint8Array(a); n.units.length;) {
  22445. var l = n.units.shift();
  22446. 27 === e && (l.data[0] = 0, l.data[1] = 0, l.data[2] = 0, l.data[3] = 1), u.set(l.data, o), o +=
  22447. l.data.length
  22448. }
  22449. this._onReceiveH265MediaFLVFrame && (r >= 0 && r++, this._onReceiveH265MediaFLVFrame("video", !0,
  22450. 1, e, n.isKeyframe, u, a, n.pts, 0, 0, 0, n.sei))
  22451. }
  22452. }, r._onDataAvailableToSoftwareDecodeAudio = function(e, t) {
  22453. var i = t.samples,
  22454. r = -1;
  22455. for (i.length > 1 && (r = 0); i.length;) {
  22456. var n = i.shift();
  22457. this._onReceiveH265MediaFLVFrame && (r >= 0 && r++, this._onReceiveH265MediaFLVFrame("audio", !0,
  22458. 2, e, 0, n.unit, n.length, n.pts, this._SampleRate, this._ChannelNum, this._SampleRate >=
  22459. 44100 ? 32 : 16))
  22460. }
  22461. }, t = e, (i = [{
  22462. key: "onTrackMetadata",
  22463. get: function() {
  22464. return this._onTrackMetadata
  22465. },
  22466. set: function(e) {
  22467. this._onTrackMetadata = e
  22468. }
  22469. }, {
  22470. key: "onMediaInfo",
  22471. get: function() {
  22472. return this._onMediaInfo
  22473. },
  22474. set: function(e) {
  22475. this._onMediaInfo = e
  22476. }
  22477. }, {
  22478. key: "onMetaDataArrived",
  22479. get: function() {
  22480. return this._onMetaDataArrived
  22481. },
  22482. set: function(e) {
  22483. this._onMetaDataArrived = e
  22484. }
  22485. }, {
  22486. key: "onReceiveH265MediaFLVFrame",
  22487. get: function() {
  22488. return this._onReceiveH265MediaFLVFrame
  22489. },
  22490. set: function(e) {
  22491. this._onReceiveH265MediaFLVFrame = e
  22492. }
  22493. }, {
  22494. key: "onAudioError",
  22495. get: function() {
  22496. return this._onAudioError
  22497. },
  22498. set: function(e) {
  22499. this._onAudioError = e
  22500. }
  22501. }, {
  22502. key: "onReceiveSEIData",
  22503. get: function() {
  22504. return this._onReceiveSEIData
  22505. },
  22506. set: function(e) {
  22507. this._onReceiveSEIData = e
  22508. }
  22509. }, {
  22510. key: "onScriptDataArrived",
  22511. get: function() {
  22512. return this._onScriptDataArrived
  22513. },
  22514. set: function(e) {
  22515. this._onScriptDataArrived = e
  22516. }
  22517. }, {
  22518. key: "onError",
  22519. get: function() {
  22520. return this._onError
  22521. },
  22522. set: function(e) {
  22523. this._onError = e
  22524. }
  22525. }, {
  22526. key: "onDataAvailable",
  22527. get: function() {
  22528. return this._onDataAvailable
  22529. },
  22530. set: function(e) {
  22531. this._onDataAvailable = e
  22532. }
  22533. }, {
  22534. key: "timestampBase",
  22535. get: function() {
  22536. return this._timestampBase
  22537. },
  22538. set: function(e) {
  22539. this._timestampBase = e
  22540. }
  22541. }, {
  22542. key: "overridedDuration",
  22543. get: function() {
  22544. return this._duration
  22545. },
  22546. set: function(e) {
  22547. this._durationOverrided = !0, this._duration = e, this._mediaInfo.duration = e
  22548. }
  22549. }, {
  22550. key: "overridedHasAudio",
  22551. set: function(e) {
  22552. this._hasAudioFlagOverrided = !0, this._hasAudio = e, this._mediaInfo.hasAudio = e
  22553. }
  22554. }, {
  22555. key: "overridedHasVideo",
  22556. set: function(e) {
  22557. this._hasVideoFlagOverrided = !0, this._hasVideo = e, this._mediaInfo.hasVideo = e
  22558. }
  22559. }]) && y(t.prototype, i), Object.defineProperty(t, "prototype", {
  22560. writable: !1
  22561. }), e
  22562. }();
  22563. function b(e, t) {
  22564. return !!(t + 1 < e.length && function(e, t) {
  22565. return 255 === e[t] && 240 == (246 & e[t + 1])
  22566. }(e, t))
  22567. }
  22568. function w(e, t, i) {
  22569. return function(e, t, i) {
  22570. var r, n, a, s, o, u = navigator.userAgent.toLowerCase(),
  22571. l = i,
  22572. d = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  22573. if (r = 1 + ((192 & e[t + 2]) >>> 6), !((n = (60 & e[t + 2]) >>> 2) > d.length - 1)) return s = (1 &
  22574. e[t + 2]) << 2, s |= (192 & e[t + 3]) >>> 6, /firefox/i.test(u) ? n >= 6 ? (r = 5, o =
  22575. new Array(4), a = n - 3) : (r = 2, o = new Array(2), a = n) : -1 !== u.indexOf("android") ? (r =
  22576. 2, o = new Array(2), a = n) : (r = 5, o = new Array(4), i && (-1 !== i.indexOf("mp4a.40.29") ||
  22577. -1 !== i.indexOf("mp4a.40.5")) || !i && n >= 6 ? a = n - 3 : ((i && -1 !== i.indexOf(
  22578. "mp4a.40.2") && (n >= 6 && 1 === s || /vivaldi/i.test(u)) || !i && 1 === s) && (r = 2, o =
  22579. new Array(2)), a = n)), o[0] = r << 3, o[0] |= (14 & n) >> 1, o[1] |= (1 & n) << 7, o[1] |= s <<
  22580. 3, 5 === r && (o[1] |= (14 & a) >> 1, o[2] = (1 & a) << 7, o[2] |= 8, o[3] = 0), {
  22581. config: o,
  22582. samplerate: d[n],
  22583. channelCount: s,
  22584. codec: "mp4a.40." + r,
  22585. manifestCodec: l
  22586. };
  22587. console.log("ADTS parse fail. reason: 'invalid ADTS sampling index:${adtsSampleingIndex}'")
  22588. }(e, t, i)
  22589. }
  22590. function E(e) {
  22591. return 9216e4 / e
  22592. }
  22593. function T(e, t, i, r, n) {
  22594. var a = function(e, t, i, r, n) {
  22595. var a, s, o = e.length;
  22596. if (a = function(e, t) {
  22597. return 1 & e[t + 1] ? 7 : 9
  22598. }(e, t), s = function(e, t) {
  22599. return (3 & e[t + 3]) << 11 | e[t + 4] << 3 | (224 & e[t + 5]) >>> 5
  22600. }(e, t), (s -= a) > 0 && t + a + s <= o) return {
  22601. headerLength: a,
  22602. frameLength: s,
  22603. stamp: i + r * n
  22604. }
  22605. }(t, i, r, n, E(e));
  22606. if (a) {
  22607. var s = a.stamp,
  22608. o = a.headerLength,
  22609. u = a.frameLength;
  22610. return {
  22611. sample: {
  22612. unit: t.subarray(i + o, i + o + u),
  22613. pts: s,
  22614. dts: s
  22615. },
  22616. length: u + o
  22617. }
  22618. }
  22619. }
  22620. var S = function() {
  22621. function e(e) {
  22622. this.data = e, this.bytesAvailable = e.byteLength, this.word = 0, this.bitsAvailable = 0
  22623. }
  22624. var t = e.prototype;
  22625. return t.loadWord = function() {
  22626. var e = this.data,
  22627. t = this.bytesAvailable,
  22628. i = e.byteLength - t,
  22629. r = new Uint8Array(4),
  22630. n = Math.min(4, t);
  22631. if (0 === n) throw new Error("no bytes available");
  22632. r.set(e.subarray(i, i + n)), this.word = new DataView(r.buffer).getUint32(0), this.bitsAvailable =
  22633. 8 * n, this.bytesAvailable -= n
  22634. }, t.skipBits = function(e) {
  22635. var t;
  22636. this.bitsAvailable > e ? (this.word <<= e, this.bitsAvailable -= e) : (e -= this.bitsAvailable, e -=
  22637. (t = e >> 3) >> 3, this.bytesAvailable -= t, this.loadWord(), this.word <<= e, this
  22638. .bitsAvailable -= e)
  22639. }, t.readBits = function(e) {
  22640. var t = Math.min(this.bitsAvailable, e),
  22641. i = this.word >>> 32 - t;
  22642. return e > 32 && logger.error("Cannot read more than 32 bits at a time"), this.bitsAvailable -= t,
  22643. this.bitsAvailable > 0 ? this.word <<= t : this.bytesAvailable > 0 && this.loadWord(), (t = e -
  22644. t) > 0 && this.bitsAvailable ? i << t | this.readBits(t) : i
  22645. }, t.skipLZ = function() {
  22646. var e;
  22647. for (e = 0; e < this.bitsAvailable; ++e)
  22648. if (0 != (this.word & 2147483648 >>> e)) return this.word <<= e, this.bitsAvailable -= e, e;
  22649. return this.loadWord(), e + this.skipLZ()
  22650. }, t.skipUEG = function() {
  22651. this.skipBits(1 + this.skipLZ())
  22652. }, t.skipEG = function() {
  22653. this.skipBits(1 + this.skipLZ())
  22654. }, t.readUEG = function() {
  22655. var e = this.skipLZ();
  22656. return this.readBits(e + 1) - 1
  22657. }, t.readEG = function() {
  22658. var e = this.readUEG();
  22659. return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
  22660. }, t.readBoolean = function() {
  22661. return 1 === this.readBits(1)
  22662. }, t.readUByte = function() {
  22663. return this.readBits(8)
  22664. }, t.readUShort = function() {
  22665. return this.readBits(16)
  22666. }, t.readUInt = function() {
  22667. return this.readBits(32)
  22668. }, t.skipScalingList = function(e) {
  22669. var t, i = 8,
  22670. r = 8;
  22671. for (t = 0; t < e; t++) 0 !== r && (r = (i + this.readEG() + 256) % 256), i = 0 === r ? i : r
  22672. }, t.readSPS = function() {
  22673. var e, t, i, r, n, a, s, o = 0,
  22674. u = 0,
  22675. l = 0,
  22676. d = 0,
  22677. c = this.readUByte.bind(this),
  22678. h = this.readBits.bind(this),
  22679. f = this.readUEG.bind(this),
  22680. p = this.readBoolean.bind(this),
  22681. m = this.skipBits.bind(this),
  22682. g = this.skipEG.bind(this),
  22683. v = this.skipUEG.bind(this),
  22684. y = this.skipScalingList.bind(this);
  22685. if (c(), e = c(), h(5), m(3), c(), v(), 100 === e || 110 === e || 122 === e || 244 === e || 44 ===
  22686. e || 83 === e || 86 === e || 118 === e || 128 === e) {
  22687. var _ = f();
  22688. if (3 === _ && m(1), v(), v(), m(1), p())
  22689. for (a = 3 !== _ ? 8 : 12, s = 0; s < a; s++) p() && y(s < 6 ? 16 : 64)
  22690. }
  22691. v();
  22692. var b = f();
  22693. if (0 === b) f();
  22694. else if (1 === b)
  22695. for (m(1), g(), g(), t = f(), s = 0; s < t; s++) g();
  22696. v(), m(1), i = f(), r = f(), 0 === (n = h(1)) && m(1), m(1), p() && (o = f(), u = f(), l = f(), d =
  22697. f());
  22698. var w = [1, 1];
  22699. if (p() && p()) switch (c()) {
  22700. case 1:
  22701. w = [1, 1];
  22702. break;
  22703. case 2:
  22704. w = [12, 11];
  22705. break;
  22706. case 3:
  22707. w = [10, 11];
  22708. break;
  22709. case 4:
  22710. w = [16, 11];
  22711. break;
  22712. case 5:
  22713. w = [40, 33];
  22714. break;
  22715. case 6:
  22716. w = [24, 11];
  22717. break;
  22718. case 7:
  22719. w = [20, 11];
  22720. break;
  22721. case 8:
  22722. w = [32, 11];
  22723. break;
  22724. case 9:
  22725. w = [80, 33];
  22726. break;
  22727. case 10:
  22728. w = [18, 11];
  22729. break;
  22730. case 11:
  22731. w = [15, 11];
  22732. break;
  22733. case 12:
  22734. w = [64, 33];
  22735. break;
  22736. case 13:
  22737. w = [160, 99];
  22738. break;
  22739. case 14:
  22740. w = [4, 3];
  22741. break;
  22742. case 15:
  22743. w = [3, 2];
  22744. break;
  22745. case 16:
  22746. w = [2, 1];
  22747. break;
  22748. case 255:
  22749. w = [c() << 8 | c(), c() << 8 | c()]
  22750. }
  22751. return {
  22752. width: Math.ceil(16 * (i + 1) - 2 * o - 2 * u),
  22753. height: (2 - n) * (r + 1) * 16 - (n ? 2 : 4) * (l + d),
  22754. pixelRatio: w
  22755. }
  22756. }, t.readSliceType = function() {
  22757. return this.readUByte(), this.readUEG(), this.readUEG()
  22758. }, e
  22759. }();
  22760. function A(e, t) {
  22761. for (var i = 0; i < t.length; i++) {
  22762. var r = t[i];
  22763. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  22764. .defineProperty(e, r.key, r)
  22765. }
  22766. }
  22767. var k = function() {
  22768. function e(e, t, i) {
  22769. this.TAG = "M3U8Demuxer", this._config = e, this._onError = null, this._onMediaInfo = null, this
  22770. ._onMetaDataArrived = null, this._onScriptDataArrived = null, this._onTrackMetadata = null, this
  22771. ._onDataAvailable = null, this._hasAudio = !1, this._hasVideo = !1, this._hasAudioFlagOverrided = !
  22772. 1, this._hasVideoFlagOverrided = !1, this._initVideoMetadata = !1, this._initAudioMetadata = !1,
  22773. this._mediaInfo = new o.a, this._mediaInfo.hasAudio = !1, this._mediaInfo.hasVideo = !1, this
  22774. ._metadata = null, this._audioMetadata = null, this._videoMetadata = null, this.tagPosition = 0,
  22775. this.filePosition = 0, this.isHEVC = 0, this.isAAC = 0, this.avcTrackPid = -1, this
  22776. .audioTrackPid = -1, this.id3TrackPid = -1, this.audioSampleRate = 0, this.audioChannel = 2, this
  22777. .audioBitPerSample = 16, this.avcTrackPesData = null, this.audioTrackPesData = null, this
  22778. .id3TrackPesData = null, this.findKeyframe = !0, this.syncVideoPts = 0, this.syncAudioPts = 0, this
  22779. .startVideoPts = 0, this.startAudioPts = 0, this.accurateTimeOffset = 0, this.lastVideoPts = 0, this
  22780. .currentVideoPts = 0, this.seekVideoHistoryPts = 0, this.currentAudioPts = 0, this.audioFrameNum =
  22781. 0, this.reset = 0, this._videoTrack = {
  22782. type: "video",
  22783. id: 1,
  22784. sequenceNumber: 0,
  22785. samples: [],
  22786. length: 0
  22787. }, this._audioTrack = {
  22788. type: "audio",
  22789. id: 2,
  22790. sequenceNumber: 0,
  22791. samples: [],
  22792. length: 0
  22793. }, this._timestampBase = 0, this._timescale = 1e3, this._duration = 0, this._durationOverrided = !1,
  22794. this._AVC_SPS = null, this._AVC_PPS = null, this._HEVC_VPS = null, this._HEVC_SPS = null, this
  22795. ._HEVC_PPS = null, this._StartCode = [0, 0, 0, 1], this._AVC_Config = null, this
  22796. ._callbackInitFlag = !1, this._callbackMediaDataFunc = t, this._callbackMediaDataUserPtr = i, this
  22797. ._onReceiveH265MediaHLSFrame = null
  22798. }
  22799. var t, i, r = e.prototype;
  22800. return r.bindDataSource = function(e) {
  22801. return e.onDataArrival = this.append.bind(this), this
  22802. }, r.resetMediaInfo = function() {
  22803. this._mediaInfo = new o.a
  22804. }, r.resetMediaPts = function(e) {
  22805. this.reset = e, this.syncVideoPts = 0, this.syncAudioPts = 0, this.findKeyframe = !0, this
  22806. ._videoTrack.samples = [], this._audioTrack.samples = []
  22807. }, r._onDataAvailableToSoftwareDecodeVideo = function(e, t) {
  22808. var i = t.samples;
  22809. if (e < 1 && i.length > 0) console.log("EXCEPTION:: No used...");
  22810. else {
  22811. var r = -1;
  22812. for (i.length > 1 && (r = 0); i.length;) {
  22813. for (var n = i.shift(), a = 0, s = 0; s < n.units.length; s++) a += n.units[s].data.length;
  22814. for (var o = 0, u = new Uint8Array(a); n.units.length;) {
  22815. var l = n.units.shift();
  22816. 27 == e && (l.data[0] = 0, l.data[1] = 0, l.data[2] = 0, l.data[3] = 1), u.set(l.data, o),
  22817. o += l.data.length
  22818. }
  22819. this._onReceiveH265MediaHLSFrame && (r >= 0 && r++, this._onReceiveH265MediaHLSFrame("video", !
  22820. 0, 1, e, n.isKeyframe, u, a, n.pts, 0, 0, 0))
  22821. }
  22822. }
  22823. }, r._onDataAvailableToSoftwareDecodeAudio = function(e, t) {
  22824. var i = t.samples,
  22825. r = -1;
  22826. for (i.length > 1 && (r = 0); i.length;) {
  22827. var n = i.shift();
  22828. this._onReceiveH265MediaHLSFrame && (r >= 0 && r++, this._onReceiveH265MediaHLSFrame("audio", !0,
  22829. 2, e, 0, n.unit, n.length, n.pts, this._SampleRate, this._ChannelNum, this._SampleRate >=
  22830. 44100 ? 32 : 16))
  22831. }
  22832. }, e.createTrack = function(e, t) {
  22833. return {
  22834. container: "video" === e || "audio" === e ? "video/mp2t" : void 0,
  22835. type: e,
  22836. id: RemuxerTrackIdConfig[e],
  22837. pid: -1,
  22838. inputTimeScale: 9e4,
  22839. sequenceNumber: 0,
  22840. samples: [],
  22841. dropped: "video" === e ? 0 : void 0,
  22842. isAAC: "audio" === e || void 0,
  22843. duration: "audio" === e ? t : void 0,
  22844. isHEVC: 0
  22845. }
  22846. }, e._syncOffset = function(e) {
  22847. for (var t = Math.min(1e3, e.length - 564), i = 0; i < t;) {
  22848. if (71 === e[i] && 71 === e[i + 188] && 71 === e[i + 376]) return i;
  22849. i++
  22850. }
  22851. return -1
  22852. }, r.destroy = function() {
  22853. this._initPTS = this._initDTS = void 0, this._duration = 0, this._onReceiveH265MediaHLSFrame = null
  22854. }, r.parsePAT = function(e, t) {
  22855. return (31 & e[t + 10]) << 8 | e[t + 11]
  22856. }, r.parsePMT = function(e, t, i, r) {
  22857. var n, a, s = {
  22858. audio: -1,
  22859. avc: -1,
  22860. hevc: -1,
  22861. id3: -1,
  22862. isAAC: !0
  22863. };
  22864. for (n = t + 3 + ((15 & e[t + 1]) << 8 | e[t + 2]) - 4, t += 12 + ((15 & e[t + 10]) << 8 | e[t +
  22865. 11]); t < n;) {
  22866. switch (a = (31 & e[t + 1]) << 8 | e[t + 2], e[t]) {
  22867. case 207:
  22868. if (!r) break;
  22869. case 15:
  22870. -1 === s.audio && (s.audio = a);
  22871. break;
  22872. case 21:
  22873. -1 === s.id3 && (s.id3 = a);
  22874. break;
  22875. case 219:
  22876. if (!r) {
  22877. logger.log("unknown stream type:" + e[t]);
  22878. break
  22879. }
  22880. case 27:
  22881. -1 === s.avc && (s.avc = a), g.h("H264");
  22882. break;
  22883. case 36:
  22884. -1 === s.avc && (s.avc = a, s.hevc = a), g.h("H265");
  22885. break;
  22886. case 3:
  22887. case 4:
  22888. i ? -1 === s.audio && (s.audio = a, s.isAAC = !1) : logger.log(
  22889. "MPEG audio found, not supported in this browser for now");
  22890. break;
  22891. case 36:
  22892. console.warn("HEVC stream type found, not supported for now")
  22893. }
  22894. t += 5 + ((15 & e[t + 3]) << 8 | e[t + 4])
  22895. }
  22896. return s
  22897. }, r.parsePES = function(e) {
  22898. if (1 !== this.reset) {
  22899. var t, i, r, n, a, s, o, u, l = 0,
  22900. d = e.data;
  22901. if (!e || 0 === e.size) return null;
  22902. for (; d[0].length < 19 && d.length > 1;) {
  22903. var c = new Uint8Array(d[0].length + d[1].length);
  22904. c.set(d[0]), c.set(d[1], d[0].length), d[0] = c, d.splice(1, 1)
  22905. }
  22906. if (1 === ((t = d[0])[0] << 16) + (t[1] << 8) + t[2]) {
  22907. if ((r = (t[4] << 8) + t[5]) && r > e.size - 6) return null;
  22908. if (192 & (i = t[7]) && ((s = 536870912 * (14 & t[9]) + 4194304 * (255 & t[10]) + 16384 * (254 &
  22909. t[11]) + 128 * (255 & t[12]) + (254 & t[13]) / 2) > 4294967295 && (s -= 4294967295), 64 &
  22910. i ? ((o = 536870912 * (14 & t[14]) + 4194304 * (255 & t[15]) + 16384 * (254 & t[16]) + 128 *
  22911. (255 & t[17]) + (254 & t[18]) / 2) > 4294967295 && (o -= 4294967295), s - o > 54e5 && (
  22912. console.warn(Math.round((s - o) / 9e4) + "s delta between PTS and DTS, align them"), s =
  22913. o)) : o = s), u = (n = t[8]) + 9, e.size <= u) return null;
  22914. e.size -= u, a = new Uint8Array(e.size);
  22915. for (var h = 0, f = d.length; h < f; h++) {
  22916. var p = (t = d[h]).byteLength;
  22917. if (u) {
  22918. if (u > p) {
  22919. u -= p;
  22920. continue
  22921. }
  22922. t = t.subarray(u), p -= u, u = 0
  22923. }
  22924. a.set(t, l), l += p
  22925. }
  22926. return r && (r -= n + 3), {
  22927. data: a,
  22928. pts: s,
  22929. dts: o,
  22930. len: r
  22931. }
  22932. }
  22933. return null
  22934. }
  22935. }, r.pushAccesUnit = function(e, t) {
  22936. if (e.units.length && e.frame) {
  22937. var i = t.samples,
  22938. r = i.length;
  22939. if (isNaN(e.pts)) {
  22940. if (!r) return void t.dropped++;
  22941. var n = i[r - 1];
  22942. e.pts = n.pts, e.dts = n.dts
  22943. }!this.config.forceKeyFrameOnDiscontinuity || !0 === e.key || t.sps && (r || this.contiguous) ? (e
  22944. .id = r, i.push(e)) : t.dropped++
  22945. }
  22946. e.debug.length && logger.log(e.pts + "/" + e.dts + ":" + e.debug)
  22947. }, r.parseAVCPES = function(e, t, i) {
  22948. var r = this,
  22949. n = 0;
  22950. (0 === this.startVideoPts || e.pts < this.startVideoPts) && (this.startVideoPts = e.pts, n = 1),
  22951. this.audioFrameNum = 0;
  22952. var s = this._parseAVCNALu(e.data),
  22953. o = [],
  22954. u = 0;
  22955. e.data = null;
  22956. var l = !1;
  22957. s.forEach(function(t) {
  22958. var i = t.data.length,
  22959. n = new Uint8Array(4 + i);
  22960. n[0] = i >> 24 & 255, n[1] = i >> 16 & 255, n[2] = i >> 8 & 255, n[3] = 255 & i, n.set(t.data,
  22961. 4);
  22962. var s = {
  22963. type: t.type,
  22964. data: n
  22965. };
  22966. switch (u += n.length, o.push(s), t.type) {
  22967. case 1:
  22968. break;
  22969. case 5:
  22970. r.findKeyframe = !1, l = !0;
  22971. break;
  22972. case 6:
  22973. var d = new S(r.discardEPB(t.data));
  22974. d.readUByte();
  22975. for (var c = 0, h = 0, f = !1, p = 0; !f && d.bytesAvailable > 1;) {
  22976. c = 0;
  22977. do {
  22978. c += p = d.readUByte()
  22979. } while (255 === p);
  22980. h = 0;
  22981. do {
  22982. h += p = d.readUByte()
  22983. } while (255 === p);
  22984. if (4 === c && 0 !== d.bytesAvailable) {
  22985. if (f = !0, 181 === d.readUByte() && 49 === d.readUShort() && 1195456820 === d
  22986. .readUInt() && 3 === d.readUByte()) {
  22987. for (var g = d.readUByte(), v = 31 & g, y = [g, d.readUByte()], _ = 0; _ < v; _++) y
  22988. .push(d.readUByte()), y.push(d.readUByte()), y.push(d.readUByte());
  22989. r._insertSampleInOrder(r._txtTrack.samples, {
  22990. type: 3,
  22991. pts: e.pts,
  22992. bytes: y
  22993. })
  22994. }
  22995. } else if (5 === c && 0 !== d.bytesAvailable) {
  22996. if (f = !0, h > 16) {
  22997. for (var b = [], w = 0; w < 16; w++) b.push(d.readUByte().toString(16)), 3 !== w &&
  22998. 5 !== w && 7 !== w && 9 !== w || b.push("-");
  22999. for (var E = h - 16, T = new Uint8Array(E), A = 0; A < E; A++) T[A] = d.readUByte()
  23000. }
  23001. } else if (h < d.bytesAvailable)
  23002. for (var k = 0; k < h; k++) d.readUByte()
  23003. }
  23004. break;
  23005. case 7:
  23006. r.findKeyframe = !1, r.tagPosition = r.filePosition, r._AVC_Config = m.parseSPS(t.data);
  23007. var R = r._AVC_Config,
  23008. M = "avc1.";
  23009. if (R)
  23010. for (var O = t.data.subarray(1, 4), C = 0; C < 3; C++) {
  23011. var D = O[C].toString(16);
  23012. D.length < 2 && (D = "0" + D), M += D
  23013. }
  23014. if (!r._initVideoMetadata) {
  23015. null == r._AVC_SPS && (r._AVC_SPS = new Uint8Array(t.data.length + 4), r._AVC_SPS.set(r
  23016. ._StartCode, 0), r._AVC_SPS.set(t.data, 4));
  23017. var I = r._videoMetadata,
  23018. L = r._videoTrack;
  23019. if (I ? void 0 !== I.avcc && a.a.w(r.TAG,
  23020. "Found another AVCDecoderConfigurationRecord!") : (!1 === r._hasVideo && !1 === r
  23021. ._hasVideoFlagOverrided && (r._hasVideo = !0, r._mediaInfo.hasVideo = !0), (I = r
  23022. ._videoMetadata = {}).type = "video", I.id = L.id, I.timescale = r._timescale, I
  23023. .duration = r._duration), I.codecWidth = R.codec_size.width, I.codecHeight = R
  23024. .codec_size.height, I.presentWidth = R.present_size.width, I.presentHeight = R
  23025. .present_size.height, I.profile = R.profile_string, I.level = R.level_string, I
  23026. .bitDepth = R.bit_depth, I.chromaFormat = R.chroma_format, I.sarRatio = R.sar_ratio, I
  23027. .frameRate = R.frame_rate, !1 !== R.frame_rate.fixed && 0 !== R.frame_rate.fps_num &&
  23028. 0 !== R.frame_rate.fps_den || (I.frameRate = r._referenceFrameRate), void 0 !== I
  23029. .frameRate) {
  23030. var x = I.frameRate.fps_den,
  23031. P = I.frameRate.fps_num;
  23032. I.refSampleDuration = I.timescale * (x / P)
  23033. }
  23034. I.codec = M;
  23035. var U = r._mediaInfo;
  23036. U.width = I.codecWidth, U.height = I.codecHeight, void 0 !== I.frameRate && (U.fps = I
  23037. .frameRate.fps), U.profile = I.profile, U.level = I.level, U.refFrames = R
  23038. .ref_frames, U.chromaFormat = R.chroma_format_string, U.sarNum = I.sarRatio.width, U
  23039. .sarDen = I.sarRatio.height, U.videoCodec = M, U.hasAudio ? null != U.audioCodec && (U
  23040. .mimeType = 'video/x-flv; codecs="' + U.videoCodec + "," + U.audioCodec + '"') : U
  23041. .mimeType = 'video/x-flv; codecs="' + U.videoCodec + '"', U.isComplete() && r
  23042. ._onMediaInfo(U)
  23043. }
  23044. break;
  23045. case 8:
  23046. if (r.findKeyframe = !1, null == r._AVC_PPS && (r._AVC_PPS = new Uint8Array(t.data
  23047. .length + 4), r._AVC_PPS.set(r._StartCode, 0), r._AVC_PPS.set(t.data, 4)), !r
  23048. ._initVideoMetadata) {
  23049. r._initVideoMetadata = !0;
  23050. var N = r._videoMetadata;
  23051. if (null == N.avcc) {
  23052. var B = 0,
  23053. F = r._AVC_SPS.length - 4 + 8 + 1 + 2 + (r._AVC_PPS.length - 4);
  23054. N.avcc = new Uint8Array(F + 1), N.avcc[0] = 1, N.avcc[1] = r._AVC_SPS[5], N.avcc[2] =
  23055. r._AVC_SPS[6], N.avcc[3] = r._AVC_SPS[7], N.avcc[4] = 255, N.avcc[5] = 225, B = 6,
  23056. new Uint8Array, N.avcc[B++] = r._AVC_SPS.length - 4 >> 8, N.avcc[B++] = r._AVC_SPS
  23057. .length - 4 & 255;
  23058. var j = r._AVC_SPS.subarray(4, r._AVC_SPS.length);
  23059. N.avcc.set(j, B), B += j.length, N.avcc[B++] = 1, N.avcc[B++] = r._AVC_PPS.length -
  23060. 4 >> 8, N.avcc[B++] = r._AVC_PPS.length - 4 & 255;
  23061. var H = r._AVC_PPS.subarray(4, r._AVC_PPS.length);
  23062. N.avcc.set(H, B), B += H.length, N.avcc[F] = 1
  23063. }
  23064. r._onTrackMetadata("video", N)
  23065. }
  23066. }
  23067. });
  23068. var d = (e.pts - this.startVideoPts) / 90;
  23069. l && this.syncVideoPts < 1 && (this.syncVideoPts = this.startVideoPts);
  23070. var c = this._videoTrack,
  23071. h = {
  23072. units: o,
  23073. length: u,
  23074. isKeyframe: l,
  23075. dts: d,
  23076. cts: 0,
  23077. pts: d
  23078. };
  23079. l && (h.fileposition = this.tagPosition), 0 !== this.reset || this.findKeyframe || (c.samples.push(
  23080. h), c.length += u), this.filePosition += u, this.accurateTimeOffset = h.pts, this.lastVideoPts =
  23081. e.pts, 1 === n && (this.seekVideoHistoryPts = d), t && 0 === this.reset && (console.log(
  23082. "this._config", this._config, this._config.decodeType), "auto" === this._config.decodeType ||
  23083. "hard" === this._config.decodeType ? (this._onDataAvailable(this._audioTrack, this._videoTrack),
  23084. console.log("_onDataAvailable", this._audioTrack, this._videoTrack)) : (this._videoTrack
  23085. .samples.length > 0 && this._onDataAvailableToSoftwareDecodeVideo(27, this._videoTrack), this
  23086. ._audioTrack.samples.length > 0 && this._onDataAvailableToSoftwareDecodeAudio(86018, this
  23087. ._audioTrack)))
  23088. }, r.parseHEVCPES = function(e, t, i) {
  23089. (0 === this.startVideoPts || e.pts < this.startVideoPts) && (this.startVideoPts = e.pts);
  23090. var r = [],
  23091. n = 0,
  23092. a = {
  23093. type: 1,
  23094. data: e.data
  23095. },
  23096. s = 0;
  23097. if ((n += e.data.length) > 32)
  23098. for (var o = 0; o < 256 && o < e.data.length; o++)
  23099. if (0 === e.data[o] && 0 === e.data[o + 1] && 0 === e.data[o + 2] && 1 === e.data[o + 3] &&
  23100. 64 === e.data[o + 4]) {
  23101. s = 1, this.findKeyframe = !1;
  23102. break
  23103. } r.push(a);
  23104. var u = (e.pts - this.startVideoPts) / 90;
  23105. s && this.syncVideoPts < 1 && (this.syncVideoPts = this.startVideoPts);
  23106. var l = this._videoTrack,
  23107. d = {
  23108. units: r,
  23109. length: n,
  23110. isKeyframe: s,
  23111. dts: u,
  23112. cts: 0,
  23113. pts: u
  23114. };
  23115. s && (d.fileposition = this.tagPosition), l.samples.push(d), l.length += n, this._videoTrack.samples
  23116. .length > 0 && this._onDataAvailableToSoftwareDecodeVideo(173, this._videoTrack), this._audioTrack
  23117. .samples.length > 0 && this._onDataAvailableToSoftwareDecodeAudio(86018, this._audioTrack)
  23118. }, r._insertSampleInOrder = function(e, t) {
  23119. var i = e.length;
  23120. if (i > 0) {
  23121. if (t.pts >= e[i - 1].pts) e.push(t);
  23122. else
  23123. for (var r = i - 1; r >= 0; r--)
  23124. if (t.pts < e[r].pts) {
  23125. e.splice(r, 0, t);
  23126. break
  23127. }
  23128. } else e.push(t)
  23129. }, r._getLastNalUnit = function() {
  23130. var e, t = this.avcSample;
  23131. if (!t || 0 === t.units.length) {
  23132. var i = this._avcTrack.samples;
  23133. t = i[i.length - 1]
  23134. }
  23135. if (t) {
  23136. var r = t.units;
  23137. e = r[r.length - 1]
  23138. }
  23139. return e
  23140. }, r._parseAVCNALu = function(e) {
  23141. var t, i, r, n = 0,
  23142. a = e.byteLength,
  23143. s = 0,
  23144. o = [],
  23145. u = -1;
  23146. for (-1 === s && (u = 0, r = 31 & e[0], s = 0, n = 1); n < a;) t = e[n++], s ? 1 !== s ? t ? 1 ===
  23147. t ? (u >= 0 && 9 != (i = {
  23148. data: e.subarray(u, n - s - 1),
  23149. type: r
  23150. }).type && o.push(i), n < a ? (u = n, r = 31 & e[n], s = 0) : s = -1) : s = 0 : s = 3 : s = t ?
  23151. 0 : 2 : s = t ? 0 : 1;
  23152. if (u >= 0 && s >= 0 && (i = {
  23153. data: e.subarray(u, a),
  23154. type: r,
  23155. state: s
  23156. }, o.push(i)), 0 === o.length) {
  23157. var l = this._getLastNalUnit();
  23158. if (l) {
  23159. var d = new Uint8Array(l.data.byteLength + e.byteLength);
  23160. d.set(l.data, 0), d.set(e, l.data.byteLength), l.data = d
  23161. }
  23162. }
  23163. return o
  23164. }, r.discardEPB = function(e) {
  23165. for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] && 3 === e[
  23166. a + 2] ? (n.push(a + 2), a += 2) : a++;
  23167. if (0 === n.length) return e;
  23168. t = r - n.length, i = new Uint8Array(t);
  23169. var s = 0;
  23170. for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s];
  23171. return i
  23172. }, r.parseAACPES = function(e, t) {
  23173. 0 === this.startAudioPts && (this.startAudioPts = e.pts);
  23174. var i, r, n, s, o, u, l, d = this._audioTrack,
  23175. c = e.data,
  23176. h = e.pts,
  23177. f = this.aacOverFlow,
  23178. p = this.aacLastPTS;
  23179. if (f) {
  23180. var m = new Uint8Array(f.byteLength + c.byteLength);
  23181. m.set(f, 0), m.set(c, f.byteLength), c = m
  23182. }
  23183. for (n = 0, o = c.length; n < o - 1 && !b(c, n); n++);
  23184. if (!n || (n < o - 1 ? (u = "AAC PES did not start with ADTS header,offset:" + n, l = !1) : (u =
  23185. "no ADTS header found in AAC PES", l = !0), logger.warn("parsing error:" + u), this.observer
  23186. .trigger(Event.ERROR, {
  23187. type: ErrorTypes.MEDIA_ERROR,
  23188. details: ErrorDetails.FRAG_PARSING_ERROR,
  23189. fatal: l,
  23190. reason: u
  23191. }), !l)) {
  23192. if (this.audioSampleRate < 1) {
  23193. var g = w(c, n, this.audioCodec);
  23194. if (g && (this.audioSampleRate = g.samplerate, this.audioChannel = g.channelCount, this
  23195. .audioBitPerSample = 16, !this._initAudioMetadata)) {
  23196. this._initAudioMetadata = !0;
  23197. var v = this._audioMetadata,
  23198. y = this._audioTrack;
  23199. v || ((v = this._audioMetadata = {}).type = "audio", v.id = y.id, v.timescale = 1e3, v
  23200. .duration = 0, v.audioSampleRate = this.audioSampleRate, v.channelCount = this
  23201. .audioChannel), v.config && a.a.w(this.TAG, "Found another AudioSpecificConfig!"), g
  23202. .config, v.audioSampleRate = g.samplerate, v.channelCount = g.channelCount, v.codec = g
  23203. .codec, v.originalCodec = g.originalCodec, v.config = g.config, v.refSampleDuration = 1024 /
  23204. v.audioSampleRate * v.timescale, this._SampleRate = g.samplerate, this._ChannelNum = g
  23205. .channelCount, this._onDataAvailable(this._audioTrack, this._videoTrack), this
  23206. ._onTrackMetadata("audio", v);
  23207. var _ = this._mediaInfo;
  23208. _.audioCodec = v.originalCodec, _.audioSampleRate = v.audioSampleRate, _.audioChannelCount = v
  23209. .channelCount, _.hasVideo ? null != _.videoCodec && (_.mimeType = 'video/x-flv; codecs="' +
  23210. _.videoCodec + "," + _.audioCodec + '"') : _.mimeType = 'video/x-flv; codecs="' + _
  23211. .audioCodec + '"', _.isComplete() && this._onMediaInfo(_)
  23212. }
  23213. }
  23214. if (r = 0, i = E(this.audioSampleRate), f && p) {
  23215. var S = p + i;
  23216. Math.abs(S - h) > 1 && (console.log("AAC: align PTS for overlapping frames by " + Math.round((
  23217. S - h) / 90)), h = S)
  23218. }
  23219. for (; n < o;)
  23220. if (b(c, n) && n + 5 < o) {
  23221. var A = T(this.audioSampleRate, c, n, h, r);
  23222. if (!A) break;
  23223. var k = Math.round((A.sample.pts - this.startAudioPts) / 90),
  23224. R = {
  23225. unit: A.sample.unit,
  23226. length: A.length,
  23227. dts: k,
  23228. pts: k
  23229. };
  23230. 0 !== this.reset || this.findKeyframe || (this.syncAudioPts < 1 && this.syncVideoPts > 0 && (
  23231. this.syncAudioPts = this.syncVideoPts), this.syncAudioPts > 0 && (d.samples.push(R), d
  23232. .length += A.length)), n += A.length, s = A.sample.pts, r++
  23233. } else n++;
  23234. f = n < o ? c.subarray(n, o) : null, this.aacOverFlow = f, this.aacLastPTS = s
  23235. }
  23236. }, r.parseMPEGPES = function(e) {
  23237. for (var t = e.data, i = t.length, r = 0, n = 0, a = e.pts; n < i;)
  23238. if (MpegAudio.isHeader(t, n)) {
  23239. var s = MpegAudio.appendFrame(this._audioTrack, t, n, a, r);
  23240. if (!s) break;
  23241. n += s.length, r++
  23242. } else n++
  23243. }, r.append = function(t, i, r) {
  23244. if (null != t && 1 !== this.reset) {
  23245. var n, a, s, o, u, l, d = t.length,
  23246. c = !1,
  23247. h = -1,
  23248. f = -1,
  23249. p = -1,
  23250. m = this.avcTrackPesData,
  23251. g = this.audioTrackPesData,
  23252. v = this.id3TrackPesData,
  23253. y = !1,
  23254. _ = e._syncOffset(t);
  23255. for (d -= (d + _) % 188, n = _; n < d; n += 188)
  23256. if (71 === t[n]) {
  23257. if (a = !!(64 & t[n + 1]), s = ((31 & t[n + 1]) << 8) + t[n + 2], (48 & t[n + 3]) >> 4 > 1) {
  23258. if ((o = n + 5 + t[n + 4]) === n + 188) continue
  23259. } else o = n + 4;
  23260. switch (s) {
  23261. case h:
  23262. a && (m && (u = this.parsePES(m)) && (1 === this.isHEVC ? this.parseHEVCPES(u, !1, r) :
  23263. this.parseAVCPES(u, !1, r)), m = {
  23264. data: [],
  23265. size: 0
  23266. }), m && (m.data.push(t.subarray(o, n + 188)), m.size += n + 188 - o);
  23267. break;
  23268. case f:
  23269. a && (g && (u = this.parsePES(g)) && (this.isAAC ? this.parseAACPES(u, !1) : this
  23270. .parseMPEGPES(u)), g = {
  23271. data: [],
  23272. size: 0
  23273. }), g && (g.data.push(t.subarray(o, n + 188)), g.size += n + 188 - o);
  23274. break;
  23275. case p:
  23276. a && (v && (u = this.parsePES(v)) && parseID3PES(u), v = {
  23277. data: [],
  23278. size: 0
  23279. }), v && (v.data.push(t.subarray(o, n + 188)), v.size += n + 188 - o);
  23280. break;
  23281. case 0:
  23282. a && (o += t[o] + 1), l = this.parsePAT(t, o);
  23283. break;
  23284. case l:
  23285. a && (o += t[o] + 1);
  23286. var b = this.parsePMT(t, o, !1, !1);
  23287. h = b.avc, b.hevc > 0 && (h = b.hevc, this.isHEVC = 1), h > 0 && (this.avcTrackPid = h), !
  23288. this._callbackInitFlag && this._callbackMediaDataFunc && (this._callbackInitFlag = !0,
  23289. 1 === this.isHEVC || "auto" !== this._config.decodeType && "hard" !== this._config
  23290. .decodeType || this._callbackMediaDataFunc(this._callbackMediaDataUserPtr, !1, 1, 0,
  23291. 0, null, 0, 0, 0, 0)), (f = b.audio) > 0 && (this.audioTrackPid = f, this.isAAC = b
  23292. .isAAC), (p = b.id3) > 0 && (this.id3TrackPid = p), c && !y && (console.log(
  23293. "reparse from beginning"), c = !1, n = _ - 188), y = !0;
  23294. break;
  23295. case 17:
  23296. case 8191:
  23297. break;
  23298. default:
  23299. c = !0
  23300. }
  23301. } else console.log("parse error... reason: 'TS packet did not start with 0x47'");
  23302. m && (u = this.parsePES(m)) ? (1 == this.isHEVC ? this.parseHEVCPES(u, !0, r) : this.parseAVCPES(
  23303. u, !0, r), this.avcTrackPesData = null) : this.avcTrackPesData = m, g && (u = this.parsePES(
  23304. g)) ? (this.isAAC ? this.parseAACPES(u, !0) : this.parseMPEGPES(u), this.audioTrackPesData =
  23305. null) : (g && g.size && logger.log(
  23306. "last AAC PES packet truncated,might overlap between fragments"), this.audioTrackPesData =
  23307. g), v && (u = this.parsePES(v)) ? (parseID3PES(u), this.id3TrackPesData = null) : this
  23308. .id3TrackPesData = v
  23309. }
  23310. }, t = e, (i = [{
  23311. key: "onReceiveH265MediaHLSFrame",
  23312. get: function() {
  23313. return this._onReceiveH265MediaHLSFrame
  23314. },
  23315. set: function(e) {
  23316. this._onReceiveH265MediaHLSFrame = e
  23317. }
  23318. }, {
  23319. key: "onTrackMetadata",
  23320. get: function() {
  23321. return this._onTrackMetadata
  23322. },
  23323. set: function(e) {
  23324. this._onTrackMetadata = e
  23325. }
  23326. }, {
  23327. key: "onMediaInfo",
  23328. get: function() {
  23329. return this._onMediaInfo
  23330. },
  23331. set: function(e) {
  23332. this._onMediaInfo = e
  23333. }
  23334. }, {
  23335. key: "onMetaDataArrived",
  23336. get: function() {
  23337. return this._onMetaDataArrived
  23338. },
  23339. set: function(e) {
  23340. this._onMetaDataArrived = e
  23341. }
  23342. }, {
  23343. key: "onScriptDataArrived",
  23344. get: function() {
  23345. return this._onScriptDataArrived
  23346. },
  23347. set: function(e) {
  23348. this._onScriptDataArrived = e
  23349. }
  23350. }, {
  23351. key: "onError",
  23352. get: function() {
  23353. return this._onError
  23354. },
  23355. set: function(e) {
  23356. this._onError = e
  23357. }
  23358. }, {
  23359. key: "onDataAvailable",
  23360. get: function() {
  23361. return this._onDataAvailable
  23362. },
  23363. set: function(e) {
  23364. this._onDataAvailable = e
  23365. }
  23366. }, {
  23367. key: "timestampBase",
  23368. get: function() {
  23369. return this._timestampBase
  23370. },
  23371. set: function(e) {
  23372. this._timestampBase = e
  23373. }
  23374. }, {
  23375. key: "overridedDuration",
  23376. get: function() {
  23377. return this._duration
  23378. },
  23379. set: function(e) {
  23380. this._durationOverrided = !0, this._duration = e, this._mediaInfo.duration = e
  23381. }
  23382. }, {
  23383. key: "overridedHasAudio",
  23384. set: function(e) {
  23385. this._hasAudioFlagOverrided = !0, this._hasAudio = e, this._mediaInfo.hasAudio = e
  23386. }
  23387. }, {
  23388. key: "overridedHasVideo",
  23389. set: function(e) {
  23390. this._hasVideoFlagOverrided = !0, this._hasVideo = e, this._mediaInfo.hasVideo = e
  23391. }
  23392. }]) && A(t.prototype, i), Object.defineProperty(t, "prototype", {
  23393. writable: !1
  23394. }), e
  23395. }(),
  23396. R = function() {
  23397. function e() {}
  23398. return e.init = function() {
  23399. for (var t in e.types = {
  23400. avc1: [],
  23401. avcC: [],
  23402. btrt: [],
  23403. dinf: [],
  23404. dref: [],
  23405. esds: [],
  23406. ftyp: [],
  23407. hdlr: [],
  23408. mdat: [],
  23409. mdhd: [],
  23410. mdia: [],
  23411. mfhd: [],
  23412. minf: [],
  23413. moof: [],
  23414. moov: [],
  23415. mp4a: [],
  23416. mvex: [],
  23417. mvhd: [],
  23418. sdtp: [],
  23419. stbl: [],
  23420. stco: [],
  23421. stsc: [],
  23422. stsd: [],
  23423. stsz: [],
  23424. stts: [],
  23425. tfdt: [],
  23426. tfhd: [],
  23427. traf: [],
  23428. trak: [],
  23429. trun: [],
  23430. trex: [],
  23431. tkhd: [],
  23432. vmhd: [],
  23433. smhd: [],
  23434. ".mp3": []
  23435. }, e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t
  23436. .charCodeAt(2), t.charCodeAt(3)
  23437. ]);
  23438. var i = e.constants = {};
  23439. i.FTYP = new Uint8Array([105, 115, 111, 109, 0, 0, 0, 1, 105, 115, 111, 109, 97, 118, 99, 49]), i
  23440. .STSD_PREFIX = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), i.STTS = new Uint8Array([0, 0, 0, 0, 0,
  23441. 0, 0, 0
  23442. ]), i.STSC = i.STCO = i.STTS, i.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), i
  23443. .HDLR_VIDEO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0,
  23444. 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0
  23445. ]), i.HDLR_AUDIO = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0,
  23446. 0, 0, 0, 0, 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0
  23447. ]), i.DREF = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]),
  23448. i.SMHD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), i.VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0,
  23449. 0, 0, 0, 0, 0
  23450. ])
  23451. }, e.box = function(e) {
  23452. for (var t = 8, i = null, r = Array.prototype.slice.call(arguments, 1), n = r.length, a = 0; a <
  23453. n; a++) t += r[a].byteLength;
  23454. (i = new Uint8Array(t))[0] = t >>> 24 & 255, i[1] = t >>> 16 & 255, i[2] = t >>> 8 & 255, i[3] =
  23455. 255 & t, i.set(e, 4);
  23456. for (var s = 8, o = 0; o < n; o++) i.set(r[o], s), s += r[o].byteLength;
  23457. return i
  23458. }, e.generateInitSegment = function(t) {
  23459. var i = e.box(e.types.ftyp, e.constants.FTYP),
  23460. r = e.moov(t),
  23461. n = new Uint8Array(i.byteLength + r.byteLength);
  23462. return n.set(i, 0), n.set(r, i.byteLength), n
  23463. }, e.moov = function(t) {
  23464. var i = e.mvhd(t.timescale, t.duration),
  23465. r = e.trak(t),
  23466. n = e.mvex(t);
  23467. return e.box(e.types.moov, i, r, n)
  23468. }, e.mvhd = function(t, i) {
  23469. return e.box(e.types.mvhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, t >>> 24 & 255, t >>>
  23470. 16 & 255, t >>> 8 & 255, 255 & t, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0,
  23471. 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  23472. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  23473. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255
  23474. ]))
  23475. }, e.trak = function(t) {
  23476. return e.box(e.types.trak, e.tkhd(t), e.mdia(t))
  23477. }, e.tkhd = function(t) {
  23478. var i = t.id,
  23479. r = t.duration,
  23480. n = t.presentWidth,
  23481. a = t.presentHeight;
  23482. return e.box(e.types.tkhd, new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>>
  23483. 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0, 0, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255,
  23484. 255 & r, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  23485. 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, n >>> 8 & 255,
  23486. 255 & n, 0, 0, a >>> 8 & 255, 255 & a, 0, 0
  23487. ]))
  23488. }, e.mdia = function(t) {
  23489. return e.box(e.types.mdia, e.mdhd(t), e.hdlr(t), e.minf(t))
  23490. }, e.mdhd = function(t) {
  23491. var i = t.timescale,
  23492. r = t.duration;
  23493. return e.box(e.types.mdhd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, i >>> 24 & 255, i >>>
  23494. 16 & 255, i >>> 8 & 255, 255 & i, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255, 255 & r,
  23495. 85, 196, 0, 0
  23496. ]))
  23497. }, e.hdlr = function(t) {
  23498. var i;
  23499. return i = "audio" === t.type ? e.constants.HDLR_AUDIO : e.constants.HDLR_VIDEO, e.box(e.types.hdlr,
  23500. i)
  23501. }, e.minf = function(t) {
  23502. var i;
  23503. return i = "audio" === t.type ? e.box(e.types.smhd, e.constants.SMHD) : e.box(e.types.vmhd, e
  23504. .constants.VMHD), e.box(e.types.minf, i, e.dinf(), e.stbl(t))
  23505. }, e.dinf = function() {
  23506. return e.box(e.types.dinf, e.box(e.types.dref, e.constants.DREF))
  23507. }, e.stbl = function(t) {
  23508. return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.constants.STTS), e.box(e.types.stsc, e
  23509. .constants.STSC), e.box(e.types.stsz, e.constants.STSZ), e.box(e.types.stco, e.constants
  23510. .STCO))
  23511. }, e.stsd = function(t) {
  23512. return "audio" === t.type ? "mp3" === t.codec ? e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp3(
  23513. t)) : e.box(e.types.stsd, e.constants.STSD_PREFIX, e.mp4a(t)) : e.box(e.types.stsd, e.constants
  23514. .STSD_PREFIX, e.avc1(t))
  23515. }, e.mp3 = function(t) {
  23516. var i = t.channelCount,
  23517. r = t.audioSampleRate,
  23518. n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, r >>>
  23519. 8 & 255, 255 & r, 0, 0
  23520. ]);
  23521. return e.box(e.types[".mp3"], n)
  23522. }, e.mp4a = function(t) {
  23523. var i = t.channelCount,
  23524. r = t.audioSampleRate,
  23525. n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, i, 0, 16, 0, 0, 0, 0, r >>>
  23526. 8 & 255, 255 & r, 0, 0
  23527. ]);
  23528. return e.box(e.types.mp4a, n, e.esds(t))
  23529. }, e.esds = function(t) {
  23530. var i = t.config || [],
  23531. r = i.length,
  23532. n = new Uint8Array([0, 0, 0, 0, 3, 23 + r, 0, 1, 0, 4, 15 + r, 64, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  23533. 0, 0, 5
  23534. ].concat([r]).concat(i).concat([6, 1, 2]));
  23535. return e.box(e.types.esds, n)
  23536. }, e.avc1 = function(t) {
  23537. var i = t.avcc,
  23538. r = t.codecWidth,
  23539. n = t.codecHeight,
  23540. a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, r >>>
  23541. 8 & 255, 255 & r, n >>> 8 & 255, 255 & n, 0, 72, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 10, 120,
  23542. 113, 113, 47, 102, 108, 118, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  23543. 0, 0, 0, 0, 0, 24, 255, 255
  23544. ]);
  23545. return e.box(e.types.avc1, a, e.box(e.types.avcC, i))
  23546. }, e.mvex = function(t) {
  23547. return e.box(e.types.mvex, e.trex(t))
  23548. }, e.trex = function(t) {
  23549. var i = t.id,
  23550. r = new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i, 0, 0, 0,
  23551. 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1
  23552. ]);
  23553. return e.box(e.types.trex, r)
  23554. }, e.moof = function(t, i) {
  23555. return e.box(e.types.moof, e.mfhd(t.sequenceNumber), e.traf(t, i))
  23556. }, e.mfhd = function(t) {
  23557. var i = new Uint8Array([0, 0, 0, 0, t >>> 24 & 255, t >>> 16 & 255, t >>> 8 & 255, 255 & t]);
  23558. return e.box(e.types.mfhd, i)
  23559. }, e.traf = function(t, i) {
  23560. var r = t.id,
  23561. n = e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, r >>> 24 & 255, r >>> 16 & 255, r >>> 8 & 255,
  23562. 255 & r
  23563. ])),
  23564. a = e.box(e.types.tfdt, new Uint8Array([0, 0, 0, 0, i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255,
  23565. 255 & i
  23566. ])),
  23567. s = e.sdtp(t),
  23568. o = e.trun(t, s.byteLength + 16 + 16 + 8 + 16 + 8 + 8);
  23569. return e.box(e.types.traf, n, a, o, s)
  23570. }, e.sdtp = function(t) {
  23571. for (var i = t.samples || [], r = i.length, n = new Uint8Array(4 + r), a = 0; a < r; a++) {
  23572. var s = i[a].flags;
  23573. n[a + 4] = s.isLeading << 6 | s.dependsOn << 4 | s.isDependedOn << 2 | s.hasRedundancy
  23574. }
  23575. return e.box(e.types.sdtp, n)
  23576. }, e.trun = function(t, i) {
  23577. var r = t.samples || [],
  23578. n = r.length,
  23579. a = 12 + 16 * n,
  23580. s = new Uint8Array(a);
  23581. i += 8 + a, s.set([0, 0, 15, 1, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, 255 & n, i >>> 24 &
  23582. 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i
  23583. ], 0);
  23584. for (var o = 0; o < n; o++) {
  23585. var u = r[o].duration,
  23586. l = r[o].size,
  23587. d = r[o].flags,
  23588. c = r[o].cts;
  23589. s.set([u >>> 24 & 255, u >>> 16 & 255, u >>> 8 & 255, 255 & u, l >>> 24 & 255, l >>> 16 & 255,
  23590. l >>> 8 & 255, 255 & l, d.isLeading << 2 | d.dependsOn, d.isDependedOn << 6 | d
  23591. .hasRedundancy << 4 | d.isNonSync, 0, 0, c >>> 24 & 255, c >>> 16 & 255, c >>> 8 & 255,
  23592. 255 & c
  23593. ], 12 + 16 * o)
  23594. }
  23595. return e.box(e.types.trun, s)
  23596. }, e.mdat = function(t) {
  23597. return e.box(e.types.mdat, t)
  23598. }, e
  23599. }();
  23600. R.init();
  23601. var M = R,
  23602. O = function() {
  23603. function e() {}
  23604. return e.getSilentFrame = function(e, t) {
  23605. if ("mp4a.40.2" === e) {
  23606. if (1 === t) return new Uint8Array([0, 200, 0, 128, 35, 128]);
  23607. if (2 === t) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
  23608. if (3 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
  23609. if (4 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128,
  23610. 8, 2, 56
  23611. ]);
  23612. if (5 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4,
  23613. 153, 0, 33, 144, 2, 56
  23614. ]);
  23615. if (6 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4,
  23616. 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224
  23617. ])
  23618. } else {
  23619. if (1 === t) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6,
  23620. 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  23621. 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94
  23622. ]);
  23623. if (2 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0,
  23624. 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  23625. 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94
  23626. ]);
  23627. if (3 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0,
  23628. 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  23629. 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94
  23630. ])
  23631. }
  23632. return null
  23633. }, e
  23634. }(),
  23635. C = i(21),
  23636. D = i(16);
  23637. function I(e, t) {
  23638. for (var i = 0; i < t.length; i++) {
  23639. var r = t[i];
  23640. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  23641. .defineProperty(e, r.key, r)
  23642. }
  23643. }
  23644. var L = function() {
  23645. function e(e) {
  23646. this.TAG = "MP4Remuxer", this._config = e, this._isLive = !0 === e.isLive, this._dtsBase = -1, this
  23647. ._dtsBaseInited = !1, this._audioDtsBase = 1 / 0, this._videoDtsBase = 1 / 0, this._audioNextDts =
  23648. void 0, this._videoNextDts = void 0, this._audioStashedLastSample = null, this
  23649. ._videoStashedLastSample = null, this._audioMeta = null, this._videoMeta = null, this
  23650. ._audioSegmentInfoList = new D.c("audio"), this._videoSegmentInfoList = new D.c("video"), this
  23651. ._onInitSegment = null, this._onMediaSegment = null, this._forceFirstIDR = !(!s.a.chrome || !(s.a
  23652. .version.major < 50 || 50 === s.a.version.major && s.a.version.build < 2661)), this
  23653. ._fillSilentAfterSeek = s.a.msedge || s.a.msie, this._mp3UseMpegAudio = !s.a.firefox, this
  23654. ._fillAudioTimestampGap = this._config.fixAudioTimestampGap, this._recordWorker = null, this
  23655. ._findKeyframe = !0, this._initRecordFlag = !1, this._recordFileName = "record.mp4"
  23656. }
  23657. var t, i, r = e.prototype;
  23658. return r.destroy = function() {
  23659. this._dtsBase = -1, this._dtsBaseInited = !1, this._audioMeta = null, this._videoMeta = null, this
  23660. ._audioSegmentInfoList.clear(), this._audioSegmentInfoList = null, this._videoSegmentInfoList
  23661. .clear(), this._videoSegmentInfoList = null, this._onInitSegment = null, this._onMediaSegment =
  23662. null, this._recordWorker && (this._recordWorker.terminate(), this._recordWorker = null)
  23663. }, r.bindDataSource = function(e) {
  23664. return e.onDataAvailable = this.remux.bind(this), e.onTrackMetadata = this._onTrackMetadataReceived
  23665. .bind(this), this
  23666. }, r.insertDiscontinuity = function() {
  23667. this._audioNextDts = this._videoNextDts = void 0
  23668. }, r.seek = function(e) {
  23669. this._audioStashedLastSample = null, this._videoStashedLastSample = null, this._videoSegmentInfoList
  23670. .clear(), this._audioSegmentInfoList.clear()
  23671. }, r.remux = function(e, t) {
  23672. if (!this._onMediaSegment) throw new c.a("MP4Remuxer: onMediaSegment callback must be specificed!");
  23673. this._dtsBaseInited || this._calculateDtsBase(e, t), this._remuxVideo(t), this._remuxAudio(e)
  23674. }, r._onTrackMetadataReceived = function(e, t) {
  23675. var i = null,
  23676. r = "mp4",
  23677. n = t.codec;
  23678. if ("audio" === e) this._audioMeta = t, "mp3" === t.codec && this._mp3UseMpegAudio ? (r = "mpeg",
  23679. n = "", i = new Uint8Array) : i = M.generateInitSegment(t);
  23680. else {
  23681. if ("video" !== e) return;
  23682. this._videoMeta = t, i = M.generateInitSegment(t)
  23683. }
  23684. if (!this._onInitSegment) throw new c.a("MP4Remuxer: onInitSegment callback must be specified!");
  23685. this._onInitSegment(e, {
  23686. type: e,
  23687. data: i.buffer,
  23688. codec: n,
  23689. container: e + "/" + r,
  23690. mediaDuration: t.duration
  23691. })
  23692. }, r._calculateDtsBase = function(e, t) {
  23693. this._dtsBaseInited || (e.samples && e.samples.length && (this._audioDtsBase = e.samples[0].dts), t
  23694. .samples && t.samples.length && (this._videoDtsBase = t.samples[0].dts), this._dtsBase = Math
  23695. .min(this._audioDtsBase, this._videoDtsBase), this._dtsBaseInited = !0)
  23696. }, r.flushStashedSamples = function() {
  23697. var e = this._videoStashedLastSample,
  23698. t = this._audioStashedLastSample,
  23699. i = {
  23700. type: "video",
  23701. id: 1,
  23702. sequenceNumber: 0,
  23703. samples: [],
  23704. length: 0
  23705. };
  23706. null != e && (i.samples.push(e), i.length = e.length);
  23707. var r = {
  23708. type: "audio",
  23709. id: 2,
  23710. sequenceNumber: 0,
  23711. samples: [],
  23712. length: 0
  23713. };
  23714. null != t && (r.samples.push(t), r.length = t.length), this._videoStashedLastSample = null, this
  23715. ._audioStashedLastSample = null, this._remuxVideo(i, !0), this._remuxAudio(r, !0)
  23716. }, r._remuxAudio = function(e, t) {
  23717. if (null != this._audioMeta) {
  23718. var i, r = e,
  23719. n = r.samples,
  23720. o = void 0,
  23721. u = -1,
  23722. l = this._audioMeta.refSampleDuration,
  23723. d = "mp3" === this._audioMeta.codec && this._mp3UseMpegAudio,
  23724. c = this._dtsBaseInited && void 0 === this._audioNextDts,
  23725. h = !1;
  23726. if (n && 0 !== n.length && (1 !== n.length || t)) {
  23727. if (!g.c())
  23728. for (var f = 0; f < n.length; f++) n.shift();
  23729. var p = 0,
  23730. m = null,
  23731. v = 0;
  23732. d ? (p = 0, v = r.length) : (p = 8, v = 8 + r.length);
  23733. var y = null;
  23734. if (n.length > 1 && (v -= (y = n.pop()).length), null != this._audioStashedLastSample) {
  23735. var _ = this._audioStashedLastSample;
  23736. this._audioStashedLastSample = null, n.unshift(_), v += _.length
  23737. }
  23738. null != y && (this._audioStashedLastSample = y);
  23739. var b = n[0].dts - this._dtsBase;
  23740. if (this._audioNextDts) o = b - this._audioNextDts;
  23741. else if (this._audioSegmentInfoList.isEmpty()) o = 0, this._fillSilentAfterSeek && !this
  23742. ._videoSegmentInfoList.isEmpty() && "mp3" !== this._audioMeta.originalCodec && (h = !0);
  23743. else {
  23744. var w = this._audioSegmentInfoList.getLastSampleBefore(b);
  23745. if (null != w) {
  23746. var E = b - (w.originalDts + w.duration);
  23747. E <= 3 && (E = 0), o = b - (w.dts + w.duration + E)
  23748. } else o = 0
  23749. }
  23750. if (h) {
  23751. var T = b - o,
  23752. S = this._videoSegmentInfoList.getLastSegmentBefore(b);
  23753. if (null != S && S.beginDts < T) {
  23754. var A = O.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  23755. if (A) {
  23756. var k = S.beginDts,
  23757. R = T - S.beginDts;
  23758. a.a.v(this.TAG, "InsertPrefixSilentAudio: dts: " + k + ", duration: " + R), n.unshift({
  23759. unit: A,
  23760. dts: k,
  23761. pts: k
  23762. }), v += A.byteLength
  23763. }
  23764. } else h = !1
  23765. }
  23766. for (var C = [], I = 0; I < n.length; I++) {
  23767. var L = n[I],
  23768. x = L.unit,
  23769. P = L.dts - this._dtsBase,
  23770. U = P,
  23771. N = !1,
  23772. B = null,
  23773. F = 0;
  23774. if (!(P < -.001)) {
  23775. if ("mp3" !== this._audioMeta.codec) {
  23776. var j = P;
  23777. if (this._audioNextDts && (j = this._audioNextDts), (o = P - j) <= -3 * l) {
  23778. a.a.w(this.TAG, "Dropping 1 audio frame (originalDts: " + P + " ms ,curRefDts: " + j +
  23779. " ms) due to dtsCorrection: " + o + " ms overlap.");
  23780. continue
  23781. }
  23782. if (o >= 3 * l && this._fillAudioTimestampGap && !s.a.safari) {
  23783. N = !0;
  23784. var H = Math.floor(o / l);
  23785. a.a.w(this.TAG,
  23786. "Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\noriginalDts: " +
  23787. P + " ms, curRefDts: " + j + " ms, dtsCorrection: " + Math.round(o) +
  23788. " ms, generate: " + H + " frames"), U = Math.floor(j), F = Math.floor(j + l) - U;
  23789. var G = O.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  23790. null == G && (a.a.w(this.TAG, "Unable to generate silent frame for " + this._audioMeta
  23791. .originalCodec + " with " + this._audioMeta.channelCount +
  23792. " channels, repeat last frame"), G = x), B = [];
  23793. for (var V = 0; V < H; V++) {
  23794. j += l;
  23795. var W = Math.floor(j),
  23796. q = Math.floor(j + l) - W,
  23797. X = {
  23798. dts: W,
  23799. pts: W,
  23800. cts: 0,
  23801. unit: G,
  23802. size: G.byteLength,
  23803. duration: q,
  23804. originalDts: P,
  23805. flags: {
  23806. isLeading: 0,
  23807. dependsOn: 1,
  23808. isDependedOn: 0,
  23809. hasRedundancy: 0
  23810. }
  23811. };
  23812. B.push(X), v += X.size
  23813. }
  23814. this._audioNextDts = j + l
  23815. } else U = Math.floor(j), F = Math.floor(j + l) - U, this._audioNextDts = j + l
  23816. } else U = P - o, F = I !== n.length - 1 ? n[I + 1].dts - this._dtsBase - o - U : null !=
  23817. y ? y.dts - this._dtsBase - o - U : C.length >= 1 ? C[C.length - 1].duration : Math.floor(
  23818. l), this._audioNextDts = U + F;
  23819. if (-1 === u && (u = U), this._initRecordFlag && this._recordWorker && !this
  23820. ._findKeyframe) {
  23821. var z = new Uint8Array(L.unit),
  23822. K = {
  23823. cmd: g.q,
  23824. mediaType: "audio",
  23825. dat: z,
  23826. pts: U
  23827. };
  23828. this._recordWorker.postMessage(K, [K.dat.buffer])
  23829. }
  23830. C.push({
  23831. dts: U,
  23832. pts: U,
  23833. cts: 0,
  23834. unit: L.unit,
  23835. size: L.unit.byteLength,
  23836. duration: F,
  23837. originalDts: P,
  23838. flags: {
  23839. isLeading: 0,
  23840. dependsOn: 1,
  23841. isDependedOn: 0,
  23842. hasRedundancy: 0
  23843. }
  23844. }), N && C.push.apply(C, B)
  23845. }
  23846. }
  23847. if (0 === C.length) return r.samples = [], void(r.length = 0);
  23848. d ? m = new Uint8Array(v) : ((m = new Uint8Array(v))[0] = v >>> 24 & 255, m[1] = v >>> 16 & 255,
  23849. m[2] = v >>> 8 & 255, m[3] = 255 & v, m.set(M.types.mdat, 4));
  23850. for (var Y = 0; Y < C.length; Y++) {
  23851. var Q = C[Y].unit;
  23852. m.set(Q, p), p += Q.byteLength
  23853. }
  23854. var J = C[C.length - 1];
  23855. i = J.dts + J.duration;
  23856. var Z = new D.b;
  23857. Z.beginDts = u, Z.endDts = i, Z.beginPts = u, Z.endPts = i, Z.originalBeginDts = C[0]
  23858. .originalDts, Z.originalEndDts = J.originalDts + J.duration, Z.firstSample = new D.d(C[0].dts,
  23859. C[0].pts, C[0].duration, C[0].originalDts, !1), Z.lastSample = new D.d(J.dts, J.pts, J
  23860. .duration, J.originalDts, !1), this._isLive || this._audioSegmentInfoList.append(Z), r
  23861. .samples = C, r.sequenceNumber++;
  23862. var $;
  23863. $ = d ? new Uint8Array : M.moof(r, u), r.samples = [], r.length = 0;
  23864. var ee = {
  23865. type: "audio",
  23866. data: this._mergeBoxes($, m).buffer,
  23867. sampleCount: C.length,
  23868. info: Z
  23869. };
  23870. d && c && (ee.timestampOffset = u), this._onMediaSegment("audio", ee)
  23871. }
  23872. }
  23873. }, r._remuxVideo = function(e, t) {
  23874. if (null != this._videoMeta) {
  23875. var i, r, n = e,
  23876. a = n.samples,
  23877. s = void 0,
  23878. o = -1,
  23879. u = -1;
  23880. if (a && 0 !== a.length && (1 !== a.length || t)) {
  23881. var l = 8,
  23882. d = null,
  23883. c = 8 + e.length,
  23884. h = null;
  23885. if (a.length > 1 && (c -= (h = a.pop()).length), null != this._videoStashedLastSample) {
  23886. var f = this._videoStashedLastSample;
  23887. this._videoStashedLastSample = null, a.unshift(f), c += f.length
  23888. }
  23889. null != h && (this._videoStashedLastSample = h);
  23890. var p = a[0].dts - this._dtsBase;
  23891. if (this._videoNextDts) s = p - this._videoNextDts;
  23892. else if (this._videoSegmentInfoList.isEmpty()) s = 0;
  23893. else {
  23894. var m = this._videoSegmentInfoList.getLastSampleBefore(p);
  23895. if (null != m) {
  23896. var v = p - (m.originalDts + m.duration);
  23897. v <= 3 && (v = 0), s = p - (m.dts + m.duration + v)
  23898. } else s = 0
  23899. }
  23900. for (var y = new D.b, _ = [], b = 0; b < a.length; b++) {
  23901. var w = a[b],
  23902. E = w.dts - this._dtsBase,
  23903. T = w.isKeyframe,
  23904. S = E - s,
  23905. A = w.cts,
  23906. k = S + A; - 1 === o && (o = S, u = k);
  23907. var R = 0;
  23908. if (R = b !== a.length - 1 ? a[b + 1].dts - this._dtsBase - s - S : null != h ? h.dts - this
  23909. ._dtsBase - s - S : _.length >= 1 ? _[_.length - 1].duration : Math.floor(this._videoMeta
  23910. .refSampleDuration), T) {
  23911. var O = new D.d(S, k, R, w.dts, !0);
  23912. O.fileposition = w.fileposition, y.appendSyncPoint(O), this._findKeyframe = !1
  23913. }
  23914. _.push({
  23915. dts: S,
  23916. pts: k,
  23917. cts: A,
  23918. units: w.units,
  23919. size: w.length,
  23920. isKeyframe: T,
  23921. duration: R,
  23922. originalDts: E,
  23923. flags: {
  23924. isLeading: 0,
  23925. dependsOn: T ? 2 : 1,
  23926. isDependedOn: T ? 1 : 0,
  23927. hasRedundancy: 0,
  23928. isNonSync: T ? 0 : 1
  23929. }
  23930. })
  23931. }
  23932. if (this._initRecordFlag && this._recordWorker && !this._findKeyframe)
  23933. for (var C = !1, I = 0; I < a.length; I++) {
  23934. var L = a[I],
  23935. x = L.units[0].data.length;
  23936. if (L.units.length >= 3)
  23937. for (var P = 1; P < L.units.length; P++) {
  23938. if (6 === L.units.length) {
  23939. if (P < 4) continue;
  23940. if (5 === L.units.length && P < 3) continue
  23941. }
  23942. x += L.units[P].data.length
  23943. }
  23944. C = L.isKeyframe;
  23945. var U = new Uint8Array(L.units[0].data),
  23946. N = 0,
  23947. B = new Uint8Array(x);
  23948. if (B.set(U, 0), B[0] = 0, B[1] = 0, B[2] = 0, B[3] = 1, N += U.length, L.units.length >= 3)
  23949. for (var F = 1; F < L.units.length; F++)
  23950. if (!(6 === L.units.length && F < 4 || 5 === L.units.length && F < 3)) {
  23951. var j = new Uint8Array(L.units[F].data);
  23952. B.set(j, N), B[N + 0] = 0, B[N + 1] = 0, B[N + 2] = 0, B[N + 3] = 1, N += j.length
  23953. } var H = {
  23954. cmd: g.q,
  23955. mediaType: "video",
  23956. codecId: 28,
  23957. type: C,
  23958. dat: B,
  23959. pts: L.dts
  23960. };
  23961. this._recordWorker.postMessage(H, [H.dat.buffer])
  23962. }(d = new Uint8Array(c))[0] = c >>> 24 & 255, d[1] = c >>> 16 & 255, d[2] = c >>> 8 & 255, d[
  23963. 3] = 255 & c, d.set(M.types.mdat, 4);
  23964. for (var G = 0; G < _.length; G++)
  23965. for (var V = _[G].units; V.length;) {
  23966. var W = V.shift().data;
  23967. d.set(W, l), l += W.byteLength
  23968. }
  23969. var q = _[_.length - 1];
  23970. if (i = q.dts + q.duration, r = q.pts + q.duration, this._videoNextDts = i, y.beginDts = o, y
  23971. .endDts = i, y.beginPts = u, y.endPts = r, y.originalBeginDts = _[0].originalDts, y
  23972. .originalEndDts = q.originalDts + q.duration, y.firstSample = new D.d(_[0].dts, _[0].pts, _[0]
  23973. .duration, _[0].originalDts, _[0].isKeyframe), y.lastSample = new D.d(q.dts, q.pts, q
  23974. .duration, q.originalDts, q.isKeyframe), this._isLive || this._videoSegmentInfoList.append(
  23975. y), n.samples = _, n.sequenceNumber++, this._forceFirstIDR) {
  23976. var X = _[0].flags;
  23977. X.dependsOn = 2, X.isNonSync = 0
  23978. }
  23979. var z = M.moof(n, o);
  23980. n.samples = [], n.length = 0, this._onMediaSegment("video", {
  23981. type: "video",
  23982. data: this._mergeBoxes(z, d).buffer,
  23983. sampleCount: _.length,
  23984. info: y
  23985. })
  23986. }
  23987. }
  23988. }, r._mergeBoxes = function(e, t) {
  23989. var i = new Uint8Array(e.byteLength + t.byteLength);
  23990. return i.set(e, 0), i.set(t, e.byteLength), i
  23991. }, r.videoRecording = function(e, t, i, r, stop) {
  23992. r && (this._wasmRecordingCb = r);
  23993. this.stopRecoeding = stop;
  23994. if (1 === i) {
  23995. this._recordFileName = e;
  23996. this._recordWorker = null;
  23997. if (this._recordFileName = e, null != this._recordWorker) return -1e3;
  23998. this._findKeyframe = !0;
  23999. try {
  24000. this._recordWorker = C(67), this.onwmsg = this._onRecordingWorkerMessage.bind(this);
  24001. var n = {
  24002. cmd: g.w,
  24003. url: g.g(),
  24004. filesize: t,
  24005. audioSamplerate: this._audioMeta ? this._audioMeta.audioSampleRate : 0,
  24006. channelCount: this._audioMeta ? this._audioMeta.channelCount : 1
  24007. };
  24008. this._recordWorker.postMessage(n), this._recordWorker.addEventListener("message", this.onwmsg)
  24009. } catch (e) {
  24010. this.recordWorker = null
  24011. }
  24012. } else this._initRecordFlag = !1, this._recordWorker && (this._recordWorker.postMessage({
  24013. cmd: g.C
  24014. }), this._findKeyframe = !0)
  24015. }, r._onRecordingWorkerMessage = function(e) {
  24016. var t = e.data;
  24017. switch (t.cmd) {
  24018. case g.w:
  24019. this._findKeyframe = !0, this._initRecordFlag = !0, this._wasmRecordingCb(1);
  24020. break;
  24021. case g.p:
  24022. this._initRecordFlag = !1;
  24023. if(this.stopRecoeding) {
  24024. this._findKeyframe = !1, this._recordWorker.terminate(), this._recordWorker = null, this._wasmRecordingCb = null
  24025. return false;
  24026. }
  24027. if(!window.isVideoWatermark) {
  24028. var i = document.createElement("a");
  24029. i.style.display = "none", i.href = t.dat,
  24030. i.download = this._recordFileName, document.body
  24031. .appendChild(i), i.click(), window.URL.revokeObjectURL(i.href), document.body.removeChild(i),
  24032. this._findKeyframe = !1, this._recordWorker.terminate(), this._recordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null
  24033. return false;
  24034. }
  24035. fetch(t.dat).then(response => response.blob()).then(blob => {
  24036. const file = new File([blob], this._recordFileName, { type: blob.type })
  24037. console.log('=============视频加水印============1==', file)
  24038. this._findKeyframe = !1, this._recordWorker.terminate(), this._recordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null
  24039. const formData = new FormData()
  24040. formData.append('file', file)
  24041. fetch('/apiserver/export/alarm/order/downloadVideoByFlush', {
  24042. method: 'POST',
  24043. headers: {
  24044. 'Authorization': 'Bearer ' + (window.$videoStoreData?.userInfo?.token || sessionStorage.getItem('Admin-Token')),
  24045. 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || ''
  24046. },
  24047. body: formData
  24048. }).then(response =>response.blob()).then(blob => {
  24049. console.log('=============视频加水印============1=返回=', blob)
  24050. var i = document.createElement("a");
  24051. i.style.display = "none", i.href = window.URL.createObjectURL(new Blob([blob], { type: 'video/mp4' })),
  24052. i.download = this._recordFileName, document.body
  24053. .appendChild(i), i.click(), window.URL.revokeObjectURL(i.href), document.body.removeChild(i)
  24054. })
  24055. })
  24056. }
  24057. }, t = e, (i = [{
  24058. key: "onInitSegment",
  24059. get: function() {
  24060. return this._onInitSegment
  24061. },
  24062. set: function(e) {
  24063. this._onInitSegment = e
  24064. }
  24065. }, {
  24066. key: "onMediaSegment",
  24067. get: function() {
  24068. return this._onMediaSegment
  24069. },
  24070. set: function(e) {
  24071. this._onMediaSegment = e
  24072. }
  24073. }]) && I(t.prototype, i), Object.defineProperty(t, "prototype", {
  24074. writable: !1
  24075. }), e
  24076. }(),
  24077. x = i(37),
  24078. P = i(2),
  24079. U = (i(3), function() {
  24080. function e(e, t) {
  24081. this.TAG = "TransmuxingController", this._emitter = new n.a, this._config = t, e.segments || (e
  24082. .segments = [{
  24083. duration: e.duration,
  24084. filesize: e.filesize,
  24085. url: e.url
  24086. }]), "boolean" != typeof e.cors && (e.cors = !0), "boolean" != typeof e.withCredentials && (e
  24087. .withCredentials = !1), this._mediaDataSource = e, this._currentSegmentIndex = 0;
  24088. var i = 0;
  24089. this._mediaDataSource.segments.forEach(function(r) {
  24090. r.timestampBase = i, i += r.duration, r.cors = e.cors, r.withCredentials = e.withCredentials,
  24091. t.referrerPolicy && (r.referrerPolicy = t.referrerPolicy)
  24092. }), isNaN(i) || this._mediaDataSource.duration === i || (this._mediaDataSource.duration = i), this
  24093. ._mediaInfo = null, this._demuxer = null, this._remuxer = null, this._ioctl = null, this
  24094. ._pendingSeekTime = null, this._pendingResolveSeekPoint = null, this._statisticsReporter = null,
  24095. this._onReceiveH265MediaFrameFuc = null, this._mediaTypeIsHLS = e.url.includes(".m3u8")
  24096. }
  24097. var t = e.prototype;
  24098. return t.destroy = function() {
  24099. this._mediaInfo = null, this._mediaDataSource = null, this._statisticsReporter && this
  24100. ._disableStatisticsReporter(), this._ioctl && (this._ioctl.destroy(), this._ioctl = null), this
  24101. ._demuxer && (this._demuxer.destroy(), this._demuxer = null), this._remuxer && (this._remuxer
  24102. .destroy(), this._remuxer = null), this._emitter.removeAllListeners(), this._emitter = null
  24103. }, t.on = function(e, t) {
  24104. this._emitter.addListener(e, t)
  24105. }, t.off = function(e, t) {
  24106. this._emitter.removeListener(e, t)
  24107. }, t.start = function() {
  24108. this._loadSegment(0), this._enableStatisticsReporter()
  24109. }, t._loadSegment = function(e, t) {
  24110. this._currentSegmentIndex = e;
  24111. var i = this._mediaDataSource.segments[e],
  24112. r = this._ioctl = new x.a(i, this._config, e);
  24113. r.onError = this._onIOException.bind(this), r.onSeeked = this._onIOSeeked.bind(this), r
  24114. .onComplete = this._onIOComplete.bind(this), r.onRedirect = this._onIORedirect.bind(this), r
  24115. .onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this), t ? this._demuxer.bindDataSource(
  24116. this._ioctl) : r.onDataArrival = this._onInitChunkArrival.bind(this), r.open(t), r
  24117. .loaderChunkArrival = this._loaderChunkArrival.bind(this), r.loaderHLSError = this
  24118. ._loaderHLSError.bind(this)
  24119. }, t._loaderChunkArrival = function(e) {
  24120. this._emitter.emit("loaderChunkArrival", e)
  24121. }, t._loaderHLSError = function() {
  24122. this._emitter.emit("hls_error")
  24123. }, t.stop = function() {
  24124. this._internalAbort(), this._disableStatisticsReporter()
  24125. }, t._internalAbort = function() {
  24126. this._ioctl && (this._ioctl.destroy(), this._ioctl = null)
  24127. }, t.pause = function() {
  24128. this._ioctl && this._ioctl.isWorking() && (this._ioctl.pause(), this._disableStatisticsReporter())
  24129. }, t.resume = function() {
  24130. this._ioctl && this._ioctl.isPaused() && (this._ioctl.resume(), this._enableStatisticsReporter())
  24131. }, t.seek = function(e) {
  24132. if (null != this._mediaInfo && this._mediaInfo.isSeekable()) {
  24133. var t = this._searchSegmentIndexContains(e);
  24134. if (t === this._currentSegmentIndex) {
  24135. var i = this._mediaInfo.segments[t];
  24136. if (null == i) this._pendingSeekTime = e;
  24137. else {
  24138. var r = i.getNearestKeyframe(e);
  24139. this._remuxer.seek(r.milliseconds), this._ioctl.seek(r.fileposition), this
  24140. ._pendingResolveSeekPoint = r.milliseconds
  24141. }
  24142. } else {
  24143. var n = this._mediaInfo.segments[t];
  24144. if (null == n) this._pendingSeekTime = e, this._internalAbort(), this._remuxer.seek(), this
  24145. ._remuxer.insertDiscontinuity(), this._loadSegment(t);
  24146. else {
  24147. var a = n.getNearestKeyframe(e);
  24148. this._internalAbort(), this._remuxer.seek(e), this._remuxer.insertDiscontinuity(), this
  24149. ._demuxer.resetMediaInfo(), this._demuxer.timestampBase = this._mediaDataSource.segments[
  24150. t].timestampBase, this._loadSegment(t, a.fileposition), this._pendingResolveSeekPoint =
  24151. a.milliseconds, this._reportSegmentMediaInfo(t)
  24152. }
  24153. }
  24154. this._enableStatisticsReporter()
  24155. }
  24156. }, t._searchSegmentIndexContains = function(e) {
  24157. for (var t = this._mediaDataSource.segments, i = t.length - 1, r = 0; r < t.length; r++)
  24158. if (e < t[r].timestampBase) {
  24159. i = r - 1;
  24160. break
  24161. } return i
  24162. }, t._onInitChunkArrival = function(e, t) {
  24163. var i = this;
  24164. this._emitter.emit(P.a.RECORDING, e);
  24165. var r = null,
  24166. n = 0;
  24167. if (this._mediaTypeIsHLS) {
  24168. if (null == e && t < 0) return void this._emitter.emit(P.a.RECONNECT_ING, t);
  24169. if (null == e && t > 0) return;
  24170. if (t > 0) this._demuxer.bindDataSource(this._ioctl), this._demuxer.timestampBase = this
  24171. ._mediaDataSource.segments[this._currentSegmentIndex].timestampBase, this._demuxer.append(e,
  24172. t, 0), n = e.length;
  24173. else {
  24174. this._demuxer = new k(this._config), this._remuxer || (this._remuxer = new L(this._config));
  24175. var s = this._mediaDataSource;
  24176. null == s.duration || isNaN(s.duration) || (this._demuxer.overridedDuration = s.duration),
  24177. "boolean" == typeof s.hasAudio && (this._demuxer.overridedHasAudio = s.hasAudio),
  24178. "boolean" == typeof s.hasVideo && (this._demuxer.overridedHasVideo = s.hasVideo), this
  24179. ._demuxer.timestampBase = s.segments[this._currentSegmentIndex].timestampBase, this._demuxer
  24180. .onError = this._onDemuxException.bind(this), this._demuxer.onMediaInfo = this._onMediaInfo
  24181. .bind(this), this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this), this
  24182. ._demuxer.onReceiveH265MediaHLSFrame = this._onReceiveH265MediaFrameFuc, this._demuxer
  24183. .onScriptDataArrived = this._onScriptDataArrived.bind(this), this._remuxer.bindDataSource(
  24184. this._demuxer.bindDataSource(this._ioctl)), this._remuxer.onInitSegment = this
  24185. ._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this
  24186. ._onRemuxerMediaSegmentArrival.bind(this), this._demuxer.append(e, t, 0), n = e.length
  24187. }
  24188. } else if (t > 0) this._demuxer.bindDataSource(this._ioctl), this._demuxer.timestampBase = this
  24189. ._mediaDataSource.segments[this._currentSegmentIndex].timestampBase, n = this._demuxer
  24190. .parseChunks(e, t);
  24191. else if ((r = _.probe(e)).match) {
  24192. this._demuxer = new _(r, this._config), this._remuxer || (this._remuxer = new L(this._config));
  24193. var o = this._mediaDataSource;
  24194. null == o.duration || isNaN(o.duration) || (this._demuxer.overridedDuration = o.duration),
  24195. "boolean" == typeof o.hasAudio && (this._demuxer.overridedHasAudio = o.hasAudio), "boolean" ==
  24196. typeof o.hasVideo && (this._demuxer.overridedHasVideo = o.hasVideo), this._mediaDataSource
  24197. .hasAudio = !1, this._demuxer.timestampBase = o.segments[this._currentSegmentIndex]
  24198. .timestampBase, this._demuxer.onError = this._onDemuxException.bind(this), this._demuxer
  24199. .onMediaInfo = this._onMediaInfo.bind(this), this._demuxer.onMetaDataArrived = this
  24200. ._onMetaDataArrived.bind(this), this._demuxer.onReceiveSEIData = this._onReceiveSEIData.bind(
  24201. this), this._demuxer.onAudioError = this._onAudioError.bind(this), this._demuxer
  24202. .onReceiveH265MediaFLVFrame = this._onReceiveH265MediaFrameFuc, this._demuxer
  24203. .onScriptDataArrived = this._onScriptDataArrived.bind(this), this._remuxer.bindDataSource(this
  24204. ._demuxer.bindDataSource(this._ioctl)), this._remuxer.onInitSegment = this
  24205. ._onRemuxerInitSegmentArrival.bind(this), this._remuxer.onMediaSegment = this
  24206. ._onRemuxerMediaSegmentArrival.bind(this), n = this._demuxer.parseChunks(e, t)
  24207. } else r = null, a.a.e(this.TAG, "Non-FLV, Unsupported media type!"), Promise.resolve().then(
  24208. function() {
  24209. i._internalAbort()
  24210. }), this._emitter.emit(P.a.DEMUX_ERROR, v.a.FORMAT_UNSUPPORTED,
  24211. "Non-FLV, Unsupported media type"), n = 0;
  24212. return n
  24213. }, t._onMediaInfo = function(e) {
  24214. var t = this;
  24215. null == this._mediaInfo && (this._mediaInfo = Object.assign({}, e), this._mediaInfo
  24216. .keyframesIndex = null, this._mediaInfo.segments = [], this._mediaInfo.segmentCount = this
  24217. ._mediaDataSource.segments.length, Object.setPrototypeOf(this._mediaInfo, o.a.prototype));
  24218. var i = Object.assign({}, e);
  24219. Object.setPrototypeOf(i, o.a.prototype), this._mediaInfo.segments[this._currentSegmentIndex] = i,
  24220. this._reportSegmentMediaInfo(this._currentSegmentIndex), null != this._pendingSeekTime &&
  24221. Promise.resolve().then(function() {
  24222. var e = t._pendingSeekTime;
  24223. t._pendingSeekTime = null, t.seek(e)
  24224. })
  24225. }, t._onMetaDataArrived = function(e) {
  24226. this._emitter.emit(P.a.METADATA_ARRIVED, e)
  24227. }, t._onAudioError = function() {
  24228. this._emitter.emit(P.a.AUDIO_ERROR)
  24229. }, t._onReceiveSEIData = function(e) {
  24230. this._emitter.emit(P.a.SEI_DATA, e)
  24231. }, t._onScriptDataArrived = function(e) {
  24232. this._emitter.emit(P.a.SCRIPTDATA_ARRIVED, e)
  24233. }, t._onIOSeeked = function() {
  24234. this._remuxer.insertDiscontinuity()
  24235. }, t._onIOComplete = function(e, t) {
  24236. var i = e + 1;
  24237. i < this._mediaDataSource.segments.length ? (this._internalAbort(), this._remuxer
  24238. .flushStashedSamples(), this._loadSegment(i)) : (t && "socket-close" === t && this._emitter
  24239. .emit(P.a.SOCKET_CLOSE), this._remuxer.flushStashedSamples(), this._emitter.emit(P.a
  24240. .LOADING_COMPLETE), this._disableStatisticsReporter())
  24241. }, t._onIORedirect = function(e) {
  24242. var t = this._ioctl.extraData;
  24243. this._mediaDataSource.segments[t].redirectedURL = e
  24244. }, t._onIORecoveredEarlyEof = function() {
  24245. this._emitter.emit(P.a.RECOVERED_EARLY_EOF)
  24246. }, t._onIOException = function(e, t) {
  24247. a.a.e(this.TAG, "IOException: type = " + e + ", code = " + t.code + ", msg = " + t.msg), this
  24248. ._emitter.emit(P.a.IO_ERROR, e, t), this._disableStatisticsReporter()
  24249. }, t._onDemuxException = function(e, t) {
  24250. a.a.e(this.TAG, "DemuxException: type = " + e + ", info = " + t), this._emitter.emit(P.a
  24251. .DEMUX_ERROR, e, t)
  24252. }, t._onRemuxerInitSegmentArrival = function(e, t) {
  24253. this._emitter.emit(P.a.INIT_SEGMENT, e, t)
  24254. }, t._onRemuxerMediaSegmentArrival = function(e, t) {
  24255. if (null == this._pendingSeekTime && (this._emitter.emit(P.a.MEDIA_SEGMENT, e, t), null != this
  24256. ._pendingResolveSeekPoint && "video" === e)) {
  24257. var i = t.info.syncPoints,
  24258. r = this._pendingResolveSeekPoint;
  24259. this._pendingResolveSeekPoint = null, s.a.safari && i.length > 0 && i[0].originalDts === r && (
  24260. r = i[0].pts), this._emitter.emit(P.a.RECOMMEND_SEEKPOINT, r)
  24261. }
  24262. }, t._enableStatisticsReporter = function() {
  24263. null == this._statisticsReporter && (this._statisticsReporter = self.setInterval(this
  24264. ._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval))
  24265. }, t._disableStatisticsReporter = function() {
  24266. this._statisticsReporter && (self.clearInterval(this._statisticsReporter), this
  24267. ._statisticsReporter = null)
  24268. }, t._reportSegmentMediaInfo = function(e) {
  24269. var t = this._mediaInfo.segments[e],
  24270. i = Object.assign({}, t);
  24271. i.duration = this._mediaInfo.duration, i.segmentCount = this._mediaInfo.segmentCount, delete i
  24272. .segments, delete i.keyframesIndex, this._emitter.emit(P.a.MEDIA_INFO, i)
  24273. }, t._reportStatisticsInfo = function() {
  24274. var e = {};
  24275. e.url = this._ioctl.currentURL, e.hasRedirect = this._ioctl.hasRedirect, e.hasRedirect && (e
  24276. .redirectedURL = this._ioctl.currentRedirectedURL), e.speed = this._ioctl.currentSpeed, e
  24277. .loaderType = this._ioctl.loaderType, e.currentSegmentIndex = this._currentSegmentIndex, e
  24278. .totalSegmentCount = this._mediaDataSource.segments.length, this._emitter.emit(P.a
  24279. .STATISTICS_INFO, e)
  24280. }, t.setReceiveH265MediaFrame = function(e) {
  24281. this._onReceiveH265MediaFrameFuc = e
  24282. }, t._getHLSTotalDuration = function() {
  24283. if (null == this._ioctl) return 0;
  24284. var e = this._ioctl._getM3u8Loader();
  24285. return e ? e._getM3u8TotalDuration() : 0
  24286. }, t._seekToSecs = function(e, t) {
  24287. var i = this._ioctl._getM3u8Loader();
  24288. i && (i.seek(e, t), this._demuxer && this._demuxer.resetMediaPts(1)), this._remuxer && this
  24289. ._remuxer.seek(0), i && this._demuxer && this._demuxer.resetMediaPts(0)
  24290. }, t.videoRecording = function(e, t, i, r, stop) {
  24291. if(this._remuxer) {
  24292. this._remuxer.videoRecording(e, t, i, r, stop)
  24293. }
  24294. }, e
  24295. }());
  24296. t.a = U
  24297. }, function(e, t, i) {
  24298. "use strict";
  24299. var r = i(0);
  24300. function n(e, t) {
  24301. for (var i = 0; i < t.length; i++) {
  24302. var r = t[i];
  24303. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  24304. .defineProperty(e, r.key, r)
  24305. }
  24306. }
  24307. var a = function() {
  24308. function e() {
  24309. this._firstCheckpoint = 0, this._lastCheckpoint = 0, this._intervalBytes = 0, this._totalBytes = 0,
  24310. this._lastSecondBytes = 0, self.performance && self.performance.now ? this._now = self.performance
  24311. .now.bind(self.performance) : this._now = Date.now
  24312. }
  24313. var t, i, r = e.prototype;
  24314. return r.reset = function() {
  24315. this._firstCheckpoint = this._lastCheckpoint = 0, this._totalBytes = this._intervalBytes = 0, this
  24316. ._lastSecondBytes = 0
  24317. }, r.addBytes = function(e) {
  24318. 0 === this._firstCheckpoint ? (this._firstCheckpoint = this._now(), this._lastCheckpoint = this
  24319. ._firstCheckpoint, this._intervalBytes += e, this._totalBytes += e) : this._now() - this
  24320. ._lastCheckpoint < 1e3 ? (this._intervalBytes += e, this._totalBytes += e) : (this
  24321. ._lastSecondBytes = this._intervalBytes, this._intervalBytes = e, this._totalBytes += e, this
  24322. ._lastCheckpoint = this._now())
  24323. }, t = e, (i = [{
  24324. key: "currentKBps",
  24325. get: function() {
  24326. this.addBytes(0);
  24327. var e = (this._now() - this._lastCheckpoint) / 1e3;
  24328. return 0 == e && (e = 1), this._intervalBytes / e / 1024
  24329. }
  24330. }, {
  24331. key: "lastSecondKBps",
  24332. get: function() {
  24333. return this.addBytes(0), 0 !== this._lastSecondBytes ? this._lastSecondBytes / 1024 : this
  24334. ._now() - this._lastCheckpoint >= 500 ? this.currentKBps : 0
  24335. }
  24336. }, {
  24337. key: "averageKBps",
  24338. get: function() {
  24339. var e = (this._now() - this._firstCheckpoint) / 1e3;
  24340. return this._totalBytes / e / 1024
  24341. }
  24342. }]) && n(t.prototype, i), Object.defineProperty(t, "prototype", {
  24343. writable: !1
  24344. }), e
  24345. }(),
  24346. s = i(3),
  24347. o = i(7),
  24348. u = i(4);
  24349. function l(e, t) {
  24350. return (l = Object.setPrototypeOf || function(e, t) {
  24351. return e.__proto__ = t, e
  24352. })(e, t)
  24353. }
  24354. var d = function(e) {
  24355. var t, i;
  24356. function r(t, i) {
  24357. var r;
  24358. return (r = e.call(this, "fetch-stream-loader") || this).TAG = "FetchStreamLoader", r._seekHandler =
  24359. t, r._config = i, r._needStash = !0, r._requestAbort = !1, r._contentLength = null, r
  24360. ._receivedLength = 0, r
  24361. }
  24362. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, l(t, i), r
  24363. .isSupported = function() {
  24364. try {
  24365. var e = o.a.msedge && o.a.version.minor >= 15048,
  24366. t = !o.a.msedge || e;
  24367. return self.fetch && self.ReadableStream && t
  24368. } catch (e) {
  24369. return !1
  24370. }
  24371. };
  24372. var n = r.prototype;
  24373. return n.destroy = function() {
  24374. this.isWorking() && this.abort(), e.prototype.destroy.call(this)
  24375. }, n.open = function(e, t) {
  24376. var i = this;
  24377. this._dataSource = e, this._range = t;
  24378. var r = e.url;
  24379. this._config.reuseRedirectedURL && null != e.redirectedURL && (r = e.redirectedURL);
  24380. var n = this._seekHandler.getConfig(r, t),
  24381. a = new self.Headers;
  24382. if ("object" == typeof n.headers) {
  24383. var o = n.headers;
  24384. for (var l in o) o.hasOwnProperty(l) && a.append(l, o[l])
  24385. }
  24386. var d = {
  24387. method: "GET",
  24388. headers: a,
  24389. mode: "cors",
  24390. cache: "default",
  24391. referrerPolicy: "no-referrer-when-downgrade"
  24392. };
  24393. if ("object" == typeof this._config.headers)
  24394. for (var c in this._config.headers) a.append(c, this._config.headers[c]);
  24395. !1 === e.cors && (d.mode = "same-origin"), e.withCredentials && (d.credentials = "include"), e
  24396. .referrerPolicy && (d.referrerPolicy = e.referrerPolicy), self.AbortController && (this
  24397. ._abortController = new self.AbortController, d.signal = this._abortController.signal), this
  24398. ._status = s.c.kConnecting, self.fetch(n.url, d).then(function(e) {
  24399. if (i._requestAbort) return i._status = s.c.kIdle, void e.body.cancel();
  24400. if (e.ok && e.status >= 200 && e.status <= 299) {
  24401. if (e.url !== n.url && i._onURLRedirect) {
  24402. var t = i._seekHandler.removeURLParameters(e.url);
  24403. i._onURLRedirect(t)
  24404. }
  24405. var r = e.headers.get("Content-Length");
  24406. return null != r && (i._contentLength = parseInt(r), 0 !== i._contentLength && i
  24407. ._onContentLengthKnown && i._onContentLengthKnown(i._contentLength)), i._pump.call(i, e
  24408. .body.getReader())
  24409. }
  24410. if (i._status = s.c.kError, !i._onError) throw new u.d(
  24411. "FetchStreamLoader: Http code invalid, " + e.status + " " + e.statusText);
  24412. i._onError(s.b.HTTP_STATUS_CODE_INVALID, {
  24413. code: e.status,
  24414. msg: e.statusText
  24415. })
  24416. }).catch(function(e) {
  24417. if (!i._abortController || !i._abortController.signal.aborted) {
  24418. if (i._status = s.c.kError, !i._onError) throw e;
  24419. i._onError(s.b.EXCEPTION, {
  24420. code: -1,
  24421. msg: e.message
  24422. })
  24423. }
  24424. })
  24425. }, n.abort = function() {
  24426. if (this._requestAbort = !0, (this._status !== s.c.kBuffering || !o.a.chrome) && this
  24427. ._abortController) try {
  24428. this._abortController.abort()
  24429. } catch (e) {}
  24430. }, n._pump = function(e) {
  24431. var t = this;
  24432. return e.read().then(function(i) {
  24433. if (i.done)
  24434. if (null !== t._contentLength && t._receivedLength < t._contentLength) {
  24435. t._status = s.c.kError;
  24436. var r = s.b.EARLY_EOF,
  24437. n = {
  24438. code: -1,
  24439. msg: "Fetch stream meet Early-EOF"
  24440. };
  24441. if (!t._onError) throw new u.d(n.msg);
  24442. t._onError(r, n)
  24443. } else t._status = s.c.kComplete, t._onComplete && t._onComplete(t._range.from, t._range
  24444. .from + t._receivedLength - 1);
  24445. else {
  24446. if (t._abortController && t._abortController.signal.aborted) return void(t._status = s.c
  24447. .kComplete);
  24448. if (!0 === t._requestAbort) return t._status = s.c.kComplete, e.cancel();
  24449. t._status = s.c.kBuffering;
  24450. var a = i.value.buffer,
  24451. o = t._range.from + t._receivedLength;
  24452. t._receivedLength += a.byteLength, t._onDataArrival && t._onDataArrival(a, o, t
  24453. ._receivedLength), t._pump(e)
  24454. }
  24455. }).catch(function(e) {
  24456. if (t._abortController && t._abortController.signal.aborted) t._status = s.c.kComplete;
  24457. else if (11 !== e.code || !o.a.msedge) {
  24458. t._status = s.c.kError;
  24459. var i = 0,
  24460. r = null;
  24461. if (19 !== e.code && "network error" !== e.message || !(null === t._contentLength ||
  24462. null !== t._contentLength && t._receivedLength < t._contentLength) ? (i = s.b.EXCEPTION,
  24463. r = {
  24464. code: e.code,
  24465. msg: e.message
  24466. }) : (i = s.b.EARLY_EOF, r = {
  24467. code: e.code,
  24468. msg: "Fetch stream meet Early-EOF"
  24469. }), !t._onError) throw new u.d(r.msg);
  24470. t._onError(i, r)
  24471. }
  24472. })
  24473. }, r
  24474. }(s.a),
  24475. c = i(21),
  24476. h = i(1);
  24477. function f(e, t) {
  24478. return (f = Object.setPrototypeOf || function(e, t) {
  24479. return e.__proto__ = t, e
  24480. })(e, t)
  24481. }
  24482. var p = function(e) {
  24483. var t, i;
  24484. function r() {
  24485. var t;
  24486. return (t = e.call(this, "m3u8-loader") || this).TAG = "M3U8Loader", t._needStash = !0, t.url = "", t
  24487. .startPlayTime = 0, t._requestAbort = !1, t._receivedLength = 0, t.getNextFileFlag = !0, t
  24488. .pauseDisplay = !1, t.totalDuration = 0, t.seeking = !1, t.downloadWorker = null, t
  24489. }
  24490. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, f(t, i), r
  24491. .isSupported = function() {
  24492. return !0
  24493. };
  24494. var n = r.prototype;
  24495. return n.destroy = function() {
  24496. this.abort(), e.prototype.destroy.call(this), this.downloadWorker && this.downloadWorker
  24497. .terminate(), this.downloadWorker = null
  24498. }, n.createDownloadWorker = function() {
  24499. if (!this.downloadWorker)
  24500. if ("undefined" != typeof Worker) try {
  24501. this.downloadWorker = c(231), this.onwmsg = this.onWorkerMessage.bind(this);
  24502. var e = {
  24503. cmd: h.w,
  24504. url: this.url,
  24505. time: this.startPlayTime
  24506. };
  24507. this.downloadWorker.postMessage(e), this.downloadWorker.addEventListener("message", this
  24508. .onwmsg), this.downloadWorker.onerror = function(e) {}
  24509. } catch (e) {
  24510. this.downloadWorker && this.downloadWorker.terminate(), this.downloadWorker = null
  24511. } else console.log("Unsupport worker...")
  24512. }, n.setStartPlaySecs = function(e) {
  24513. this.startPlayTime = e
  24514. }, n.open = function(e) {
  24515. try {
  24516. this.url = e.url, this.createDownloadWorker(), this._status = s.c.kConnecting
  24517. } catch (e) {
  24518. this._status = s.c.kError;
  24519. var t = {
  24520. code: e.code,
  24521. msg: e.message
  24522. };
  24523. if (!this._onError) throw new u.d(t.msg);
  24524. this._onError(s.b.EXCEPTION, t)
  24525. }
  24526. }, n.abort = function() {
  24527. var e = {
  24528. cmd: h.l
  24529. };
  24530. this.downloadWorker && void 0 !== this.downloadWorker && this.downloadWorker.postMessage(e), this
  24531. ._status = s.c.kComplete
  24532. }, n._onWebSocketOpen = function(e) {
  24533. this._status = s.c.kBuffering
  24534. }, n._onWebSocketClose = function(e) {
  24535. !0 !== this._requestAbort ? (this._status = s.c.kComplete, this._onComplete && this._onComplete(0,
  24536. this._receivedLength - 1)) : this._requestAbort = !1
  24537. }, n.seek = function(e, t) {
  24538. this.pauseDisplay = !1;
  24539. var i = {
  24540. cmd: h.B,
  24541. type: t,
  24542. time: e
  24543. };
  24544. this.downloadWorker && void 0 !== this.downloadWorker && (this.downloadWorker.postMessage(i), this
  24545. .seeking = !0)
  24546. }, n.pause = function() {
  24547. this.pauseDisplay = !0;
  24548. var e = {
  24549. cmd: h.x
  24550. };
  24551. this.downloadWorker && void 0 !== this.downloadWorker && this.downloadWorker.postMessage(e)
  24552. }, n.resume = function() {
  24553. this.pauseDisplay = !1;
  24554. var e = {
  24555. cmd: h.A
  24556. };
  24557. this.downloadWorker && void 0 !== this.downloadWorker && this.downloadWorker.postMessage(e)
  24558. }, n.onWorkerMessage = function(e) {
  24559. var t = e.data;
  24560. switch (t.cmd) {
  24561. case h.w:
  24562. var i = {
  24563. cmd: h.s,
  24564. t: 0
  24565. };
  24566. this.downloadWorker.postMessage(i);
  24567. break;
  24568. case h.t:
  24569. this.getNextFileFlag = !0;
  24570. break;
  24571. case h.r:
  24572. this.playComplete = !0;
  24573. break;
  24574. case h.o:
  24575. i = {
  24576. cmd: h.y
  24577. }, this.downloadWorker.postMessage(i);
  24578. break;
  24579. case h.l:
  24580. t.workerId == h.b ? (this.downloadWorker && this.downloadWorker.terminate(), this
  24581. .downloadWorker = null) : t.workerId == h.a ? (this.decodeWorker && this.decodeWorker
  24582. .terminate(), this.decodeWorker = null, this.soundPlayer && (this.soundPlayer.destroy(),
  24583. delete this.soundPlayer, this.soundPlayer = null), this.webGLPlayer && this.webGLPlayer
  24584. .renderVideoFrame(null, 0, 0)) : t.workerId == h.f && (this.renderWorker.terminate(), this
  24585. .renderWorker = null);
  24586. break;
  24587. case h.q:
  24588. if (t.workerId == h.b) {
  24589. var r = t.dat,
  24590. n = this._receivedLength;
  24591. this._receivedLength += r.byteLength, this._onDataArrival && this._onDataArrival(r, n, this
  24592. ._receivedLength);
  24593. break
  24594. }
  24595. if (t.workerId == h.a) {
  24596. if (this.pauseDisplay) break;
  24597. 1 == t.mediaType ? (this.canvas.width = t.width, this.canvas.height = t.height, this
  24598. .webGLPlayer.renderVideoFrame(t.dat, t.width, t.height), this.OnUpdatePlayInfo(t
  24599. .playTimeSec, t.frameNum)) : 2 == t.mediaType && (null == this.soundPlayer && this
  24600. .OpenAudioPlayer(t.fmt, t.ch, t.samplerate), null != this.soundPlayer && this.soundPlayer
  24601. .play(t.dat))
  24602. }
  24603. break;
  24604. case h.u:
  24605. this.totalDuration = t.duration, h.i(t.live);
  24606. break;
  24607. case h.s:
  24608. this.pauseDisplay || this.getNextFileFlag && (this.downloadWorker.postMessage(t), this
  24609. .getNextFileFlag = !1);
  24610. break;
  24611. case h.B:
  24612. this.seeking = !1;
  24613. break;
  24614. case h.z:
  24615. this._onDataArrival && (this._receivedLength = 0, this._onDataArrival(null, t.fileSequence, 0));
  24616. break;
  24617. case 404:
  24618. this._onHLSError()
  24619. }
  24620. }, n._dispatchArrayBuffer = function(e) {
  24621. var t = e,
  24622. i = this._receivedLength;
  24623. this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this
  24624. ._receivedLength)
  24625. }, n._onWebSocketError = function(e) {
  24626. this._status = s.c.kError;
  24627. var t = {
  24628. code: e.code,
  24629. msg: e.message
  24630. };
  24631. if (!this._onError) throw new u.d(t.msg);
  24632. this._onError(s.b.EXCEPTION, t)
  24633. }, n._getM3u8TotalDuration = function() {
  24634. return this.totalDuration
  24635. }, r
  24636. }(s.a);
  24637. function m(e, t) {
  24638. return (m = Object.setPrototypeOf || function(e, t) {
  24639. return e.__proto__ = t, e
  24640. })(e, t)
  24641. }
  24642. var g = function(e) {
  24643. var t, i;
  24644. function n(t, i) {
  24645. var r;
  24646. return (r = e.call(this, "xhr-moz-chunked-loader") || this).TAG = "MozChunkedLoader", r._seekHandler =
  24647. t, r._config = i, r._needStash = !0, r._xhr = null, r._requestAbort = !1, r._contentLength = null, r
  24648. ._receivedLength = 0, r
  24649. }
  24650. i = e, (t = n).prototype = Object.create(i.prototype), t.prototype.constructor = t, m(t, i), n
  24651. .isSupported = function() {
  24652. try {
  24653. var e = new XMLHttpRequest;
  24654. return e.open("GET", "https://example.com", !0), e.responseType = "moz-chunked-arraybuffer",
  24655. "moz-chunked-arraybuffer" === e.responseType
  24656. } catch (e) {
  24657. return r.a.w("MozChunkedLoader", e.message), !1
  24658. }
  24659. };
  24660. var a = n.prototype;
  24661. return a.destroy = function() {
  24662. this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr
  24663. .onprogress = null, this._xhr.onloadend = null, this._xhr.onerror = null, this._xhr = null), e
  24664. .prototype.destroy.call(this)
  24665. }, a.open = function(e, t) {
  24666. this._dataSource = e, this._range = t;
  24667. var i = e.url;
  24668. this._config.reuseRedirectedURL && null != e.redirectedURL && (i = e.redirectedURL);
  24669. var r = this._seekHandler.getConfig(i, t);
  24670. this._requestURL = r.url;
  24671. var n = this._xhr = new XMLHttpRequest;
  24672. if (n.open("GET", r.url, !0), n.responseType = "moz-chunked-arraybuffer", n.onreadystatechange =
  24673. this._onReadyStateChange.bind(this), n.onprogress = this._onProgress.bind(this), n.onloadend =
  24674. this._onLoadEnd.bind(this), n.onerror = this._onXhrError.bind(this), e.withCredentials && (n
  24675. .withCredentials = !0), "object" == typeof r.headers) {
  24676. var a = r.headers;
  24677. for (var o in a) a.hasOwnProperty(o) && n.setRequestHeader(o, a[o])
  24678. }
  24679. if ("object" == typeof this._config.headers) {
  24680. var u = this._config.headers;
  24681. for (var l in u) u.hasOwnProperty(l) && n.setRequestHeader(l, u[l])
  24682. }
  24683. this._status = s.c.kConnecting, n.send()
  24684. }, a.abort = function() {
  24685. this._requestAbort = !0, this._xhr && this._xhr.abort(), this._status = s.c.kComplete
  24686. }, a._onReadyStateChange = function(e) {
  24687. var t = e.target;
  24688. if (2 === t.readyState) {
  24689. if (null != t.responseURL && t.responseURL !== this._requestURL && this._onURLRedirect) {
  24690. var i = this._seekHandler.removeURLParameters(t.responseURL);
  24691. this._onURLRedirect(i)
  24692. }
  24693. if (0 !== t.status && (t.status < 200 || t.status > 299)) {
  24694. if (this._status = s.c.kError, !this._onError) throw new u.d(
  24695. "MozChunkedLoader: Http code invalid, " + t.status + " " + t.statusText);
  24696. this._onError(s.b.HTTP_STATUS_CODE_INVALID, {
  24697. code: t.status,
  24698. msg: t.statusText
  24699. })
  24700. } else this._status = s.c.kBuffering
  24701. }
  24702. }, a._onProgress = function(e) {
  24703. if (this._status !== s.c.kError) {
  24704. null === this._contentLength && null !== e.total && 0 !== e.total && (this._contentLength = e
  24705. .total, this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength));
  24706. var t = e.target.response,
  24707. i = this._range.from + this._receivedLength;
  24708. this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this
  24709. ._receivedLength)
  24710. }
  24711. }, a._onLoadEnd = function(e) {
  24712. !0 !== this._requestAbort ? this._status !== s.c.kError && (this._status = s.c.kComplete, this
  24713. ._onComplete && this._onComplete(this._range.from, this._range.from + this._receivedLength - 1)
  24714. ) : this._requestAbort = !1
  24715. }, a._onXhrError = function(e) {
  24716. this._status = s.c.kError;
  24717. var t = 0,
  24718. i = null;
  24719. if (this._contentLength && e.loaded < this._contentLength ? (t = s.b.EARLY_EOF, i = {
  24720. code: -1,
  24721. msg: "Moz-Chunked stream meet Early-Eof"
  24722. }) : (t = s.b.EXCEPTION, i = {
  24723. code: -1,
  24724. msg: e.constructor.name + " " + e.type
  24725. }), !this._onError) throw new u.d(i.msg);
  24726. this._onError(t, i)
  24727. }, n
  24728. }(s.a);
  24729. function v(e, t) {
  24730. for (var i = 0; i < t.length; i++) {
  24731. var r = t[i];
  24732. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  24733. .defineProperty(e, r.key, r)
  24734. }
  24735. }
  24736. function y(e, t) {
  24737. return (y = Object.setPrototypeOf || function(e, t) {
  24738. return e.__proto__ = t, e
  24739. })(e, t)
  24740. }
  24741. s.a;
  24742. var _ = function(e) {
  24743. var t, i;
  24744. function n(t, i) {
  24745. var r;
  24746. return (r = e.call(this, "xhr-range-loader") || this).TAG = "RangeLoader", r._seekHandler = t, r
  24747. ._config = i, r._needStash = !1, r._chunkSizeKBList = [128, 256, 384, 512, 768, 1024, 1536, 2048,
  24748. 3072, 4096, 5120, 6144, 7168, 8192
  24749. ], r._currentChunkSizeKB = 384, r._currentSpeedNormalized = 0, r._zeroSpeedChunkCount = 0, r._xhr =
  24750. null, r._speedSampler = new a, r._requestAbort = !1, r._waitForTotalLength = !1, r
  24751. ._totalLengthReceived = !1, r._currentRequestURL = null, r._currentRedirectedURL = null, r
  24752. ._currentRequestRange = null, r._totalLength = null, r._contentLength = null, r._receivedLength = 0,
  24753. r._lastTimeLoaded = 0, r
  24754. }
  24755. i = e, (t = n).prototype = Object.create(i.prototype), t.prototype.constructor = t, y(t, i), n
  24756. .isSupported = function() {
  24757. try {
  24758. var e = new XMLHttpRequest;
  24759. return e.open("GET", "https://example.com", !0), e.responseType = "arraybuffer", "arraybuffer" ===
  24760. e.responseType
  24761. } catch (e) {
  24762. return r.a.w("RangeLoader", e.message), !1
  24763. }
  24764. };
  24765. var o, l, d = n.prototype;
  24766. return d.destroy = function() {
  24767. this.isWorking() && this.abort(), this._xhr && (this._xhr.onreadystatechange = null, this._xhr
  24768. .onprogress = null, this._xhr.onload = null, this._xhr.onerror = null, this._xhr = null), e
  24769. .prototype.destroy.call(this)
  24770. }, d.open = function(e, t) {
  24771. this._dataSource = e, this._range = t, this._status = s.c.kConnecting;
  24772. var i = !1;
  24773. null != this._dataSource.filesize && 0 !== this._dataSource.filesize && (i = !0, this._totalLength =
  24774. this._dataSource.filesize), this._totalLengthReceived || i ? this._openSubRange() : (this
  24775. ._waitForTotalLength = !0, this._internalOpen(this._dataSource, {
  24776. from: 0,
  24777. to: -1
  24778. }))
  24779. }, d._openSubRange = function() {
  24780. var e = 1024 * this._currentChunkSizeKB,
  24781. t = this._range.from + this._receivedLength,
  24782. i = t + e;
  24783. null != this._contentLength && i - this._range.from >= this._contentLength && (i = this._range
  24784. .from + this._contentLength - 1), this._currentRequestRange = {
  24785. from: t,
  24786. to: i
  24787. }, this._internalOpen(this._dataSource, this._currentRequestRange)
  24788. }, d._internalOpen = function(e, t) {
  24789. this._lastTimeLoaded = 0;
  24790. var i = e.url;
  24791. this._config.reuseRedirectedURL && (null != this._currentRedirectedURL ? i = this
  24792. ._currentRedirectedURL : null != e.redirectedURL && (i = e.redirectedURL));
  24793. var r = this._seekHandler.getConfig(i, t);
  24794. this._currentRequestURL = r.url;
  24795. var n = this._xhr = new XMLHttpRequest;
  24796. if (n.open("GET", r.url, !0), n.responseType = "arraybuffer", n.onreadystatechange = this
  24797. ._onReadyStateChange.bind(this), n.onprogress = this._onProgress.bind(this), n.onload = this
  24798. ._onLoad.bind(this), n.onerror = this._onXhrError.bind(this), e.withCredentials && (n
  24799. .withCredentials = !0), "object" == typeof r.headers) {
  24800. var a = r.headers;
  24801. for (var s in a) a.hasOwnProperty(s) && n.setRequestHeader(s, a[s])
  24802. }
  24803. if ("object" == typeof this._config.headers) {
  24804. var o = this._config.headers;
  24805. for (var u in o) o.hasOwnProperty(u) && n.setRequestHeader(u, o[u])
  24806. }
  24807. n.send()
  24808. }, d.abort = function() {
  24809. this._requestAbort = !0, this._internalAbort(), this._status = s.c.kComplete
  24810. }, d._internalAbort = function() {
  24811. this._xhr && (this._xhr.onreadystatechange = null, this._xhr.onprogress = null, this._xhr.onload =
  24812. null, this._xhr.onerror = null, this._xhr.abort(), this._xhr = null)
  24813. }, d._onReadyStateChange = function(e) {
  24814. var t = e.target;
  24815. if (2 === t.readyState) {
  24816. if (null != t.responseURL) {
  24817. var i = this._seekHandler.removeURLParameters(t.responseURL);
  24818. t.responseURL !== this._currentRequestURL && i !== this._currentRedirectedURL && (this
  24819. ._currentRedirectedURL = i, this._onURLRedirect && this._onURLRedirect(i))
  24820. }
  24821. if (t.status >= 200 && t.status <= 299) {
  24822. if (this._waitForTotalLength) return;
  24823. this._status = s.c.kBuffering
  24824. } else {
  24825. if (this._status = s.c.kError, !this._onError) throw new u.d(
  24826. "RangeLoader: Http code invalid, " + t.status + " " + t.statusText);
  24827. this._onError(s.b.HTTP_STATUS_CODE_INVALID, {
  24828. code: t.status,
  24829. msg: t.statusText
  24830. })
  24831. }
  24832. }
  24833. }, d._onProgress = function(e) {
  24834. if (this._status !== s.c.kError) {
  24835. if (null === this._contentLength) {
  24836. var t = !1;
  24837. if (this._waitForTotalLength) {
  24838. this._waitForTotalLength = !1, this._totalLengthReceived = !0, t = !0;
  24839. var i = e.total;
  24840. this._internalAbort(), null != i & 0 !== i && (this._totalLength = i)
  24841. }
  24842. if (-1 === this._range.to ? this._contentLength = this._totalLength - this._range.from : this
  24843. ._contentLength = this._range.to - this._range.from + 1, t) return void this._openSubRange();
  24844. this._onContentLengthKnown && this._onContentLengthKnown(this._contentLength)
  24845. }
  24846. var r = e.loaded - this._lastTimeLoaded;
  24847. this._lastTimeLoaded = e.loaded, this._speedSampler.addBytes(r)
  24848. }
  24849. }, d._normalizeSpeed = function(e) {
  24850. var t = this._chunkSizeKBList,
  24851. i = t.length - 1,
  24852. r = 0,
  24853. n = 0,
  24854. a = i;
  24855. if (e < t[0]) return t[0];
  24856. for (; n <= a;) {
  24857. if ((r = n + Math.floor((a - n) / 2)) === i || e >= t[r] && e < t[r + 1]) return t[r];
  24858. t[r] < e ? n = r + 1 : a = r - 1
  24859. }
  24860. }, d._onLoad = function(e) {
  24861. if (this._status !== s.c.kError)
  24862. if (this._waitForTotalLength) this._waitForTotalLength = !1;
  24863. else {
  24864. this._lastTimeLoaded = 0;
  24865. var t = this._speedSampler.lastSecondKBps;
  24866. if (0 === t && (this._zeroSpeedChunkCount++, this._zeroSpeedChunkCount >= 3 && (t = this
  24867. ._speedSampler.currentKBps)), 0 !== t) {
  24868. var i = this._normalizeSpeed(t);
  24869. this._currentSpeedNormalized !== i && (this._currentSpeedNormalized = i, this
  24870. ._currentChunkSizeKB = i)
  24871. }
  24872. var r = e.target.response,
  24873. n = this._range.from + this._receivedLength;
  24874. this._receivedLength += r.byteLength;
  24875. var a = !1;
  24876. null != this._contentLength && this._receivedLength < this._contentLength ? this
  24877. ._openSubRange() : a = !0, this._onDataArrival && this._onDataArrival(r, n, this
  24878. ._receivedLength), a && (this._status = s.c.kComplete, this._onComplete && this._onComplete(
  24879. this._range.from, this._range.from + this._receivedLength - 1))
  24880. }
  24881. }, d._onXhrError = function(e) {
  24882. this._status = s.c.kError;
  24883. var t = 0,
  24884. i = null;
  24885. if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength ?
  24886. (t = s.b.EARLY_EOF, i = {
  24887. code: -1,
  24888. msg: "RangeLoader meet Early-Eof"
  24889. }) : (t = s.b.EXCEPTION, i = {
  24890. code: -1,
  24891. msg: e.constructor.name + " " + e.type
  24892. }), !this._onError) throw new u.d(i.msg);
  24893. this._onError(t, i)
  24894. }, o = n, (l = [{
  24895. key: "currentSpeed",
  24896. get: function() {
  24897. return this._speedSampler.lastSecondKBps
  24898. }
  24899. }]) && v(o.prototype, l), Object.defineProperty(o, "prototype", {
  24900. writable: !1
  24901. }), n
  24902. }(s.a);
  24903. function b(e, t) {
  24904. return (b = Object.setPrototypeOf || function(e, t) {
  24905. return e.__proto__ = t, e
  24906. })(e, t)
  24907. }
  24908. var w = function(e) {
  24909. var t, i;
  24910. function r() {
  24911. var t;
  24912. return (t = e.call(this, "websocket-loader") || this).TAG = "WebSocketLoader", t._needStash = !0, t
  24913. ._ws = null, t._requestAbort = !1, t._receivedLength = 0, t
  24914. }
  24915. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, b(t, i), r
  24916. .isSupported = function() {
  24917. try {
  24918. return void 0 !== self.WebSocket
  24919. } catch (e) {
  24920. return !1
  24921. }
  24922. };
  24923. var n = r.prototype;
  24924. return n.destroy = function() {
  24925. this._ws && this.abort(), e.prototype.destroy.call(this)
  24926. }, n.open = function(e) {
  24927. try {
  24928. var t = this._ws = new self.WebSocket(e.url);
  24929. t.binaryType = "arraybuffer", t.onopen = this._onWebSocketOpen.bind(this), t.onclose = this
  24930. ._onWebSocketClose.bind(this), t.onmessage = this._onWebSocketMessage.bind(this), t.onerror =
  24931. this._onWebSocketError.bind(this), this._status = s.c.kConnecting
  24932. } catch (e) {
  24933. this._status = s.c.kError;
  24934. var i = {
  24935. code: e.code,
  24936. msg: e.message
  24937. };
  24938. if (!this._onError) throw new u.d(i.msg);
  24939. this._onError(s.b.EXCEPTION, i)
  24940. }
  24941. }, n.abort = function() {
  24942. var e = this._ws;
  24943. !e || 0 !== e.readyState && 1 !== e.readyState || (this._requestAbort = !0, e.close()), this._ws =
  24944. null, this._status = s.c.kComplete
  24945. }, n._onWebSocketOpen = function(e) {
  24946. this._status = s.c.kBuffering
  24947. }, n._onWebSocketClose = function(e) {
  24948. !0 !== this._requestAbort ? (this._status = s.c.kComplete, this._onComplete && this._onComplete(0,
  24949. this._receivedLength - 1, "socket-close")) : this._requestAbort = !1
  24950. }, n._onWebSocketMessage = function(e) {
  24951. var t = this;
  24952. if (e.data instanceof ArrayBuffer) this._dispatchArrayBuffer(e.data);
  24953. else if (e.data instanceof Blob) {
  24954. var i = new FileReader;
  24955. i.onload = function() {
  24956. t._dispatchArrayBuffer(i.result)
  24957. }, i.readAsArrayBuffer(e.data)
  24958. } else {
  24959. this._status = s.c.kError;
  24960. var r = {
  24961. code: -1,
  24962. msg: "Unsupported WebSocket message type: " + e.data.constructor.name
  24963. };
  24964. if (!this._onError) throw new u.d(r.msg);
  24965. this._onError(s.b.EXCEPTION, r)
  24966. }
  24967. }, n._dispatchArrayBuffer = function(e) {
  24968. var t = e,
  24969. i = this._receivedLength;
  24970. this._receivedLength += t.byteLength, this._onDataArrival && this._onDataArrival(t, i, this
  24971. ._receivedLength)
  24972. }, n._onWebSocketError = function(e) {
  24973. this._status = s.c.kError;
  24974. var t = {
  24975. code: e.code,
  24976. msg: e.message
  24977. };
  24978. if (!this._onError) throw new u.d(t.msg);
  24979. this._onError(s.b.EXCEPTION, t)
  24980. }, r
  24981. }(s.a),
  24982. E = function() {
  24983. function e(e) {
  24984. this._zeroStart = e || !1
  24985. }
  24986. var t = e.prototype;
  24987. return t.getConfig = function(e, t) {
  24988. var i, r = {};
  24989. return 0 !== t.from || -1 !== t.to ? (i = -1 !== t.to ? "bytes=" + t.from.toString() + "-" + t.to
  24990. .toString() : "bytes=" + t.from.toString() + "-", r.Range = i) : this._zeroStart && (r.Range =
  24991. "bytes=0-"), {
  24992. url: e,
  24993. headers: r
  24994. }
  24995. }, t.removeURLParameters = function(e) {
  24996. return e
  24997. }, e
  24998. }(),
  24999. T = function() {
  25000. function e(e, t) {
  25001. this._startName = e, this._endName = t
  25002. }
  25003. var t = e.prototype;
  25004. return t.getConfig = function(e, t) {
  25005. var i = e;
  25006. if (0 !== t.from || -1 !== t.to) {
  25007. var r = !0; - 1 === i.indexOf("?") && (i += "?", r = !1), r && (i += "&"), i += this._startName +
  25008. "=" + t.from.toString(), -1 !== t.to && (i += "&" + this._endName + "=" + t.to.toString())
  25009. }
  25010. return {
  25011. url: i,
  25012. headers: {}
  25013. }
  25014. }, t.removeURLParameters = function(e) {
  25015. var t = e.split("?")[0],
  25016. i = void 0,
  25017. r = e.indexOf("?"); - 1 !== r && (i = e.substring(r + 1));
  25018. var n = "";
  25019. if (null != i && i.length > 0)
  25020. for (var a = i.split("&"), s = 0; s < a.length; s++) {
  25021. var o = a[s].split("="),
  25022. u = s > 0;
  25023. o[0] !== this._startName && o[0] !== this._endName && (u && (n += "&"), n += a[s])
  25024. }
  25025. return 0 === n.length ? t : t + "?" + n
  25026. }, e
  25027. }(),
  25028. S = i(8),
  25029. A = i.n(S);
  25030. function k(e, t) {
  25031. for (var i = 0; i < t.length; i++) {
  25032. var r = t[i];
  25033. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  25034. .defineProperty(e, r.key, r)
  25035. }
  25036. }
  25037. var R = function() {
  25038. function e(e, t, i) {
  25039. this.TAG = "IOController", this._emitter = new A.a, this._config = t, this._extraData = i, this
  25040. ._stashInitialSize = 393216, null != t.stashInitialSize && t.stashInitialSize > 0 && (this
  25041. ._stashInitialSize = t.stashInitialSize), this._stashUsed = 0, this._stashSize = this
  25042. ._stashInitialSize, this._bufferSize = 3145728, this._stashBuffer = new ArrayBuffer(this
  25043. ._bufferSize), this._stashByteStart = 0, this._enableStash = !0, !1 === t.enableStashBuffer && (
  25044. this._enableStash = !1), this._loader = null, this._loaderClass = null, this._seekHandler = null,
  25045. this._dataSource = e, this._isWebSocketURL = /wss?:\/\/(.+?)/.test(e.url), this._isHLSURL = e.url &&
  25046. e.url.includes(".m3u8"), this._refTotalLength = e.filesize ? e.filesize : null, this._totalLength =
  25047. this._refTotalLength, this._fullRequestFlag = !1, this._currentRange = null, this._redirectedURL =
  25048. null, this._speedNormalized = 0, this._speedSampler = new a, this._speedNormalizeList = [64, 128,
  25049. 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096
  25050. ], this._isEarlyEofReconnecting = !1, this._paused = !1, this._resumeFrom = 0, this._onDataArrival =
  25051. null, this._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null,
  25052. this._onRecoveredEarlyEof = null, this._loaderChunkArrival = null, this._loaderHLSError = null, this
  25053. ._selectSeekHandler(), this._selectLoader(), this._createLoader()
  25054. }
  25055. var t, i, n = e.prototype;
  25056. return n.destroy = function() {
  25057. this._loader.isWorking() && this._loader.abort(), this._loader.destroy(), this._loader = null, this
  25058. ._loaderClass = null, this._dataSource = null, this._stashBuffer = null, this._stashUsed = this
  25059. ._stashSize = this._bufferSize = this._stashByteStart = 0, this._currentRange = null, this
  25060. ._speedSampler = null, this._isEarlyEofReconnecting = !1, this._onDataArrival = null, this
  25061. ._onSeeked = null, this._onError = null, this._onComplete = null, this._onRedirect = null, this
  25062. ._onRecoveredEarlyEof = null, this._loaderChunkArrival = null, this._loaderHLSError = null, this
  25063. ._extraData = null
  25064. }, n.isWorking = function() {
  25065. return this._loader && this._loader.isWorking() && !this._paused
  25066. }, n.isPaused = function() {
  25067. return this._paused
  25068. }, n._selectSeekHandler = function() {
  25069. var e = this._config;
  25070. if ("range" === e.seekType) this._seekHandler = new E(this._config.rangeLoadZeroStart);
  25071. else if ("param" === e.seekType) {
  25072. var t = e.seekParamStart || "bstart",
  25073. i = e.seekParamEnd || "bend";
  25074. this._seekHandler = new T(t, i)
  25075. } else {
  25076. if ("custom" !== e.seekType) throw new u.b("Invalid seekType in config: " + e.seekType);
  25077. if ("function" != typeof e.customSeekHandler) throw new u.b(
  25078. "Custom seekType specified in config but invalid customSeekHandler!");
  25079. this._seekHandler = new e.customSeekHandler
  25080. }
  25081. }, n._selectLoader = function() {
  25082. if (null != this._config.customLoader) this._loaderClass = this._config.customLoader;
  25083. else if (this._isHLSURL) this._loaderClass = p;
  25084. else if (this._isWebSocketURL) this._loaderClass = w;
  25085. else if (d.isSupported()) this._loaderClass = d;
  25086. else if (g.isSupported()) this._loaderClass = g;
  25087. else {
  25088. if (!_.isSupported()) throw new u.d(
  25089. "Your browser doesn't support xhr with arraybuffer responseType!");
  25090. this._loaderClass = _
  25091. }
  25092. }, n._createLoader = function() {
  25093. this._loader = new this._loaderClass(this._seekHandler, this._config), !1 === this._loader
  25094. .needStashBuffer && (this._enableStash = !1), this._loader.onContentLengthKnown = this
  25095. ._onContentLengthKnown.bind(this), this._loader.onURLRedirect = this._onURLRedirect.bind(this),
  25096. this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this), this._loader.onComplete = this
  25097. ._onLoaderComplete.bind(this), this._loader.onError = this._onLoaderError.bind(this), this._loader
  25098. .onHLSError = this._onLoaderHLSError.bind(this)
  25099. }, n.open = function(e) {
  25100. this._currentRange = {
  25101. from: 0,
  25102. to: -1
  25103. }, e && (this._currentRange.from = e), this._speedSampler.reset(), e || (this._fullRequestFlag = !
  25104. 0), this._loader.open(this._dataSource, Object.assign({}, this._currentRange))
  25105. }, n.abort = function() {
  25106. this._loader.abort(), this._paused && (this._paused = !1, this._resumeFrom = 0)
  25107. }, n.pause = function() {
  25108. this.isWorking() && (this._loader.abort(), 0 !== this._stashUsed ? (this._resumeFrom = this
  25109. ._stashByteStart, this._currentRange.to = this._stashByteStart - 1) : this._resumeFrom = this
  25110. ._currentRange.to + 1, this._stashUsed = 0, this._stashByteStart = 0, this._paused = !0)
  25111. }, n.resume = function() {
  25112. if (this._paused) {
  25113. this._paused = !1;
  25114. var e = this._resumeFrom;
  25115. this._resumeFrom = 0, this._internalSeek(e, !0)
  25116. }
  25117. }, n.seek = function(e) {
  25118. this._paused = !1, this._stashUsed = 0, this._stashByteStart = 0, this._internalSeek(e, !0)
  25119. }, n._internalSeek = function(e, t) {
  25120. this._loader.isWorking() && this._loader.abort(), this._flushStashBuffer(t), this._loader.destroy(),
  25121. this._loader = null;
  25122. var i = {
  25123. from: e,
  25124. to: -1
  25125. };
  25126. this._currentRange = {
  25127. from: i.from,
  25128. to: -1
  25129. }, this._speedSampler.reset(), this._stashSize = this._stashInitialSize, this._createLoader(),
  25130. this._loader.open(this._dataSource, i), this._onSeeked && this._onSeeked()
  25131. }, n.updateUrl = function(e) {
  25132. if (!e || "string" != typeof e || 0 === e.length) throw new u.b("Url must be a non-empty string!");
  25133. this._dataSource.url = e
  25134. }, n._expandBuffer = function(e) {
  25135. for (var t = this._stashSize; t + 1048576 < e;) t *= 2;
  25136. if ((t += 1048576) !== this._bufferSize) {
  25137. var i = new ArrayBuffer(t);
  25138. if (this._stashUsed > 0) {
  25139. var r = new Uint8Array(this._stashBuffer, 0, this._stashUsed);
  25140. new Uint8Array(i, 0, t).set(r, 0)
  25141. }
  25142. this._stashBuffer = i, this._bufferSize = t
  25143. }
  25144. }, n._normalizeSpeed = function(e) {
  25145. var t = this._speedNormalizeList,
  25146. i = t.length - 1,
  25147. r = 0,
  25148. n = 0,
  25149. a = i;
  25150. if (e < t[0]) return t[0];
  25151. for (; n <= a;) {
  25152. if ((r = n + Math.floor((a - n) / 2)) === i || e >= t[r] && e < t[r + 1]) return t[r];
  25153. t[r] < e ? n = r + 1 : a = r - 1
  25154. }
  25155. }, n._adjustStashSize = function(e) {
  25156. var t = 0;
  25157. (t = this._config.isLive || e < 512 ? e : e >= 512 && e <= 1024 ? Math.floor(1.5 * e) : 2 * e) >
  25158. 8192 && (t = 8192);
  25159. var i = 1024 * t + 1048576;
  25160. this._bufferSize < i && this._expandBuffer(i), this._stashSize = 1024 * t
  25161. }, n._dispatchChunks = function(e, t) {
  25162. return this._currentRange.to = t + e.byteLength - 1, this._onDataArrival(e, t)
  25163. }, n._onURLRedirect = function(e) {
  25164. this._redirectedURL = e, this._onRedirect && this._onRedirect(e)
  25165. }, n._onContentLengthKnown = function(e) {
  25166. e && this._fullRequestFlag && (this._totalLength = e, this._fullRequestFlag = !1)
  25167. }, n._onLoaderChunkArrival = function(e, t, i) {
  25168. if (this._loaderChunkArrival && this._loaderChunkArrival(e), !this._onDataArrival) throw new u.a(
  25169. "IOController: No existing consumer (onDataArrival) callback!");
  25170. if (!this._paused && (this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, this
  25171. ._onRecoveredEarlyEof && this._onRecoveredEarlyEof()), e)) {
  25172. this._speedSampler.addBytes(e.byteLength);
  25173. var r = this._speedSampler.lastSecondKBps;
  25174. if (0 !== r) {
  25175. var n = this._normalizeSpeed(r);
  25176. this._speedNormalized !== n && (this._speedNormalized = n, this._adjustStashSize(n))
  25177. }
  25178. if (this._isHLSURL && (this._enableStash = !1), this._enableStash)
  25179. if (0 === this._stashUsed && 0 === this._stashByteStart && (this._stashByteStart = t), this
  25180. ._stashUsed + e.byteLength <= this._stashSize) new Uint8Array(this._stashBuffer, 0, this
  25181. ._stashSize).set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength;
  25182. else {
  25183. var a = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  25184. if (this._stashUsed > 0) {
  25185. var s = this._stashBuffer.slice(0, this._stashUsed),
  25186. o = this._dispatchChunks(s, this._stashByteStart);
  25187. if (o < s.byteLength) {
  25188. if (o > 0) {
  25189. var l = new Uint8Array(s, o);
  25190. a.set(l, 0), this._stashUsed = l.byteLength, this._stashByteStart += o
  25191. }
  25192. } else this._stashUsed = 0, this._stashByteStart += o;
  25193. this._stashUsed + e.byteLength > this._bufferSize && (this._expandBuffer(this._stashUsed + e
  25194. .byteLength), a = new Uint8Array(this._stashBuffer, 0, this._bufferSize)), a.set(
  25195. new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength
  25196. } else {
  25197. var d = this._dispatchChunks(e, t);
  25198. if (d < e.byteLength) {
  25199. var c = e.byteLength - d;
  25200. c > this._bufferSize && (this._expandBuffer(c), a = new Uint8Array(this._stashBuffer, 0,
  25201. this._bufferSize)), a.set(new Uint8Array(e, d), 0), this._stashUsed += c, this
  25202. ._stashByteStart = t + d
  25203. }
  25204. }
  25205. }
  25206. else if (0 === this._stashUsed) {
  25207. var h = this._dispatchChunks(e, t);
  25208. if (h < e.byteLength) {
  25209. var f = e.byteLength - h;
  25210. f > this._bufferSize && this._expandBuffer(f), new Uint8Array(this._stashBuffer, 0, this
  25211. ._bufferSize).set(new Uint8Array(e, h), 0), this._stashUsed += f, this._stashByteStart =
  25212. t + h
  25213. }
  25214. } else {
  25215. this._stashUsed + e.byteLength > this._bufferSize && this._expandBuffer(this._stashUsed + e
  25216. .byteLength);
  25217. var p = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  25218. p.set(new Uint8Array(e), this._stashUsed), this._stashUsed += e.byteLength;
  25219. var m = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart);
  25220. if (m < this._stashUsed && m > 0) {
  25221. var g = new Uint8Array(this._stashBuffer, m);
  25222. p.set(g, 0)
  25223. }
  25224. this._stashUsed -= m, this._stashByteStart += m
  25225. }
  25226. }
  25227. }, n._flushStashBuffer = function(e) {
  25228. if (this._stashUsed > 0) {
  25229. var t = this._stashBuffer.slice(0, this._stashUsed),
  25230. i = this._dispatchChunks(t, this._stashByteStart),
  25231. n = t.byteLength - i;
  25232. if (i < t.byteLength) {
  25233. if (!e) {
  25234. if (i > 0) {
  25235. var a = new Uint8Array(this._stashBuffer, 0, this._bufferSize),
  25236. s = new Uint8Array(t, i);
  25237. a.set(s, 0), this._stashUsed = s.byteLength, this._stashByteStart += i
  25238. }
  25239. return 0
  25240. }
  25241. r.a.w(this.TAG, n + " bytes unconsumed data remain when flush buffer, dropped")
  25242. }
  25243. return this._stashUsed = 0, this._stashByteStart = 0, n
  25244. }
  25245. return 0
  25246. }, n._onLoaderComplete = function(e, t, i) {
  25247. this._flushStashBuffer(!0), this._onComplete && this._onComplete(this._extraData, i)
  25248. }, n._onLoaderHLSError = function() {
  25249. this._loaderHLSError()
  25250. }, n._onLoaderError = function(e, t) {
  25251. switch (r.a.e(this.TAG, "Loader error, code = " + t.code + ", msg = " + t.msg), this
  25252. ._flushStashBuffer(!1), this._isEarlyEofReconnecting && (this._isEarlyEofReconnecting = !1, e = s
  25253. .b.UNRECOVERABLE_EARLY_EOF), e) {
  25254. case s.b.EARLY_EOF:
  25255. if (!this._config.isLive && this._totalLength) {
  25256. var i = this._currentRange.to + 1;
  25257. return void(i < this._totalLength && (r.a.w(this.TAG, "Connection lost, trying reconnect..."),
  25258. this._isEarlyEofReconnecting = !0, this._internalSeek(i, !1)))
  25259. }
  25260. e = s.b.UNRECOVERABLE_EARLY_EOF;
  25261. break;
  25262. case s.b.UNRECOVERABLE_EARLY_EOF:
  25263. case s.b.CONNECTING_TIMEOUT:
  25264. case s.b.HTTP_STATUS_CODE_INVALID:
  25265. case s.b.EXCEPTION:
  25266. }
  25267. if (!this._onError) throw new u.d("IOException: " + t.msg);
  25268. this._onError(e, t)
  25269. }, n._getM3u8Loader = function() {
  25270. return this._isHLSURL ? this._loader : null
  25271. }, t = e, (i = [{
  25272. key: "status",
  25273. get: function() {
  25274. return this._loader.status
  25275. }
  25276. }, {
  25277. key: "extraData",
  25278. get: function() {
  25279. return this._extraData
  25280. },
  25281. set: function(e) {
  25282. this._extraData = e
  25283. }
  25284. }, {
  25285. key: "onDataArrival",
  25286. get: function() {
  25287. return this._onDataArrival
  25288. },
  25289. set: function(e) {
  25290. this._onDataArrival = e
  25291. }
  25292. }, {
  25293. key: "loaderChunkArrival",
  25294. get: function() {
  25295. return this._loaderChunkArrival
  25296. },
  25297. set: function(e) {
  25298. this._loaderChunkArrival = e
  25299. }
  25300. }, {
  25301. key: "loaderHLSError",
  25302. get: function() {
  25303. return this._loaderHLSError
  25304. },
  25305. set: function(e) {
  25306. this._loaderHLSError = e
  25307. }
  25308. }, {
  25309. key: "onSeeked",
  25310. get: function() {
  25311. return this._onSeeked
  25312. },
  25313. set: function(e) {
  25314. this._onSeeked = e
  25315. }
  25316. }, {
  25317. key: "onError",
  25318. get: function() {
  25319. return this._onError
  25320. },
  25321. set: function(e) {
  25322. this._onError = e
  25323. }
  25324. }, {
  25325. key: "onComplete",
  25326. get: function() {
  25327. return this._onComplete
  25328. },
  25329. set: function(e) {
  25330. this._onComplete = e
  25331. }
  25332. }, {
  25333. key: "onRedirect",
  25334. get: function() {
  25335. return this._onRedirect
  25336. },
  25337. set: function(e) {
  25338. this._onRedirect = e
  25339. }
  25340. }, {
  25341. key: "onRecoveredEarlyEof",
  25342. get: function() {
  25343. return this._onRecoveredEarlyEof
  25344. },
  25345. set: function(e) {
  25346. this._onRecoveredEarlyEof = e
  25347. }
  25348. }, {
  25349. key: "currentURL",
  25350. get: function() {
  25351. return this._dataSource.url
  25352. }
  25353. }, {
  25354. key: "hasRedirect",
  25355. get: function() {
  25356. return null != this._redirectedURL || null != this._dataSource.redirectedURL
  25357. }
  25358. }, {
  25359. key: "currentRedirectedURL",
  25360. get: function() {
  25361. return this._redirectedURL || this._dataSource.redirectedURL
  25362. }
  25363. }, {
  25364. key: "currentSpeed",
  25365. get: function() {
  25366. return this._loaderClass === _ ? this._loader.currentSpeed : this._speedSampler
  25367. .lastSecondKBps
  25368. }
  25369. }, {
  25370. key: "averageKBps",
  25371. get: function() {
  25372. return this._speedSampler.averageKBps
  25373. }
  25374. }, {
  25375. key: "loaderType",
  25376. get: function() {
  25377. return this._loader.type
  25378. }
  25379. }]) && k(t.prototype, i), Object.defineProperty(t, "prototype", {
  25380. writable: !1
  25381. }), e
  25382. }();
  25383. t.a = R
  25384. }, function(e, t, i) {
  25385. "use strict";
  25386. (function(t) {
  25387. void 0 === t || !t.version || 0 === t.version.indexOf("v0.") || 0 === t.version.indexOf("v1.") && 0 !==
  25388. t.version.indexOf("v1.8.") ? e.exports = {
  25389. nextTick: function(e, i, r, n) {
  25390. if ("function" != typeof e) throw new TypeError('"callback" argument must be a function');
  25391. var a, s, o = arguments.length;
  25392. switch (o) {
  25393. case 0:
  25394. case 1:
  25395. return t.nextTick(e);
  25396. case 2:
  25397. return t.nextTick(function() {
  25398. e.call(null, i)
  25399. });
  25400. case 3:
  25401. return t.nextTick(function() {
  25402. e.call(null, i, r)
  25403. });
  25404. case 4:
  25405. return t.nextTick(function() {
  25406. e.call(null, i, r, n)
  25407. });
  25408. default:
  25409. for (a = new Array(o - 1), s = 0; s < a.length;) a[s++] = arguments[s];
  25410. return t.nextTick(function() {
  25411. e.apply(null, a)
  25412. })
  25413. }
  25414. }
  25415. } : e.exports = t
  25416. }).call(this, i(9))
  25417. }, function(e, t, i) {
  25418. var r = i(6).Buffer;
  25419. function n(e) {
  25420. r.isBuffer(e) || (e = r.from(e));
  25421. for (var t = e.length / 4 | 0, i = new Array(t), n = 0; n < t; n++) i[n] = e.readUInt32BE(4 * n);
  25422. return i
  25423. }
  25424. function a(e) {
  25425. for (; 0 < e.length; e++) e[0] = 0
  25426. }
  25427. function s(e, t, i, r, n) {
  25428. for (var a, s, o, u, l = i[0], d = i[1], c = i[2], h = i[3], f = e[0] ^ t[0], p = e[1] ^ t[1], m = e[2] ^
  25429. t[2], g = e[3] ^ t[3], v = 4, y = 1; y < n; y++) a = l[f >>> 24] ^ d[p >>> 16 & 255] ^ c[m >>> 8 &
  25430. 255] ^ h[255 & g] ^ t[v++], s = l[p >>> 24] ^ d[m >>> 16 & 255] ^ c[g >>> 8 & 255] ^ h[255 & f] ^ t[
  25431. v++], o = l[m >>> 24] ^ d[g >>> 16 & 255] ^ c[f >>> 8 & 255] ^ h[255 & p] ^ t[v++], u = l[g >>> 24] ^
  25432. d[f >>> 16 & 255] ^ c[p >>> 8 & 255] ^ h[255 & m] ^ t[v++], f = a, p = s, m = o, g = u;
  25433. return a = (r[f >>> 24] << 24 | r[p >>> 16 & 255] << 16 | r[m >>> 8 & 255] << 8 | r[255 & g]) ^ t[v++],
  25434. s = (r[p >>> 24] << 24 | r[m >>> 16 & 255] << 16 | r[g >>> 8 & 255] << 8 | r[255 & f]) ^ t[v++], o = (r[
  25435. m >>> 24] << 24 | r[g >>> 16 & 255] << 16 | r[f >>> 8 & 255] << 8 | r[255 & p]) ^ t[v++], u = (r[g >>>
  25436. 24] << 24 | r[f >>> 16 & 255] << 16 | r[p >>> 8 & 255] << 8 | r[255 & m]) ^ t[v++], [a >>>= 0, s >>>=
  25437. 0, o >>>= 0, u >>>= 0
  25438. ]
  25439. }
  25440. var o = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54],
  25441. u = function() {
  25442. for (var e = new Array(256), t = 0; t < 256; t++) e[t] = t < 128 ? t << 1 : t << 1 ^ 283;
  25443. for (var i = [], r = [], n = [
  25444. [],
  25445. [],
  25446. [],
  25447. []
  25448. ], a = [
  25449. [],
  25450. [],
  25451. [],
  25452. []
  25453. ], s = 0, o = 0, u = 0; u < 256; ++u) {
  25454. var l = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4;
  25455. l = l >>> 8 ^ 255 & l ^ 99, i[s] = l, r[l] = s;
  25456. var d = e[s],
  25457. c = e[d],
  25458. h = e[c],
  25459. f = 257 * e[l] ^ 16843008 * l;
  25460. n[0][s] = f << 24 | f >>> 8, n[1][s] = f << 16 | f >>> 16, n[2][s] = f << 8 | f >>> 24, n[3][s] = f,
  25461. f = 16843009 * h ^ 65537 * c ^ 257 * d ^ 16843008 * s, a[0][l] = f << 24 | f >>> 8, a[1][l] = f <<
  25462. 16 | f >>> 16, a[2][l] = f << 8 | f >>> 24, a[3][l] = f, 0 === s ? s = o = 1 : (s = d ^ e[e[e[h ^
  25463. d]]], o ^= e[e[o]])
  25464. }
  25465. return {
  25466. SBOX: i,
  25467. INV_SBOX: r,
  25468. SUB_MIX: n,
  25469. INV_SUB_MIX: a
  25470. }
  25471. }();
  25472. function l(e) {
  25473. this._key = n(e), this._reset()
  25474. }
  25475. l.blockSize = 16, l.keySize = 32, l.prototype.blockSize = l.blockSize, l.prototype.keySize = l.keySize, l
  25476. .prototype._reset = function() {
  25477. for (var e = this._key, t = e.length, i = t + 6, r = 4 * (i + 1), n = [], a = 0; a < t; a++) n[a] = e[
  25478. a];
  25479. for (a = t; a < r; a++) {
  25480. var s = n[a - 1];
  25481. a % t == 0 ? (s = s << 8 | s >>> 24, s = u.SBOX[s >>> 24] << 24 | u.SBOX[s >>> 16 & 255] << 16 | u
  25482. .SBOX[s >>> 8 & 255] << 8 | u.SBOX[255 & s], s ^= o[a / t | 0] << 24) : t > 6 && a % t == 4 && (
  25483. s = u.SBOX[s >>> 24] << 24 | u.SBOX[s >>> 16 & 255] << 16 | u.SBOX[s >>> 8 & 255] << 8 | u.SBOX[
  25484. 255 & s]), n[a] = n[a - t] ^ s
  25485. }
  25486. for (var l = [], d = 0; d < r; d++) {
  25487. var c = r - d,
  25488. h = n[c - (d % 4 ? 0 : 4)];
  25489. l[d] = d < 4 || c <= 4 ? h : u.INV_SUB_MIX[0][u.SBOX[h >>> 24]] ^ u.INV_SUB_MIX[1][u.SBOX[h >>> 16 &
  25490. 255]] ^ u.INV_SUB_MIX[2][u.SBOX[h >>> 8 & 255]] ^ u.INV_SUB_MIX[3][u.SBOX[255 & h]]
  25491. }
  25492. this._nRounds = i, this._keySchedule = n, this._invKeySchedule = l
  25493. }, l.prototype.encryptBlockRaw = function(e) {
  25494. return s(e = n(e), this._keySchedule, u.SUB_MIX, u.SBOX, this._nRounds)
  25495. }, l.prototype.encryptBlock = function(e) {
  25496. var t = this.encryptBlockRaw(e),
  25497. i = r.allocUnsafe(16);
  25498. return i.writeUInt32BE(t[0], 0), i.writeUInt32BE(t[1], 4), i.writeUInt32BE(t[2], 8), i.writeUInt32BE(t[
  25499. 3], 12), i
  25500. }, l.prototype.decryptBlock = function(e) {
  25501. var t = (e = n(e))[1];
  25502. e[1] = e[3], e[3] = t;
  25503. var i = s(e, this._invKeySchedule, u.INV_SUB_MIX, u.INV_SBOX, this._nRounds),
  25504. a = r.allocUnsafe(16);
  25505. return a.writeUInt32BE(i[0], 0), a.writeUInt32BE(i[3], 4), a.writeUInt32BE(i[2], 8), a.writeUInt32BE(i[
  25506. 1], 12), a
  25507. }, l.prototype.scrub = function() {
  25508. a(this._keySchedule), a(this._invKeySchedule), a(this._key)
  25509. }, e.exports.AES = l
  25510. }, function(e, t, i) {
  25511. var r = i(6).Buffer,
  25512. n = i(44);
  25513. e.exports = function(e, t, i, a) {
  25514. if (r.isBuffer(e) || (e = r.from(e, "binary")), t && (r.isBuffer(t) || (t = r.from(t, "binary")), 8 !==
  25515. t.length)) throw new RangeError("salt should be Buffer with 8 byte length");
  25516. for (var s = i / 8, o = r.alloc(s), u = r.alloc(a || 0), l = r.alloc(0); s > 0 || a > 0;) {
  25517. var d = new n;
  25518. d.update(l), d.update(e), t && d.update(t), l = d.digest();
  25519. var c = 0;
  25520. if (s > 0) {
  25521. var h = o.length - s;
  25522. c = Math.min(s, l.length), l.copy(o, h, 0, c), s -= c
  25523. }
  25524. if (c < l.length && a > 0) {
  25525. var f = u.length - a,
  25526. p = Math.min(a, l.length - c);
  25527. l.copy(u, f, c, c + p), a -= p
  25528. }
  25529. }
  25530. return l.fill(0), {
  25531. key: o,
  25532. iv: u
  25533. }
  25534. }
  25535. }, function(e, t, i) {
  25536. "use strict";
  25537. var r = i(11),
  25538. n = i(15),
  25539. a = n.getNAF,
  25540. s = n.getJSF,
  25541. o = n.assert;
  25542. function u(e, t) {
  25543. this.type = e, this.p = new r(t.p, 16), this.red = t.prime ? r.red(t.prime) : r.mont(this.p), this.zero =
  25544. new r(0).toRed(this.red), this.one = new r(1).toRed(this.red), this.two = new r(2).toRed(this.red), this
  25545. .n = t.n && new r(t.n, 16), this.g = t.g && this.pointFromJSON(t.g, t.gRed), this._wnafT1 = new Array(
  25546. 4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), this._wnafT4 = new Array(4), this
  25547. ._bitLength = this.n ? this.n.bitLength() : 0;
  25548. var i = this.n && this.p.div(this.n);
  25549. !i || i.cmpn(100) > 0 ? this.redN = null : (this._maxwellTrick = !0, this.redN = this.n.toRed(this.red))
  25550. }
  25551. function l(e, t) {
  25552. this.curve = e, this.type = t, this.precomputed = null
  25553. }
  25554. e.exports = u, u.prototype.point = function() {
  25555. throw new Error("Not implemented")
  25556. }, u.prototype.validate = function() {
  25557. throw new Error("Not implemented")
  25558. }, u.prototype._fixedNafMul = function(e, t) {
  25559. o(e.precomputed);
  25560. var i = e._getDoubles(),
  25561. r = a(t, 1, this._bitLength),
  25562. n = (1 << i.step + 1) - (i.step % 2 == 0 ? 2 : 1);
  25563. n /= 3;
  25564. var s, u, l = [];
  25565. for (s = 0; s < r.length; s += i.step) {
  25566. u = 0;
  25567. for (var d = s + i.step - 1; d >= s; d--) u = (u << 1) + r[d];
  25568. l.push(u)
  25569. }
  25570. for (var c = this.jpoint(null, null, null), h = this.jpoint(null, null, null), f = n; f > 0; f--) {
  25571. for (s = 0; s < l.length; s++)(u = l[s]) === f ? h = h.mixedAdd(i.points[s]) : u === -f && (h = h
  25572. .mixedAdd(i.points[s].neg()));
  25573. c = c.add(h)
  25574. }
  25575. return c.toP()
  25576. }, u.prototype._wnafMul = function(e, t) {
  25577. var i = 4,
  25578. r = e._getNAFPoints(i);
  25579. i = r.wnd;
  25580. for (var n = r.points, s = a(t, i, this._bitLength), u = this.jpoint(null, null, null), l = s.length -
  25581. 1; l >= 0; l--) {
  25582. for (var d = 0; l >= 0 && 0 === s[l]; l--) d++;
  25583. if (l >= 0 && d++, u = u.dblp(d), l < 0) break;
  25584. var c = s[l];
  25585. o(0 !== c), u = "affine" === e.type ? c > 0 ? u.mixedAdd(n[c - 1 >> 1]) : u.mixedAdd(n[-c - 1 >> 1]
  25586. .neg()) : c > 0 ? u.add(n[c - 1 >> 1]) : u.add(n[-c - 1 >> 1].neg())
  25587. }
  25588. return "affine" === e.type ? u.toP() : u
  25589. }, u.prototype._wnafMulAdd = function(e, t, i, r, n) {
  25590. var o, u, l, d = this._wnafT1,
  25591. c = this._wnafT2,
  25592. h = this._wnafT3,
  25593. f = 0;
  25594. for (o = 0; o < r; o++) {
  25595. var p = (l = t[o])._getNAFPoints(e);
  25596. d[o] = p.wnd, c[o] = p.points
  25597. }
  25598. for (o = r - 1; o >= 1; o -= 2) {
  25599. var m = o - 1,
  25600. g = o;
  25601. if (1 === d[m] && 1 === d[g]) {
  25602. var v = [t[m], null, null, t[g]];
  25603. 0 === t[m].y.cmp(t[g].y) ? (v[1] = t[m].add(t[g]), v[2] = t[m].toJ().mixedAdd(t[g].neg())) : 0 ===
  25604. t[m].y.cmp(t[g].y.redNeg()) ? (v[1] = t[m].toJ().mixedAdd(t[g]), v[2] = t[m].add(t[g].neg())) : (
  25605. v[1] = t[m].toJ().mixedAdd(t[g]), v[2] = t[m].toJ().mixedAdd(t[g].neg()));
  25606. var y = [-3, -1, -5, -7, 0, 7, 5, 1, 3],
  25607. _ = s(i[m], i[g]);
  25608. for (f = Math.max(_[0].length, f), h[m] = new Array(f), h[g] = new Array(f), u = 0; u < f; u++) {
  25609. var b = 0 | _[0][u],
  25610. w = 0 | _[1][u];
  25611. h[m][u] = y[3 * (b + 1) + (w + 1)], h[g][u] = 0, c[m] = v
  25612. }
  25613. } else h[m] = a(i[m], d[m], this._bitLength), h[g] = a(i[g], d[g], this._bitLength), f = Math.max(h[m]
  25614. .length, f), f = Math.max(h[g].length, f)
  25615. }
  25616. var E = this.jpoint(null, null, null),
  25617. T = this._wnafT4;
  25618. for (o = f; o >= 0; o--) {
  25619. for (var S = 0; o >= 0;) {
  25620. var A = !0;
  25621. for (u = 0; u < r; u++) T[u] = 0 | h[u][o], 0 !== T[u] && (A = !1);
  25622. if (!A) break;
  25623. S++, o--
  25624. }
  25625. if (o >= 0 && S++, E = E.dblp(S), o < 0) break;
  25626. for (u = 0; u < r; u++) {
  25627. var k = T[u];
  25628. 0 !== k && (k > 0 ? l = c[u][k - 1 >> 1] : k < 0 && (l = c[u][-k - 1 >> 1].neg()), E = "affine" ===
  25629. l.type ? E.mixedAdd(l) : E.add(l))
  25630. }
  25631. }
  25632. for (o = 0; o < r; o++) c[o] = null;
  25633. return n ? E : E.toP()
  25634. }, u.BasePoint = l, l.prototype.eq = function() {
  25635. throw new Error("Not implemented")
  25636. }, l.prototype.validate = function() {
  25637. return this.curve.validate(this)
  25638. }, u.prototype.decodePoint = function(e, t) {
  25639. e = n.toArray(e, t);
  25640. var i = this.p.byteLength();
  25641. if ((4 === e[0] || 6 === e[0] || 7 === e[0]) && e.length - 1 == 2 * i) return 6 === e[0] ? o(e[e
  25642. .length - 1] % 2 == 0) : 7 === e[0] && o(e[e.length - 1] % 2 == 1), this.point(e.slice(1, 1 + i),
  25643. e.slice(1 + i, 1 + 2 * i));
  25644. if ((2 === e[0] || 3 === e[0]) && e.length - 1 === i) return this.pointFromX(e.slice(1, 1 + i), 3 === e[
  25645. 0]);
  25646. throw new Error("Unknown point format")
  25647. }, l.prototype.encodeCompressed = function(e) {
  25648. return this.encode(e, !0)
  25649. }, l.prototype._encode = function(e) {
  25650. var t = this.curve.p.byteLength(),
  25651. i = this.getX().toArray("be", t);
  25652. return e ? [this.getY().isEven() ? 2 : 3].concat(i) : [4].concat(i, this.getY().toArray("be", t))
  25653. }, l.prototype.encode = function(e, t) {
  25654. return n.encode(this._encode(t), e)
  25655. }, l.prototype.precompute = function(e) {
  25656. if (this.precomputed) return this;
  25657. var t = {
  25658. doubles: null,
  25659. naf: null,
  25660. beta: null
  25661. };
  25662. return t.naf = this._getNAFPoints(8), t.doubles = this._getDoubles(4, e), t.beta = this._getBeta(), this
  25663. .precomputed = t, this
  25664. }, l.prototype._hasDoubles = function(e) {
  25665. if (!this.precomputed) return !1;
  25666. var t = this.precomputed.doubles;
  25667. return !!t && t.points.length >= Math.ceil((e.bitLength() + 1) / t.step)
  25668. }, l.prototype._getDoubles = function(e, t) {
  25669. if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles;
  25670. for (var i = [this], r = this, n = 0; n < t; n += e) {
  25671. for (var a = 0; a < e; a++) r = r.dbl();
  25672. i.push(r)
  25673. }
  25674. return {
  25675. step: e,
  25676. points: i
  25677. }
  25678. }, l.prototype._getNAFPoints = function(e) {
  25679. if (this.precomputed && this.precomputed.naf) return this.precomputed.naf;
  25680. for (var t = [this], i = (1 << e) - 1, r = 1 === i ? null : this.dbl(), n = 1; n < i; n++) t[n] = t[n -
  25681. 1].add(r);
  25682. return {
  25683. wnd: e,
  25684. points: t
  25685. }
  25686. }, l.prototype._getBeta = function() {
  25687. return null
  25688. }, l.prototype.dblp = function(e) {
  25689. for (var t = this, i = 0; i < e; i++) t = t.dbl();
  25690. return t
  25691. }
  25692. }, function(e, t, i) {
  25693. var r = i(213),
  25694. n = i(220),
  25695. a = i(221),
  25696. s = i(53),
  25697. o = i(88),
  25698. u = i(6).Buffer;
  25699. function l(e) {
  25700. var t;
  25701. "object" != typeof e || u.isBuffer(e) || (t = e.passphrase, e = e.key), "string" == typeof e && (e = u
  25702. .from(e));
  25703. var i, l, d = a(e, t),
  25704. c = d.tag,
  25705. h = d.data;
  25706. switch (c) {
  25707. case "CERTIFICATE":
  25708. l = r.certificate.decode(h, "der").tbsCertificate.subjectPublicKeyInfo;
  25709. case "PUBLIC KEY":
  25710. switch (l || (l = r.PublicKey.decode(h, "der")), i = l.algorithm.algorithm.join(".")) {
  25711. case "1.2.840.113549.1.1.1":
  25712. return r.RSAPublicKey.decode(l.subjectPublicKey.data, "der");
  25713. case "1.2.840.10045.2.1":
  25714. return l.subjectPrivateKey = l.subjectPublicKey, {
  25715. type: "ec",
  25716. data: l
  25717. };
  25718. case "1.2.840.10040.4.1":
  25719. return l.algorithm.params.pub_key = r.DSAparam.decode(l.subjectPublicKey.data, "der"), {
  25720. type: "dsa",
  25721. data: l.algorithm.params
  25722. };
  25723. default:
  25724. throw new Error("unknown key id " + i)
  25725. }
  25726. case "ENCRYPTED PRIVATE KEY":
  25727. h = function(e, t) {
  25728. var i = e.algorithm.decrypt.kde.kdeparams.salt,
  25729. r = parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(), 10),
  25730. a = n[e.algorithm.decrypt.cipher.algo.join(".")],
  25731. l = e.algorithm.decrypt.cipher.iv,
  25732. d = e.subjectPrivateKey,
  25733. c = parseInt(a.split("-")[1], 10) / 8,
  25734. h = o.pbkdf2Sync(t, i, r, c, "sha1"),
  25735. f = s.createDecipheriv(a, h, l),
  25736. p = [];
  25737. return p.push(f.update(d)), p.push(f.final()), u.concat(p)
  25738. }(h = r.EncryptedPrivateKey.decode(h, "der"), t);
  25739. case "PRIVATE KEY":
  25740. switch (i = (l = r.PrivateKey.decode(h, "der")).algorithm.algorithm.join(".")) {
  25741. case "1.2.840.113549.1.1.1":
  25742. return r.RSAPrivateKey.decode(l.subjectPrivateKey, "der");
  25743. case "1.2.840.10045.2.1":
  25744. return {
  25745. curve: l.algorithm.curve, privateKey: r.ECPrivateKey.decode(l.subjectPrivateKey, "der")
  25746. .privateKey
  25747. };
  25748. case "1.2.840.10040.4.1":
  25749. return l.algorithm.params.priv_key = r.DSAparam.decode(l.subjectPrivateKey, "der"), {
  25750. type: "dsa",
  25751. params: l.algorithm.params
  25752. };
  25753. default:
  25754. throw new Error("unknown key id " + i)
  25755. }
  25756. case "RSA PUBLIC KEY":
  25757. return r.RSAPublicKey.decode(h, "der");
  25758. case "RSA PRIVATE KEY":
  25759. return r.RSAPrivateKey.decode(h, "der");
  25760. case "DSA PRIVATE KEY":
  25761. return {
  25762. type: "dsa", params: r.DSAPrivateKey.decode(h, "der")
  25763. };
  25764. case "EC PRIVATE KEY":
  25765. return {
  25766. curve: (h = r.ECPrivateKey.decode(h, "der")).parameters.value, privateKey: h.privateKey
  25767. };
  25768. default:
  25769. throw new Error("unknown key type " + c)
  25770. }
  25771. }
  25772. e.exports = l, l.signature = r.signature
  25773. }, function(e, t, i) {
  25774. "use strict";
  25775. var r = function() {
  25776. function e() {}
  25777. return e.install = function() {
  25778. Object.setPrototypeOf = Object.setPrototypeOf || function(e, t) {
  25779. return e.__proto__ = t, e
  25780. }, Object.assign = Object.assign || function(e) {
  25781. if (null == e) throw new TypeError("Cannot convert undefined or null to object");
  25782. for (var t = Object(e), i = 1; i < arguments.length; i++) {
  25783. var r = arguments[i];
  25784. if (null != r)
  25785. for (var n in r) r.hasOwnProperty(n) && (t[n] = r[n])
  25786. }
  25787. return t
  25788. }, "function" != typeof self.Promise && i(124).polyfill()
  25789. }, e
  25790. }();
  25791. r.install(), t.a = r
  25792. }, function(e, t, i) {
  25793. "use strict";
  25794. var r = i(5),
  25795. n = i(72),
  25796. a = i(6).Buffer,
  25797. s = new Array(16);
  25798. function o() {
  25799. n.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878
  25800. }
  25801. function u(e, t) {
  25802. return e << t | e >>> 32 - t
  25803. }
  25804. function l(e, t, i, r, n, a, s) {
  25805. return u(e + (t & i | ~t & r) + n + a | 0, s) + t | 0
  25806. }
  25807. function d(e, t, i, r, n, a, s) {
  25808. return u(e + (t & r | i & ~r) + n + a | 0, s) + t | 0
  25809. }
  25810. function c(e, t, i, r, n, a, s) {
  25811. return u(e + (t ^ i ^ r) + n + a | 0, s) + t | 0
  25812. }
  25813. function h(e, t, i, r, n, a, s) {
  25814. return u(e + (i ^ (t | ~r)) + n + a | 0, s) + t | 0
  25815. }
  25816. r(o, n), o.prototype._update = function() {
  25817. for (var e = s, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t);
  25818. var i = this._a,
  25819. r = this._b,
  25820. n = this._c,
  25821. a = this._d;
  25822. i = h(i = c(i = c(i = c(i = c(i = d(i = d(i = d(i = d(i = l(i = l(i = l(i = l(i, r, n, a, e[0],
  25823. 3614090360, 7), r = l(r, n = l(n, a = l(a, i, r, n, e[1], 3905402710, 12),
  25824. i, r, e[2], 606105819, 17), a, i, e[3], 3250441966, 22), n, a, e[4],
  25825. 4118548399, 7), r = l(r, n = l(n, a = l(a, i, r, n, e[5], 1200080426, 12), i,
  25826. r, e[6], 2821735955, 17), a, i, e[7], 4249261313, 22), n, a, e[8], 1770035416,
  25827. 7), r = l(r, n = l(n, a = l(a, i, r, n, e[9], 2336552879, 12), i, r, e[10],
  25828. 4294925233, 17), a, i, e[11], 2304563134, 22), n, a, e[12], 1804603682, 7), r = l(
  25829. r, n = l(n, a = l(a, i, r, n, e[13], 4254626195, 12), i, r, e[14], 2792965006,
  25830. 17), a, i, e[15], 1236535329, 22), n, a, e[1], 4129170786, 5), r = d(r, n = d(n, a =
  25831. d(a, i, r, n, e[6], 3225465664, 9), i, r, e[11], 643717713, 14), a, i, e[0],
  25832. 3921069994, 20), n, a, e[5], 3593408605, 5), r = d(r, n = d(n, a = d(a, i, r, n, e[
  25833. 10], 38016083, 9), i, r, e[15], 3634488961, 14), a, i, e[4], 3889429448, 20), n, a, e[
  25834. 9], 568446438, 5), r = d(r, n = d(n, a = d(a, i, r, n, e[14], 3275163606, 9), i, r, e[
  25835. 3], 4107603335, 14), a, i, e[8], 1163531501, 20), n, a, e[13], 2850285829, 5), r = d(r,
  25836. n = d(n, a = d(a, i, r, n, e[2], 4243563512, 9), i, r, e[7], 1735328473, 14), a, i, e[12],
  25837. 2368359562, 20), n, a, e[5], 4294588738, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[8],
  25838. 2272392833, 11), i, r, e[11], 1839030562, 16), a, i, e[14], 4259657740, 23), n, a, e[1],
  25839. 2763975236, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[4], 1272893353, 11), i, r, e[7],
  25840. 4139469664, 16), a, i, e[10], 3200236656, 23), n, a, e[13], 681279174, 4), r = c(r, n = c(n, a =
  25841. c(a, i, r, n, e[0], 3936430074, 11), i, r, e[3], 3572445317, 16), a, i, e[6], 76029189, 23), n,
  25842. a, e[9], 3654602809, 4), r = c(r, n = c(n, a = c(a, i, r, n, e[12], 3873151461, 11), i, r, e[15],
  25843. 530742520, 16), a, i, e[2], 3299628645, 23), n, a, e[0], 4096336452, 6), r = h(r = h(r = h(r = h(r,
  25844. n = h(n, a = h(a, i, r, n, e[7], 1126891415, 10), i, r, e[14], 2878612391, 15), a, i, e[5],
  25845. 4237533241, 21), n = h(n, a = h(a, i = h(i, r, n, a, e[12], 1700485571, 6), r, n, e[3],
  25846. 2399980690, 10), i, r, e[10], 4293915773, 15), a, i, e[1], 2240044497, 21), n = h(n, a = h(a,
  25847. i = h(i, r, n, a, e[8], 1873313359, 6), r, n, e[15], 4264355552, 10), i, r, e[6], 2734768916,
  25848. 15), a, i, e[13], 1309151649, 21), n = h(n, a = h(a, i = h(i, r, n, a, e[4], 4149444226, 6), r, n,
  25849. e[11], 3174756917, 10), i, r, e[2], 718787259, 15), a, i, e[9], 3951481745, 21), this._a = this._a +
  25850. i | 0, this._b = this._b + r | 0, this._c = this._c + n | 0, this._d = this._d + a | 0
  25851. }, o.prototype._digest = function() {
  25852. this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this
  25853. ._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset,
  25854. 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60),
  25855. this._update();
  25856. var e = a.allocUnsafe(16);
  25857. return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e
  25858. .writeInt32LE(this._d, 12), e
  25859. }, e.exports = o
  25860. }, function(e, t, i) {
  25861. (function(t) {
  25862. function i(e) {
  25863. try {
  25864. if (!t.localStorage) return !1
  25865. } catch (e) {
  25866. return !1
  25867. }
  25868. var i = t.localStorage[e];
  25869. return null != i && "true" === String(i).toLowerCase()
  25870. }
  25871. e.exports = function(e, t) {
  25872. if (i("noDeprecation")) return e;
  25873. var r = !1;
  25874. return function() {
  25875. if (!r) {
  25876. if (i("throwDeprecation")) throw new Error(t);
  25877. i("traceDeprecation") ? console.trace(t) : console.warn(t), r = !0
  25878. }
  25879. return e.apply(this, arguments)
  25880. }
  25881. }
  25882. }).call(this, i(13))
  25883. }, function(e, t, i) {
  25884. "use strict";
  25885. var r = i(25).codes.ERR_STREAM_PREMATURE_CLOSE;
  25886. function n() {}
  25887. e.exports = function e(t, i, a) {
  25888. if ("function" == typeof i) return e(t, null, i);
  25889. i || (i = {}), a = function(e) {
  25890. var t = !1;
  25891. return function() {
  25892. if (!t) {
  25893. t = !0;
  25894. for (var i = arguments.length, r = new Array(i), n = 0; n < i; n++) r[n] = arguments[n];
  25895. e.apply(this, r)
  25896. }
  25897. }
  25898. }(a || n);
  25899. var s = i.readable || !1 !== i.readable && t.readable,
  25900. o = i.writable || !1 !== i.writable && t.writable,
  25901. u = function() {
  25902. t.writable || d()
  25903. },
  25904. l = t._writableState && t._writableState.finished,
  25905. d = function() {
  25906. o = !1, l = !0, s || a.call(t)
  25907. },
  25908. c = t._readableState && t._readableState.endEmitted,
  25909. h = function() {
  25910. s = !1, c = !0, o || a.call(t)
  25911. },
  25912. f = function(e) {
  25913. a.call(t, e)
  25914. },
  25915. p = function() {
  25916. var e;
  25917. return s && !c ? (t._readableState && t._readableState.ended || (e = new r), a.call(t, e)) : o && !
  25918. l ? (t._writableState && t._writableState.ended || (e = new r), a.call(t, e)) : void 0
  25919. },
  25920. m = function() {
  25921. t.req.on("finish", d)
  25922. };
  25923. return function(e) {
  25924. return e.setHeader && "function" == typeof e.abort
  25925. }(t) ? (t.on("complete", d), t.on("abort", p), t.req ? m() : t.on("request", m)) : o && !t
  25926. ._writableState && (t.on("end", u), t.on("close", u)), t.on("end", h), t.on("finish", d), !1 !== i
  25927. .error && t.on("error", f), t.on("close", p),
  25928. function() {
  25929. t.removeListener("complete", d), t.removeListener("abort", p), t.removeListener("request", m), t
  25930. .req && t.req.removeListener("finish", d), t.removeListener("end", u), t.removeListener("close",
  25931. u), t.removeListener("finish", d), t.removeListener("end", h), t.removeListener("error", f), t
  25932. .removeListener("close", p)
  25933. }
  25934. }
  25935. }, function(e, t, i) {
  25936. "use strict";
  25937. var r = i(10).Buffer,
  25938. n = i(5),
  25939. a = i(72),
  25940. s = new Array(16),
  25941. o = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14,
  25942. 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15,
  25943. 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  25944. ],
  25945. u = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9,
  25946. 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9,
  25947. 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  25948. ],
  25949. l = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11,
  25950. 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14,
  25951. 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  25952. ],
  25953. d = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6,
  25954. 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9,
  25955. 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  25956. ],
  25957. c = [0, 1518500249, 1859775393, 2400959708, 2840853838],
  25958. h = [1352829926, 1548603684, 1836072691, 2053994217, 0];
  25959. function f() {
  25960. a.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878,
  25961. this._e = 3285377520
  25962. }
  25963. function p(e, t) {
  25964. return e << t | e >>> 32 - t
  25965. }
  25966. function m(e, t, i, r, n, a, s, o) {
  25967. return p(e + (t ^ i ^ r) + a + s | 0, o) + n | 0
  25968. }
  25969. function g(e, t, i, r, n, a, s, o) {
  25970. return p(e + (t & i | ~t & r) + a + s | 0, o) + n | 0
  25971. }
  25972. function v(e, t, i, r, n, a, s, o) {
  25973. return p(e + ((t | ~i) ^ r) + a + s | 0, o) + n | 0
  25974. }
  25975. function y(e, t, i, r, n, a, s, o) {
  25976. return p(e + (t & r | i & ~r) + a + s | 0, o) + n | 0
  25977. }
  25978. function _(e, t, i, r, n, a, s, o) {
  25979. return p(e + (t ^ (i | ~r)) + a + s | 0, o) + n | 0
  25980. }
  25981. n(f, a), f.prototype._update = function() {
  25982. for (var e = s, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(4 * t);
  25983. for (var i = 0 | this._a, r = 0 | this._b, n = 0 | this._c, a = 0 | this._d, f = 0 | this._e, b = 0 |
  25984. this._a, w = 0 | this._b, E = 0 | this._c, T = 0 | this._d, S = 0 | this._e, A = 0; A < 80; A +=
  25985. 1) {
  25986. var k, R;
  25987. A < 16 ? (k = m(i, r, n, a, f, e[o[A]], c[0], l[A]), R = _(b, w, E, T, S, e[u[A]], h[0], d[A])) : A <
  25988. 32 ? (k = g(i, r, n, a, f, e[o[A]], c[1], l[A]), R = y(b, w, E, T, S, e[u[A]], h[1], d[A])) : A <
  25989. 48 ? (k = v(i, r, n, a, f, e[o[A]], c[2], l[A]), R = v(b, w, E, T, S, e[u[A]], h[2], d[A])) : A <
  25990. 64 ? (k = y(i, r, n, a, f, e[o[A]], c[3], l[A]), R = g(b, w, E, T, S, e[u[A]], h[3], d[A])) : (k =
  25991. _(i, r, n, a, f, e[o[A]], c[4], l[A]), R = m(b, w, E, T, S, e[u[A]], h[4], d[A])), i = f, f = a,
  25992. a = p(n, 10), n = r, r = k, b = S, S = T, T = p(E, 10), E = w, w = R
  25993. }
  25994. var M = this._b + n + T | 0;
  25995. this._b = this._c + a + S | 0, this._c = this._d + f + b | 0, this._d = this._e + i + w | 0, this._e =
  25996. this._a + r + E | 0, this._a = M
  25997. }, f.prototype._digest = function() {
  25998. this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this
  25999. ._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset,
  26000. 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60),
  26001. this._update();
  26002. var e = r.alloc ? r.alloc(20) : new r(20);
  26003. return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e
  26004. .writeInt32LE(this._d, 12), e.writeInt32LE(this._e, 16), e
  26005. }, e.exports = f
  26006. }, function(e, t, i) {
  26007. (t = e.exports = function(e) {
  26008. e = e.toLowerCase();
  26009. var i = t[e];
  26010. if (!i) throw new Error(e + " is not supported (we accept pull requests)");
  26011. return new i
  26012. }).sha = i(144), t.sha1 = i(145), t.sha224 = i(146), t.sha256 = i(79), t.sha384 = i(147), t.sha512 = i(80)
  26013. }, function(e, t, i) {
  26014. (t = e.exports = i(81)).Stream = t, t.Readable = t, t.Writable = i(51), t.Duplex = i(23), t.Transform = i(
  26015. 84), t.PassThrough = i(154)
  26016. }, function(e, t, i) {
  26017. var r = i(10),
  26018. n = r.Buffer;
  26019. function a(e, t) {
  26020. for (var i in e) t[i] = e[i]
  26021. }
  26022. function s(e, t, i) {
  26023. return n(e, t, i)
  26024. }
  26025. n.from && n.alloc && n.allocUnsafe && n.allocUnsafeSlow ? e.exports = r : (a(r, t), t.Buffer = s), a(n, s),
  26026. s.from = function(e, t, i) {
  26027. if ("number" == typeof e) throw new TypeError("Argument must not be a number");
  26028. return n(e, t, i)
  26029. }, s.alloc = function(e, t, i) {
  26030. if ("number" != typeof e) throw new TypeError("Argument must be a number");
  26031. var r = n(e);
  26032. return void 0 !== t ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r
  26033. }, s.allocUnsafe = function(e) {
  26034. if ("number" != typeof e) throw new TypeError("Argument must be a number");
  26035. return n(e)
  26036. }, s.allocUnsafeSlow = function(e) {
  26037. if ("number" != typeof e) throw new TypeError("Argument must be a number");
  26038. return r.SlowBuffer(e)
  26039. }
  26040. }, function(e, t, i) {
  26041. "use strict";
  26042. (function(t, r, n) {
  26043. var a = i(38);
  26044. function s(e) {
  26045. var t = this;
  26046. this.next = null, this.entry = null, this.finish = function() {
  26047. ! function(e, t, i) {
  26048. var r = e.entry;
  26049. for (e.entry = null; r;) {
  26050. var n = r.callback;
  26051. t.pendingcb--, n(void 0), r = r.next
  26052. }
  26053. t.corkedRequestsFree ? t.corkedRequestsFree.next = e : t.corkedRequestsFree = e
  26054. }(t, e)
  26055. }
  26056. }
  26057. e.exports = y;
  26058. var o, u = !t.browser && ["v0.10", "v0.9."].indexOf(t.version.slice(0, 5)) > -1 ? r : a.nextTick;
  26059. y.WritableState = v;
  26060. var l = Object.create(i(32));
  26061. l.inherits = i(5);
  26062. var d, c = {
  26063. deprecate: i(45)
  26064. },
  26065. h = i(82),
  26066. f = i(50).Buffer,
  26067. p = n.Uint8Array || function() {},
  26068. m = i(83);
  26069. function g() {}
  26070. function v(e, t) {
  26071. o = o || i(23), e = e || {};
  26072. var r = t instanceof o;
  26073. this.objectMode = !!e.objectMode, r && (this.objectMode = this.objectMode || !!e.writableObjectMode);
  26074. var n = e.highWaterMark,
  26075. l = e.writableHighWaterMark,
  26076. d = this.objectMode ? 16 : 16384;
  26077. this.highWaterMark = n || 0 === n ? n : r && (l || 0 === l) ? l : d, this.highWaterMark = Math.floor(
  26078. this.highWaterMark), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !
  26079. 1, this.finished = !1, this.destroyed = !1;
  26080. var c = !1 === e.decodeStrings;
  26081. this.decodeStrings = !c, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this
  26082. .writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(
  26083. e) {
  26084. ! function(e, t) {
  26085. var i = e._writableState,
  26086. r = i.sync,
  26087. n = i.writecb;
  26088. if (function(e) {
  26089. e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0
  26090. }(i), t) ! function(e, t, i, r, n) {
  26091. --t.pendingcb, i ? (a.nextTick(n, r), a.nextTick(S, e, t), e._writableState.errorEmitted = !
  26092. 0, e.emit("error", r)) : (n(r), e._writableState.errorEmitted = !0, e.emit("error", r),
  26093. S(e, t))
  26094. }(e, i, r, t, n);
  26095. else {
  26096. var s = E(i);
  26097. s || i.corked || i.bufferProcessing || !i.bufferedRequest || w(e, i), r ? u(b, e, i, s, n) :
  26098. b(e, i, s, n)
  26099. }
  26100. }(t, e)
  26101. }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest =
  26102. null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount =
  26103. 0, this.corkedRequestsFree = new s(this)
  26104. }
  26105. function y(e) {
  26106. if (o = o || i(23), !(d.call(y, this) || this instanceof o)) return new y(e);
  26107. this._writableState = new v(e, this), this.writable = !0, e && ("function" == typeof e.write && (this
  26108. ._write = e.write), "function" == typeof e.writev && (this._writev = e.writev), "function" ==
  26109. typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && (this._final = e
  26110. .final)), h.call(this)
  26111. }
  26112. function _(e, t, i, r, n, a, s) {
  26113. t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, i ? e._writev(n, t.onwrite) : e._write(n,
  26114. a, t.onwrite), t.sync = !1
  26115. }
  26116. function b(e, t, i, r) {
  26117. i || function(e, t) {
  26118. 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain"))
  26119. }(e, t), t.pendingcb--, r(), S(e, t)
  26120. }
  26121. function w(e, t) {
  26122. t.bufferProcessing = !0;
  26123. var i = t.bufferedRequest;
  26124. if (e._writev && i && i.next) {
  26125. var r = t.bufferedRequestCount,
  26126. n = new Array(r),
  26127. a = t.corkedRequestsFree;
  26128. a.entry = i;
  26129. for (var o = 0, u = !0; i;) n[o] = i, i.isBuf || (u = !1), i = i.next, o += 1;
  26130. n.allBuffers = u, _(e, t, !0, t.length, n, "", a.finish), t.pendingcb++, t.lastBufferedRequest =
  26131. null, a.next ? (t.corkedRequestsFree = a.next, a.next = null) : t.corkedRequestsFree = new s(t), t
  26132. .bufferedRequestCount = 0
  26133. } else {
  26134. for (; i;) {
  26135. var l = i.chunk,
  26136. d = i.encoding,
  26137. c = i.callback;
  26138. if (_(e, t, !1, t.objectMode ? 1 : l.length, l, d, c), i = i.next, t.bufferedRequestCount--, t
  26139. .writing) break
  26140. }
  26141. null === i && (t.lastBufferedRequest = null)
  26142. }
  26143. t.bufferedRequest = i, t.bufferProcessing = !1
  26144. }
  26145. function E(e) {
  26146. return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing
  26147. }
  26148. function T(e, t) {
  26149. e._final(function(i) {
  26150. t.pendingcb--, i && e.emit("error", i), t.prefinished = !0, e.emit("prefinish"), S(e, t)
  26151. })
  26152. }
  26153. function S(e, t) {
  26154. var i = E(t);
  26155. return i && (function(e, t) {
  26156. t.prefinished || t.finalCalled || ("function" == typeof e._final ? (t.pendingcb++, t
  26157. .finalCalled = !0, a.nextTick(T, e, t)) : (t.prefinished = !0, e.emit("prefinish")))
  26158. }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"))), i
  26159. }
  26160. l.inherits(y, h), v.prototype.getBuffer = function() {
  26161. for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next;
  26162. return t
  26163. },
  26164. function() {
  26165. try {
  26166. Object.defineProperty(v.prototype, "buffer", {
  26167. get: c.deprecate(function() {
  26168. return this.getBuffer()
  26169. }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.",
  26170. "DEP0003")
  26171. })
  26172. } catch (e) {}
  26173. }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[
  26174. Symbol.hasInstance] ? (d = Function.prototype[Symbol.hasInstance], Object.defineProperty(y, Symbol
  26175. .hasInstance, {
  26176. value: function(e) {
  26177. return !!d.call(this, e) || this === y && e && e._writableState instanceof v
  26178. }
  26179. })) : d = function(e) {
  26180. return e instanceof this
  26181. }, y.prototype.pipe = function() {
  26182. this.emit("error", new Error("Cannot pipe, not readable"))
  26183. }, y.prototype.write = function(e, t, i) {
  26184. var r, n = this._writableState,
  26185. s = !1,
  26186. o = !n.objectMode && (r = e, f.isBuffer(r) || r instanceof p);
  26187. return o && !f.isBuffer(e) && (e = function(e) {
  26188. return f.from(e)
  26189. }(e)), "function" == typeof t && (i = t, t = null), o ? t = "buffer" : t || (t = n
  26190. .defaultEncoding), "function" != typeof i && (i = g), n.ended ? function(e, t) {
  26191. var i = new Error("write after end");
  26192. e.emit("error", i), a.nextTick(t, i)
  26193. }(this, i) : (o || function(e, t, i, r) {
  26194. var n = !0,
  26195. s = !1;
  26196. return null === i ? s = new TypeError("May not write null values to stream") : "string" ==
  26197. typeof i || void 0 === i || t.objectMode || (s = new TypeError(
  26198. "Invalid non-string/buffer chunk")), s && (e.emit("error", s), a.nextTick(r, s), n = !1),
  26199. n
  26200. }(this, n, e, i)) && (n.pendingcb++, s = function(e, t, i, r, n, a) {
  26201. if (!i) {
  26202. var s = function(e, t, i) {
  26203. return e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = f.from(t,
  26204. i)), t
  26205. }(t, r, n);
  26206. r !== s && (i = !0, n = "buffer", r = s)
  26207. }
  26208. var o = t.objectMode ? 1 : r.length;
  26209. t.length += o;
  26210. var u = t.length < t.highWaterMark;
  26211. if (u || (t.needDrain = !0), t.writing || t.corked) {
  26212. var l = t.lastBufferedRequest;
  26213. t.lastBufferedRequest = {
  26214. chunk: r,
  26215. encoding: n,
  26216. isBuf: i,
  26217. callback: a,
  26218. next: null
  26219. }, l ? l.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t
  26220. .bufferedRequestCount += 1
  26221. } else _(e, t, !1, o, r, n, a);
  26222. return u
  26223. }(this, n, o, e, t, i)), s
  26224. }, y.prototype.cork = function() {
  26225. this._writableState.corked++
  26226. }, y.prototype.uncork = function() {
  26227. var e = this._writableState;
  26228. e.corked && (e.corked--, e.writing || e.corked || e.finished || e.bufferProcessing || !e
  26229. .bufferedRequest || w(this, e))
  26230. }, y.prototype.setDefaultEncoding = function(e) {
  26231. if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary",
  26232. "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"
  26233. ].indexOf((e + "").toLowerCase()) > -1)) throw new TypeError("Unknown encoding: " + e);
  26234. return this._writableState.defaultEncoding = e, this
  26235. }, Object.defineProperty(y.prototype, "writableHighWaterMark", {
  26236. enumerable: !1,
  26237. get: function() {
  26238. return this._writableState.highWaterMark
  26239. }
  26240. }), y.prototype._write = function(e, t, i) {
  26241. i(new Error("_write() is not implemented"))
  26242. }, y.prototype._writev = null, y.prototype.end = function(e, t, i) {
  26243. var r = this._writableState;
  26244. "function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t = null),
  26245. null != e && this.write(e, t), r.corked && (r.corked = 1, this.uncork()), r.ending || r
  26246. .finished || function(e, t, i) {
  26247. t.ending = !0, S(e, t), i && (t.finished ? a.nextTick(i) : e.once("finish", i)), t.ended = !0, e
  26248. .writable = !1
  26249. }(this, r, i)
  26250. }, Object.defineProperty(y.prototype, "destroyed", {
  26251. get: function() {
  26252. return void 0 !== this._writableState && this._writableState.destroyed
  26253. },
  26254. set: function(e) {
  26255. this._writableState && (this._writableState.destroyed = e)
  26256. }
  26257. }), y.prototype.destroy = m.destroy, y.prototype._undestroy = m.undestroy, y.prototype._destroy =
  26258. function(e, t) {
  26259. this.end(), t(e)
  26260. }
  26261. }).call(this, i(9), i(152).setImmediate, i(13))
  26262. }, function(e, t, i) {
  26263. "use strict";
  26264. var r = i(14);
  26265. function n(e) {
  26266. this.options = e, this.type = this.options.type, this.blockSize = 8, this._init(), this.buffer =
  26267. new Array(this.blockSize), this.bufferOff = 0
  26268. }
  26269. e.exports = n, n.prototype._init = function() {}, n.prototype.update = function(e) {
  26270. return 0 === e.length ? [] : "decrypt" === this.type ? this._updateDecrypt(e) : this._updateEncrypt(e)
  26271. }, n.prototype._buffer = function(e, t) {
  26272. for (var i = Math.min(this.buffer.length - this.bufferOff, e.length - t), r = 0; r < i; r++) this
  26273. .buffer[this.bufferOff + r] = e[t + r];
  26274. return this.bufferOff += i, i
  26275. }, n.prototype._flushBuffer = function(e, t) {
  26276. return this._update(this.buffer, 0, e, t), this.bufferOff = 0, this.blockSize
  26277. }, n.prototype._updateEncrypt = function(e) {
  26278. var t = 0,
  26279. i = 0,
  26280. r = (this.bufferOff + e.length) / this.blockSize | 0,
  26281. n = new Array(r * this.blockSize);
  26282. 0 !== this.bufferOff && (t += this._buffer(e, t), this.bufferOff === this.buffer.length && (i += this
  26283. ._flushBuffer(n, i)));
  26284. for (var a = e.length - (e.length - t) % this.blockSize; t < a; t += this.blockSize) this._update(e, t,
  26285. n, i), i += this.blockSize;
  26286. for (; t < e.length; t++, this.bufferOff++) this.buffer[this.bufferOff] = e[t];
  26287. return n
  26288. }, n.prototype._updateDecrypt = function(e) {
  26289. for (var t = 0, i = 0, r = Math.ceil((this.bufferOff + e.length) / this.blockSize) - 1, n = new Array(
  26290. r * this.blockSize); r > 0; r--) t += this._buffer(e, t), i += this._flushBuffer(n, i);
  26291. return t += this._buffer(e, t), n
  26292. }, n.prototype.final = function(e) {
  26293. var t, i;
  26294. return e && (t = this.update(e)), i = "encrypt" === this.type ? this._finalEncrypt() : this
  26295. ._finalDecrypt(), t ? t.concat(i) : i
  26296. }, n.prototype._pad = function(e, t) {
  26297. if (0 === t) return !1;
  26298. for (; t < e.length;) e[t++] = 0;
  26299. return !0
  26300. }, n.prototype._finalEncrypt = function() {
  26301. if (!this._pad(this.buffer, this.bufferOff)) return [];
  26302. var e = new Array(this.blockSize);
  26303. return this._update(this.buffer, 0, e, 0), e
  26304. }, n.prototype._unpad = function(e) {
  26305. return e
  26306. }, n.prototype._finalDecrypt = function() {
  26307. r.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt");
  26308. var e = new Array(this.blockSize);
  26309. return this._flushBuffer(e, 0), this._unpad(e)
  26310. }
  26311. }, function(e, t, i) {
  26312. var r = i(167),
  26313. n = i(175),
  26314. a = i(97);
  26315. t.createCipher = t.Cipher = r.createCipher, t.createCipheriv = t.Cipheriv = r.createCipheriv, t
  26316. .createDecipher = t.Decipher = n.createDecipher, t.createDecipheriv = t.Decipheriv = n.createDecipheriv, t
  26317. .listCiphers = t.getCiphers = function() {
  26318. return Object.keys(a)
  26319. }
  26320. }, function(e, t, i) {
  26321. var r = {
  26322. ECB: i(168),
  26323. CBC: i(169),
  26324. CFB: i(170),
  26325. CFB8: i(171),
  26326. CFB1: i(172),
  26327. OFB: i(173),
  26328. CTR: i(95),
  26329. GCM: i(95)
  26330. },
  26331. n = i(97);
  26332. for (var a in n) n[a].module = r[n[a].mode];
  26333. e.exports = n
  26334. }, function(e, t) {
  26335. e.exports = function(e) {
  26336. return e.webpackPolyfill || (e.deprecate = function() {}, e.paths = [], e.children || (e.children = []),
  26337. Object.defineProperty(e, "loaded", {
  26338. enumerable: !0,
  26339. get: function() {
  26340. return e.l
  26341. }
  26342. }), Object.defineProperty(e, "id", {
  26343. enumerable: !0,
  26344. get: function() {
  26345. return e.i
  26346. }
  26347. }), e.webpackPolyfill = 1), e
  26348. }
  26349. }, function(e, t, i) {
  26350. var r;
  26351. function n(e) {
  26352. this.rand = e
  26353. }
  26354. if (e.exports = function(e) {
  26355. return r || (r = new n(null)), r.generate(e)
  26356. }, e.exports.Rand = n, n.prototype.generate = function(e) {
  26357. return this._rand(e)
  26358. }, n.prototype._rand = function(e) {
  26359. if (this.rand.getBytes) return this.rand.getBytes(e);
  26360. for (var t = new Uint8Array(e), i = 0; i < t.length; i++) t[i] = this.rand.getByte();
  26361. return t
  26362. }, "object" == typeof self) self.crypto && self.crypto.getRandomValues ? n.prototype._rand = function(e) {
  26363. var t = new Uint8Array(e);
  26364. return self.crypto.getRandomValues(t), t
  26365. } : self.msCrypto && self.msCrypto.getRandomValues ? n.prototype._rand = function(e) {
  26366. var t = new Uint8Array(e);
  26367. return self.msCrypto.getRandomValues(t), t
  26368. } : "object" == typeof window && (n.prototype._rand = function() {
  26369. throw new Error("Not implemented yet")
  26370. });
  26371. else try {
  26372. var a = i(179);
  26373. if ("function" != typeof a.randomBytes) throw new Error("Not supported");
  26374. n.prototype._rand = function(e) {
  26375. return a.randomBytes(e)
  26376. }
  26377. } catch (e) {}
  26378. }, function(e, t, i) {
  26379. "use strict";
  26380. var r = i(28).codes.ERR_STREAM_PREMATURE_CLOSE;
  26381. function n() {}
  26382. e.exports = function e(t, i, a) {
  26383. if ("function" == typeof i) return e(t, null, i);
  26384. i || (i = {}), a = function(e) {
  26385. var t = !1;
  26386. return function() {
  26387. if (!t) {
  26388. t = !0;
  26389. for (var i = arguments.length, r = new Array(i), n = 0; n < i; n++) r[n] = arguments[n];
  26390. e.apply(this, r)
  26391. }
  26392. }
  26393. }(a || n);
  26394. var s = i.readable || !1 !== i.readable && t.readable,
  26395. o = i.writable || !1 !== i.writable && t.writable,
  26396. u = function() {
  26397. t.writable || d()
  26398. },
  26399. l = t._writableState && t._writableState.finished,
  26400. d = function() {
  26401. o = !1, l = !0, s || a.call(t)
  26402. },
  26403. c = t._readableState && t._readableState.endEmitted,
  26404. h = function() {
  26405. s = !1, c = !0, o || a.call(t)
  26406. },
  26407. f = function(e) {
  26408. a.call(t, e)
  26409. },
  26410. p = function() {
  26411. var e;
  26412. return s && !c ? (t._readableState && t._readableState.ended || (e = new r), a.call(t, e)) : o && !
  26413. l ? (t._writableState && t._writableState.ended || (e = new r), a.call(t, e)) : void 0
  26414. },
  26415. m = function() {
  26416. t.req.on("finish", d)
  26417. };
  26418. return function(e) {
  26419. return e.setHeader && "function" == typeof e.abort
  26420. }(t) ? (t.on("complete", d), t.on("abort", p), t.req ? m() : t.on("request", m)) : o && !t
  26421. ._writableState && (t.on("end", u), t.on("close", u)), t.on("end", h), t.on("finish", d), !1 !== i
  26422. .error && t.on("error", f), t.on("close", p),
  26423. function() {
  26424. t.removeListener("complete", d), t.removeListener("abort", p), t.removeListener("request", m), t
  26425. .req && t.req.removeListener("finish", d), t.removeListener("end", u), t.removeListener("close",
  26426. u), t.removeListener("finish", d), t.removeListener("end", h), t.removeListener("error", f), t
  26427. .removeListener("close", p)
  26428. }
  26429. }
  26430. }, function(e, t, i) {
  26431. (function(t) {
  26432. var r = i(192),
  26433. n = i(24);
  26434. function a(e) {
  26435. var t, i = e.modulus.byteLength();
  26436. do {
  26437. t = new r(n(i))
  26438. } while (t.cmp(e.modulus) >= 0 || !t.umod(e.prime1) || !t.umod(e.prime2));
  26439. return t
  26440. }
  26441. function s(e, i) {
  26442. var n = function(e) {
  26443. var t = a(e);
  26444. return {
  26445. blinder: t.toRed(r.mont(e.modulus)).redPow(new r(e.publicExponent)).fromRed(),
  26446. unblinder: t.invm(e.modulus)
  26447. }
  26448. }(i),
  26449. s = i.modulus.byteLength(),
  26450. o = new r(e).mul(n.blinder).umod(i.modulus),
  26451. u = o.toRed(r.mont(i.prime1)),
  26452. l = o.toRed(r.mont(i.prime2)),
  26453. d = i.coefficient,
  26454. c = i.prime1,
  26455. h = i.prime2,
  26456. f = u.redPow(i.exponent1).fromRed(),
  26457. p = l.redPow(i.exponent2).fromRed(),
  26458. m = f.isub(p).imul(d).umod(c).imul(h);
  26459. return p.iadd(m).imul(n.unblinder).umod(i.modulus).toArrayLike(t, "be", s)
  26460. }
  26461. s.getr = a, e.exports = s
  26462. }).call(this, i(10).Buffer)
  26463. }, function(e, t, i) {
  26464. "use strict";
  26465. var r = t;
  26466. r.version = i(194).version, r.utils = i(15), r.rand = i(56), r.curve = i(109), r.curves = i(60), r.ec = i(
  26467. 205), r.eddsa = i(209)
  26468. }, function(e, t, i) {
  26469. "use strict";
  26470. var r, n = t,
  26471. a = i(61),
  26472. s = i(109),
  26473. o = i(15).assert;
  26474. function u(e) {
  26475. "short" === e.type ? this.curve = new s.short(e) : "edwards" === e.type ? this.curve = new s.edwards(e) :
  26476. this.curve = new s.mont(e), this.g = this.curve.g, this.n = this.curve.n, this.hash = e.hash, o(this.g
  26477. .validate(), "Invalid curve"), o(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O")
  26478. }
  26479. function l(e, t) {
  26480. Object.defineProperty(n, e, {
  26481. configurable: !0,
  26482. enumerable: !0,
  26483. get: function() {
  26484. var i = new u(t);
  26485. return Object.defineProperty(n, e, {
  26486. configurable: !0,
  26487. enumerable: !0,
  26488. value: i
  26489. }), i
  26490. }
  26491. })
  26492. }
  26493. n.PresetCurve = u, l("p192", {
  26494. type: "short",
  26495. prime: "p192",
  26496. p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
  26497. a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",
  26498. b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",
  26499. n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",
  26500. hash: a.sha256,
  26501. gRed: !1,
  26502. g: ["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012",
  26503. "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"
  26504. ]
  26505. }), l("p224", {
  26506. type: "short",
  26507. prime: "p224",
  26508. p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
  26509. a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",
  26510. b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",
  26511. n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",
  26512. hash: a.sha256,
  26513. gRed: !1,
  26514. g: ["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21",
  26515. "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"
  26516. ]
  26517. }), l("p256", {
  26518. type: "short",
  26519. prime: null,
  26520. p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",
  26521. a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",
  26522. b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",
  26523. n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",
  26524. hash: a.sha256,
  26525. gRed: !1,
  26526. g: ["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296",
  26527. "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"
  26528. ]
  26529. }), l("p384", {
  26530. type: "short",
  26531. prime: null,
  26532. p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",
  26533. a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",
  26534. b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",
  26535. n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",
  26536. hash: a.sha384,
  26537. gRed: !1,
  26538. g: ["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7",
  26539. "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"
  26540. ]
  26541. }), l("p521", {
  26542. type: "short",
  26543. prime: null,
  26544. p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",
  26545. a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",
  26546. b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",
  26547. n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",
  26548. hash: a.sha512,
  26549. gRed: !1,
  26550. g: ["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66",
  26551. "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"
  26552. ]
  26553. }), l("curve25519", {
  26554. type: "mont",
  26555. prime: "p25519",
  26556. p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
  26557. a: "76d06",
  26558. b: "1",
  26559. n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",
  26560. hash: a.sha256,
  26561. gRed: !1,
  26562. g: ["9"]
  26563. }), l("ed25519", {
  26564. type: "edwards",
  26565. prime: "p25519",
  26566. p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
  26567. a: "-1",
  26568. c: "1",
  26569. d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",
  26570. n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",
  26571. hash: a.sha256,
  26572. gRed: !1,
  26573. g: ["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a",
  26574. "6666666666666666666666666666666666666666666666666666666666666658"
  26575. ]
  26576. });
  26577. try {
  26578. r = i(204)
  26579. } catch (e) {
  26580. r = void 0
  26581. }
  26582. l("secp256k1", {
  26583. type: "short",
  26584. prime: "k256",
  26585. p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
  26586. a: "0",
  26587. b: "7",
  26588. n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",
  26589. h: "1",
  26590. hash: a.sha256,
  26591. beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",
  26592. lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",
  26593. basis: [{
  26594. a: "3086d221a7d46bcde86c90e49284eb15",
  26595. b: "-e4437ed6010e88286f547fa90abfe4c3"
  26596. }, {
  26597. a: "114ca50f7a8e2f3f657c1108d9d44cfd8",
  26598. b: "3086d221a7d46bcde86c90e49284eb15"
  26599. }],
  26600. gRed: !1,
  26601. g: ["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
  26602. "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", r
  26603. ]
  26604. })
  26605. }, function(e, t, i) {
  26606. var r = t;
  26607. r.utils = i(18), r.common = i(34), r.sha = i(198), r.ripemd = i(202), r.hmac = i(203), r.sha1 = r.sha.sha1,
  26608. r.sha256 = r.sha.sha256, r.sha224 = r.sha.sha224, r.sha384 = r.sha.sha384, r.sha512 = r.sha.sha512, r
  26609. .ripemd160 = r.ripemd.ripemd160
  26610. }, function(e, t, i) {
  26611. "use strict";
  26612. (function(t) {
  26613. var r, n = i(10),
  26614. a = n.Buffer,
  26615. s = {};
  26616. for (r in n) n.hasOwnProperty(r) && "SlowBuffer" !== r && "Buffer" !== r && (s[r] = n[r]);
  26617. var o = s.Buffer = {};
  26618. for (r in a) a.hasOwnProperty(r) && "allocUnsafe" !== r && "allocUnsafeSlow" !== r && (o[r] = a[r]);
  26619. if (s.Buffer.prototype = a.prototype, o.from && o.from !== Uint8Array.from || (o.from = function(e, t,
  26620. i) {
  26621. if ("number" == typeof e) throw new TypeError(
  26622. 'The "value" argument must not be of type number. Received type ' + typeof e);
  26623. if (e && void 0 === e.length) throw new TypeError(
  26624. "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " +
  26625. typeof e);
  26626. return a(e, t, i)
  26627. }), o.alloc || (o.alloc = function(e, t, i) {
  26628. if ("number" != typeof e) throw new TypeError(
  26629. 'The "size" argument must be of type number. Received type ' + typeof e);
  26630. if (e < 0 || e >= 2 * (1 << 30)) throw new RangeError('The value "' + e +
  26631. '" is invalid for option "size"');
  26632. var r = a(e);
  26633. return t && 0 !== t.length ? "string" == typeof i ? r.fill(t, i) : r.fill(t) : r.fill(0), r
  26634. }), !s.kStringMaxLength) try {
  26635. s.kStringMaxLength = t.binding("buffer").kStringMaxLength
  26636. } catch (e) {}
  26637. s.constants || (s.constants = {
  26638. MAX_LENGTH: s.kMaxLength
  26639. }, s.kStringMaxLength && (s.constants.MAX_STRING_LENGTH = s.kStringMaxLength)), e.exports = s
  26640. }).call(this, i(9))
  26641. }, function(e, t, i) {
  26642. "use strict";
  26643. var r = i(64).Reporter,
  26644. n = i(35).EncoderBuffer,
  26645. a = i(35).DecoderBuffer,
  26646. s = i(14),
  26647. o = ["seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int",
  26648. "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr",
  26649. "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr"
  26650. ],
  26651. u = ["key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains"].concat(
  26652. o);
  26653. function l(e, t, i) {
  26654. var r = {};
  26655. this._baseState = r, r.name = i, r.enc = e, r.parent = t || null, r.children = null, r.tag = null, r
  26656. .args = null, r.reverseArgs = null, r.choice = null, r.optional = !1, r.any = !1, r.obj = !1, r.use =
  26657. null, r.useDecoder = null, r.key = null, r.default = null, r.explicit = null, r.implicit = null, r
  26658. .contains = null, r.parent || (r.children = [], this._wrap())
  26659. }
  26660. e.exports = l;
  26661. var d = ["enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj",
  26662. "use", "alteredUse", "key", "default", "explicit", "implicit", "contains"
  26663. ];
  26664. l.prototype.clone = function() {
  26665. var e = this._baseState,
  26666. t = {};
  26667. d.forEach(function(i) {
  26668. t[i] = e[i]
  26669. });
  26670. var i = new this.constructor(t.parent);
  26671. return i._baseState = t, i
  26672. }, l.prototype._wrap = function() {
  26673. var e = this._baseState;
  26674. u.forEach(function(t) {
  26675. this[t] = function() {
  26676. var i = new this.constructor(this);
  26677. return e.children.push(i), i[t].apply(i, arguments)
  26678. }
  26679. }, this)
  26680. }, l.prototype._init = function(e) {
  26681. var t = this._baseState;
  26682. s(null === t.parent), e.call(this), t.children = t.children.filter(function(e) {
  26683. return e._baseState.parent === this
  26684. }, this), s.equal(t.children.length, 1, "Root node can have only one child")
  26685. }, l.prototype._useArgs = function(e) {
  26686. var t = this._baseState,
  26687. i = e.filter(function(e) {
  26688. return e instanceof this.constructor
  26689. }, this);
  26690. e = e.filter(function(e) {
  26691. return !(e instanceof this.constructor)
  26692. }, this), 0 !== i.length && (s(null === t.children), t.children = i, i.forEach(function(e) {
  26693. e._baseState.parent = this
  26694. }, this)), 0 !== e.length && (s(null === t.args), t.args = e, t.reverseArgs = e.map(function(e) {
  26695. if ("object" != typeof e || e.constructor !== Object) return e;
  26696. var t = {};
  26697. return Object.keys(e).forEach(function(i) {
  26698. i == (0 | i) && (i |= 0);
  26699. var r = e[i];
  26700. t[r] = i
  26701. }), t
  26702. }))
  26703. }, ["_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull",
  26704. "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid",
  26705. "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool"
  26706. ].forEach(function(e) {
  26707. l.prototype[e] = function() {
  26708. var t = this._baseState;
  26709. throw new Error(e + " not implemented for encoding: " + t.enc)
  26710. }
  26711. }), o.forEach(function(e) {
  26712. l.prototype[e] = function() {
  26713. var t = this._baseState,
  26714. i = Array.prototype.slice.call(arguments);
  26715. return s(null === t.tag), t.tag = e, this._useArgs(i), this
  26716. }
  26717. }), l.prototype.use = function(e) {
  26718. s(e);
  26719. var t = this._baseState;
  26720. return s(null === t.use), t.use = e, this
  26721. }, l.prototype.optional = function() {
  26722. return this._baseState.optional = !0, this
  26723. }, l.prototype.def = function(e) {
  26724. var t = this._baseState;
  26725. return s(null === t.default), t.default = e, t.optional = !0, this
  26726. }, l.prototype.explicit = function(e) {
  26727. var t = this._baseState;
  26728. return s(null === t.explicit && null === t.implicit), t.explicit = e, this
  26729. }, l.prototype.implicit = function(e) {
  26730. var t = this._baseState;
  26731. return s(null === t.explicit && null === t.implicit), t.implicit = e, this
  26732. }, l.prototype.obj = function() {
  26733. var e = this._baseState,
  26734. t = Array.prototype.slice.call(arguments);
  26735. return e.obj = !0, 0 !== t.length && this._useArgs(t), this
  26736. }, l.prototype.key = function(e) {
  26737. var t = this._baseState;
  26738. return s(null === t.key), t.key = e, this
  26739. }, l.prototype.any = function() {
  26740. return this._baseState.any = !0, this
  26741. }, l.prototype.choice = function(e) {
  26742. var t = this._baseState;
  26743. return s(null === t.choice), t.choice = e, this._useArgs(Object.keys(e).map(function(t) {
  26744. return e[t]
  26745. })), this
  26746. }, l.prototype.contains = function(e) {
  26747. var t = this._baseState;
  26748. return s(null === t.use), t.contains = e, this
  26749. }, l.prototype._decode = function(e, t) {
  26750. var i = this._baseState;
  26751. if (null === i.parent) return e.wrapResult(i.children[0]._decode(e, t));
  26752. var r, n = i.default,
  26753. s = !0,
  26754. o = null;
  26755. if (null !== i.key && (o = e.enterKey(i.key)), i.optional) {
  26756. var u = null;
  26757. if (null !== i.explicit ? u = i.explicit : null !== i.implicit ? u = i.implicit : null !== i.tag && (
  26758. u = i.tag), null !== u || i.any) {
  26759. if (s = this._peekTag(e, u, i.any), e.isError(s)) return s
  26760. } else {
  26761. var l = e.save();
  26762. try {
  26763. null === i.choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t), s = !0
  26764. } catch (e) {
  26765. s = !1
  26766. }
  26767. e.restore(l)
  26768. }
  26769. }
  26770. if (i.obj && s && (r = e.enterObject()), s) {
  26771. if (null !== i.explicit) {
  26772. var d = this._decodeTag(e, i.explicit);
  26773. if (e.isError(d)) return d;
  26774. e = d
  26775. }
  26776. var c = e.offset;
  26777. if (null === i.use && null === i.choice) {
  26778. var h;
  26779. i.any && (h = e.save());
  26780. var f = this._decodeTag(e, null !== i.implicit ? i.implicit : i.tag, i.any);
  26781. if (e.isError(f)) return f;
  26782. i.any ? n = e.raw(h) : e = f
  26783. }
  26784. if (t && t.track && null !== i.tag && t.track(e.path(), c, e.length, "tagged"), t && t.track &&
  26785. null !== i.tag && t.track(e.path(), e.offset, e.length, "content"), i.any || (n = null === i
  26786. .choice ? this._decodeGeneric(i.tag, e, t) : this._decodeChoice(e, t)), e.isError(n)) return n;
  26787. if (i.any || null !== i.choice || null === i.children || i.children.forEach(function(i) {
  26788. i._decode(e, t)
  26789. }), i.contains && ("octstr" === i.tag || "bitstr" === i.tag)) {
  26790. var p = new a(n);
  26791. n = this._getUse(i.contains, e._reporterState.obj)._decode(p, t)
  26792. }
  26793. }
  26794. return i.obj && s && (n = e.leaveObject(r)), null === i.key || null === n && !0 !== s ? null !== o && e
  26795. .exitKey(o) : e.leaveKey(o, i.key, n), n
  26796. }, l.prototype._decodeGeneric = function(e, t, i) {
  26797. var r = this._baseState;
  26798. return "seq" === e || "set" === e ? null : "seqof" === e || "setof" === e ? this._decodeList(t, e, r
  26799. .args[0], i) : /str$/.test(e) ? this._decodeStr(t, e, i) : "objid" === e && r.args ? this
  26800. ._decodeObjid(t, r.args[0], r.args[1], i) : "objid" === e ? this._decodeObjid(t, null, null, i) :
  26801. "gentime" === e || "utctime" === e ? this._decodeTime(t, e, i) : "null_" === e ? this._decodeNull(t,
  26802. i) : "bool" === e ? this._decodeBool(t, i) : "objDesc" === e ? this._decodeStr(t, e, i) : "int" ===
  26803. e || "enum" === e ? this._decodeInt(t, r.args && r.args[0], i) : null !== r.use ? this._getUse(r.use,
  26804. t._reporterState.obj)._decode(t, i) : t.error("unknown tag: " + e)
  26805. }, l.prototype._getUse = function(e, t) {
  26806. var i = this._baseState;
  26807. return i.useDecoder = this._use(e, t), s(null === i.useDecoder._baseState.parent), i.useDecoder = i
  26808. .useDecoder._baseState.children[0], i.implicit !== i.useDecoder._baseState.implicit && (i.useDecoder =
  26809. i.useDecoder.clone(), i.useDecoder._baseState.implicit = i.implicit), i.useDecoder
  26810. }, l.prototype._decodeChoice = function(e, t) {
  26811. var i = this._baseState,
  26812. r = null,
  26813. n = !1;
  26814. return Object.keys(i.choice).some(function(a) {
  26815. var s = e.save(),
  26816. o = i.choice[a];
  26817. try {
  26818. var u = o._decode(e, t);
  26819. if (e.isError(u)) return !1;
  26820. r = {
  26821. type: a,
  26822. value: u
  26823. }, n = !0
  26824. } catch (t) {
  26825. return e.restore(s), !1
  26826. }
  26827. return !0
  26828. }, this), n ? r : e.error("Choice not matched")
  26829. }, l.prototype._createEncoderBuffer = function(e) {
  26830. return new n(e, this.reporter)
  26831. }, l.prototype._encode = function(e, t, i) {
  26832. var r = this._baseState;
  26833. if (null === r.default || r.default !== e) {
  26834. var n = this._encodeValue(e, t, i);
  26835. if (void 0 !== n && !this._skipDefault(n, t, i)) return n
  26836. }
  26837. }, l.prototype._encodeValue = function(e, t, i) {
  26838. var n = this._baseState;
  26839. if (null === n.parent) return n.children[0]._encode(e, t || new r);
  26840. var a = null;
  26841. if (this.reporter = t, n.optional && void 0 === e) {
  26842. if (null === n.default) return;
  26843. e = n.default
  26844. }
  26845. var s = null,
  26846. o = !1;
  26847. if (n.any) a = this._createEncoderBuffer(e);
  26848. else if (n.choice) a = this._encodeChoice(e, t);
  26849. else if (n.contains) s = this._getUse(n.contains, i)._encode(e, t), o = !0;
  26850. else if (n.children) s = n.children.map(function(i) {
  26851. if ("null_" === i._baseState.tag) return i._encode(null, t, e);
  26852. if (null === i._baseState.key) return t.error("Child should have a key");
  26853. var r = t.enterKey(i._baseState.key);
  26854. if ("object" != typeof e) return t.error("Child expected, but input is not object");
  26855. var n = i._encode(e[i._baseState.key], t, e);
  26856. return t.leaveKey(r), n
  26857. }, this).filter(function(e) {
  26858. return e
  26859. }), s = this._createEncoderBuffer(s);
  26860. else if ("seqof" === n.tag || "setof" === n.tag) {
  26861. if (!n.args || 1 !== n.args.length) return t.error("Too many args for : " + n.tag);
  26862. if (!Array.isArray(e)) return t.error("seqof/setof, but data is not Array");
  26863. var u = this.clone();
  26864. u._baseState.implicit = null, s = this._createEncoderBuffer(e.map(function(i) {
  26865. var r = this._baseState;
  26866. return this._getUse(r.args[0], e)._encode(i, t)
  26867. }, u))
  26868. } else null !== n.use ? a = this._getUse(n.use, i)._encode(e, t) : (s = this._encodePrimitive(n.tag, e),
  26869. o = !0);
  26870. if (!n.any && null === n.choice) {
  26871. var l = null !== n.implicit ? n.implicit : n.tag,
  26872. d = null === n.implicit ? "universal" : "context";
  26873. null === l ? null === n.use && t.error("Tag could be omitted only for .use()") : null === n.use && (
  26874. a = this._encodeComposite(l, o, d, s))
  26875. }
  26876. return null !== n.explicit && (a = this._encodeComposite(n.explicit, !1, "context", a)), a
  26877. }, l.prototype._encodeChoice = function(e, t) {
  26878. var i = this._baseState,
  26879. r = i.choice[e.type];
  26880. return r || s(!1, e.type + " not found in " + JSON.stringify(Object.keys(i.choice))), r._encode(e.value,
  26881. t)
  26882. }, l.prototype._encodePrimitive = function(e, t) {
  26883. var i = this._baseState;
  26884. if (/str$/.test(e)) return this._encodeStr(t, e);
  26885. if ("objid" === e && i.args) return this._encodeObjid(t, i.reverseArgs[0], i.args[1]);
  26886. if ("objid" === e) return this._encodeObjid(t, null, null);
  26887. if ("gentime" === e || "utctime" === e) return this._encodeTime(t, e);
  26888. if ("null_" === e) return this._encodeNull();
  26889. if ("int" === e || "enum" === e) return this._encodeInt(t, i.args && i.reverseArgs[0]);
  26890. if ("bool" === e) return this._encodeBool(t);
  26891. if ("objDesc" === e) return this._encodeStr(t, e);
  26892. throw new Error("Unsupported tag: " + e)
  26893. }, l.prototype._isNumstr = function(e) {
  26894. return /^[0-9 ]*$/.test(e)
  26895. }, l.prototype._isPrintstr = function(e) {
  26896. return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)
  26897. }
  26898. }, function(e, t, i) {
  26899. "use strict";
  26900. var r = i(5);
  26901. function n(e) {
  26902. this._reporterState = {
  26903. obj: null,
  26904. path: [],
  26905. options: e || {},
  26906. errors: []
  26907. }
  26908. }
  26909. function a(e, t) {
  26910. this.path = e, this.rethrow(t)
  26911. }
  26912. t.Reporter = n, n.prototype.isError = function(e) {
  26913. return e instanceof a
  26914. }, n.prototype.save = function() {
  26915. var e = this._reporterState;
  26916. return {
  26917. obj: e.obj,
  26918. pathLen: e.path.length
  26919. }
  26920. }, n.prototype.restore = function(e) {
  26921. var t = this._reporterState;
  26922. t.obj = e.obj, t.path = t.path.slice(0, e.pathLen)
  26923. }, n.prototype.enterKey = function(e) {
  26924. return this._reporterState.path.push(e)
  26925. }, n.prototype.exitKey = function(e) {
  26926. var t = this._reporterState;
  26927. t.path = t.path.slice(0, e - 1)
  26928. }, n.prototype.leaveKey = function(e, t, i) {
  26929. var r = this._reporterState;
  26930. this.exitKey(e), null !== r.obj && (r.obj[t] = i)
  26931. }, n.prototype.path = function() {
  26932. return this._reporterState.path.join("/")
  26933. }, n.prototype.enterObject = function() {
  26934. var e = this._reporterState,
  26935. t = e.obj;
  26936. return e.obj = {}, t
  26937. }, n.prototype.leaveObject = function(e) {
  26938. var t = this._reporterState,
  26939. i = t.obj;
  26940. return t.obj = e, i
  26941. }, n.prototype.error = function(e) {
  26942. var t, i = this._reporterState,
  26943. r = e instanceof a;
  26944. if (t = r ? e : new a(i.path.map(function(e) {
  26945. return "[" + JSON.stringify(e) + "]"
  26946. }).join(""), e.message || e, e.stack), !i.options.partial) throw t;
  26947. return r || i.errors.push(t), t
  26948. }, n.prototype.wrapResult = function(e) {
  26949. var t = this._reporterState;
  26950. return t.options.partial ? {
  26951. result: this.isError(e) ? null : e,
  26952. errors: t.errors
  26953. } : e
  26954. }, r(a, Error), a.prototype.rethrow = function(e) {
  26955. if (this.message = e + " at: " + (this.path || "(shallow)"), Error.captureStackTrace && Error
  26956. .captureStackTrace(this, a), !this.stack) try {
  26957. throw new Error(this.message)
  26958. } catch (e) {
  26959. this.stack = e.stack
  26960. }
  26961. return this
  26962. }
  26963. }, function(e, t, i) {
  26964. "use strict";
  26965. function r(e) {
  26966. var t = {};
  26967. return Object.keys(e).forEach(function(i) {
  26968. (0 | i) == i && (i |= 0);
  26969. var r = e[i];
  26970. t[r] = i
  26971. }), t
  26972. }
  26973. t.tagClass = {
  26974. 0: "universal",
  26975. 1: "application",
  26976. 2: "context",
  26977. 3: "private"
  26978. }, t.tagClassByName = r(t.tagClass), t.tag = {
  26979. 0: "end",
  26980. 1: "bool",
  26981. 2: "int",
  26982. 3: "bitstr",
  26983. 4: "octstr",
  26984. 5: "null_",
  26985. 6: "objid",
  26986. 7: "objDesc",
  26987. 8: "external",
  26988. 9: "real",
  26989. 10: "enum",
  26990. 11: "embed",
  26991. 12: "utf8str",
  26992. 13: "relativeOid",
  26993. 16: "seq",
  26994. 17: "set",
  26995. 18: "numstr",
  26996. 19: "printstr",
  26997. 20: "t61str",
  26998. 21: "videostr",
  26999. 22: "ia5str",
  27000. 23: "utctime",
  27001. 24: "gentime",
  27002. 25: "graphstr",
  27003. 26: "iso646str",
  27004. 27: "genstr",
  27005. 28: "unistr",
  27006. 29: "charstr",
  27007. 30: "bmpstr"
  27008. }, t.tagByName = r(t.tag)
  27009. }, function(e, t) {
  27010. var i = {}.toString;
  27011. e.exports = Array.isArray || function(e) {
  27012. return "[object Array]" == i.call(e)
  27013. }
  27014. }, function(e, t, i) {
  27015. "use strict";
  27016. i.r(t),
  27017. function(e, r, n, a) {
  27018. var s, o = i(1),
  27019. u = !1,
  27020. l = "",
  27021. d = void 0 !== d ? d : {};
  27022. function c() {
  27023. var t, o = {};
  27024. for (t in d) d.hasOwnProperty(t) && (o[t] = d[t]);
  27025. var u, c, h, f = [],
  27026. p = "./this.program",
  27027. m = function(e, t) {
  27028. throw t
  27029. },
  27030. g = !1,
  27031. v = !1;
  27032. if (g = "object" == typeof window, v = "function" == typeof importScripts, c = "object" == typeof e &&
  27033. "object" == typeof e.versions && "string" == typeof e.versions.node, u = c && !g && !v, h = !g && !
  27034. u && !v, d.ENVIRONMENT) throw new Error(
  27035. "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"
  27036. );
  27037. var y, _, b, w, E = "";
  27038. if (u) E = r + "/", y = function(e, t) {
  27039. var r;
  27040. return b || (b = i(69)), w || (w = i(70)), e = w.normalize(e), r = b.readFileSync(e), t ? r : r
  27041. .toString()
  27042. }, _ = function(e) {
  27043. var t = y(e, !0);
  27044. return t.buffer || (t = new Uint8Array(t)), I(t.buffer), t
  27045. }, e.argv.length > 1 && (p = e.argv[1].replace(/\\/g, "/")), f = e.argv.slice(2), n.exports = d, e
  27046. .on("uncaughtException", function(e) {
  27047. if (!(e instanceof ui)) throw e
  27048. }), e.on("unhandledRejection", ve), m = function(t) {
  27049. e.exit(t)
  27050. }, d.inspect = function() {
  27051. return "[Emscripten Module object]"
  27052. };
  27053. else if (h) "undefined" != typeof read && (y = function(e) {
  27054. return read(e)
  27055. }), _ = function(e) {
  27056. var t;
  27057. return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (I("object" == typeof(t =
  27058. read(e, "binary"))), t)
  27059. }, "undefined" != typeof scriptArgs ? f = scriptArgs : void 0 !== arguments && (f = arguments),
  27060. "function" == typeof quit && (m = function(e) {
  27061. quit(e)
  27062. }), "undefined" != typeof print && ("undefined" == typeof console && (console = {}), console.log =
  27063. print, console.warn = console.error = "undefined" != typeof printErr ? printErr : print);
  27064. else {
  27065. if (!g && !v) throw new Error("environment detection error");
  27066. v ? E = self.location.href : document.currentScript && (E = document.currentScript.src), E = 0 !== E
  27067. .indexOf("blob:") ? E.substr(0, E.lastIndexOf("/") + 1) : "", y = function(e) {
  27068. var t = new XMLHttpRequest;
  27069. return t.open("GET", e, !1), t.send(null), t.responseText
  27070. }, v && (_ = function(e) {
  27071. var t = new XMLHttpRequest;
  27072. return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t
  27073. .response)
  27074. })
  27075. }
  27076. var T = d.print || console.log.bind(console),
  27077. S = d.printErr || console.warn.bind(console);
  27078. for (t in o) o.hasOwnProperty(t) && (d[t] = o[t]);
  27079. function A(e) {
  27080. A.shown || (A.shown = {}), A.shown[e] || (A.shown[e] = 1, S(e))
  27081. }
  27082. function k(e, t) {
  27083. var i = C,
  27084. r = i.length;
  27085. try {
  27086. i.grow(1)
  27087. } catch (e) {
  27088. if (!e instanceof RangeError) throw e;
  27089. throw "Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."
  27090. }
  27091. try {
  27092. i.set(r, e)
  27093. } catch (a) {
  27094. if (!a instanceof TypeError) throw a;
  27095. I(void 0 !== t, "Missing signature argument to addFunction");
  27096. var n = function(e, t) {
  27097. var i = [1, 0, 1, 96],
  27098. r = t.slice(0, 1),
  27099. n = t.slice(1),
  27100. a = {
  27101. i: 127,
  27102. j: 126,
  27103. f: 125,
  27104. d: 124
  27105. };
  27106. i.push(n.length);
  27107. for (var s = 0; s < n.length; ++s) i.push(a[n[s]]);
  27108. "v" == r ? i.push(0) : i = i.concat([1, a[r]]), i[1] = i.length - 2;
  27109. var o = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0].concat(i, [2, 7, 1, 1, 101, 1, 102, 0, 0,
  27110. 7, 5, 1, 1, 102, 0, 0
  27111. ])),
  27112. u = new WebAssembly.Module(o);
  27113. return new WebAssembly.Instance(u, {
  27114. e: {
  27115. f: e
  27116. }
  27117. }).exports.f
  27118. }(e, t);
  27119. i.set(r, n)
  27120. }
  27121. return r
  27122. }
  27123. o = null, d.arguments && (f = d.arguments), Object.getOwnPropertyDescriptor(d, "arguments") || Object
  27124. .defineProperty(d, "arguments", {
  27125. configurable: !0,
  27126. get: function() {
  27127. ve("Module.arguments has been replaced with plain arguments_")
  27128. }
  27129. }), d.thisProgram && (p = d.thisProgram), Object.getOwnPropertyDescriptor(d, "thisProgram") ||
  27130. Object.defineProperty(d, "thisProgram", {
  27131. configurable: !0,
  27132. get: function() {
  27133. ve("Module.thisProgram has been replaced with plain thisProgram")
  27134. }
  27135. }), d.quit && (m = d.quit), Object.getOwnPropertyDescriptor(d, "quit") || Object.defineProperty(d,
  27136. "quit", {
  27137. configurable: !0,
  27138. get: function() {
  27139. ve("Module.quit has been replaced with plain quit_")
  27140. }
  27141. }), I(void 0 === d.memoryInitializerPrefixURL,
  27142. "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), I(
  27143. void 0 === d.pthreadMainPrefixURL,
  27144. "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d
  27145. .cdInitializerPrefixURL,
  27146. "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d
  27147. .filePackagePrefixURL,
  27148. "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d
  27149. .read, "Module.read option was removed (modify read_ in JS)"), I(void 0 === d.readAsync,
  27150. "Module.readAsync option was removed (modify readAsync in JS)"), I(void 0 === d.readBinary,
  27151. "Module.readBinary option was removed (modify readBinary in JS)"), I(void 0 === d.setWindowTitle,
  27152. "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"), Object
  27153. .getOwnPropertyDescriptor(d, "read") || Object.defineProperty(d, "read", {
  27154. configurable: !0,
  27155. get: function() {
  27156. ve("Module.read has been replaced with plain read_")
  27157. }
  27158. }), Object.getOwnPropertyDescriptor(d, "readAsync") || Object.defineProperty(d, "readAsync", {
  27159. configurable: !0,
  27160. get: function() {
  27161. ve("Module.readAsync has been replaced with plain readAsync")
  27162. }
  27163. }), Object.getOwnPropertyDescriptor(d, "readBinary") || Object.defineProperty(d, "readBinary", {
  27164. configurable: !0,
  27165. get: function() {
  27166. ve("Module.readBinary has been replaced with plain readBinary")
  27167. }
  27168. }), ai = oi = si = function() {
  27169. ve("cannot use the stack before compiled code is ready to run, and has provided stack access")
  27170. };
  27171. var R, M, O = function(e) {};
  27172. d.wasmBinary && (R = d.wasmBinary), Object.getOwnPropertyDescriptor(d, "wasmBinary") || Object
  27173. .defineProperty(d, "wasmBinary", {
  27174. configurable: !0,
  27175. get: function() {
  27176. ve("Module.wasmBinary has been replaced with plain wasmBinary")
  27177. }
  27178. }), d.noExitRuntime && (s = d.noExitRuntime), Object.getOwnPropertyDescriptor(d, "noExitRuntime") ||
  27179. Object.defineProperty(d, "noExitRuntime", {
  27180. configurable: !0,
  27181. get: function() {
  27182. ve("Module.noExitRuntime has been replaced with plain noExitRuntime")
  27183. }
  27184. }), "object" != typeof WebAssembly && ve(
  27185. "No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.");
  27186. var C = new WebAssembly.Table({
  27187. initial: 2542,
  27188. maximum: 2552,
  27189. element: "anyfunc"
  27190. }),
  27191. D = !1;
  27192. function I(e, t) {
  27193. e || ve("Assertion failed: " + t)
  27194. }
  27195. function L(e) {
  27196. var t = d["_" + e];
  27197. return I(t, "Cannot call unknown function " + e + ", make sure it is exported"), t
  27198. }
  27199. function x(e, t, i, r, n) {
  27200. var a = {
  27201. string: function(e) {
  27202. var t = 0;
  27203. if (null != e && 0 !== e) {
  27204. var i = 1 + (e.length << 2);
  27205. F(e, t = si(i), i)
  27206. }
  27207. return t
  27208. },
  27209. array: function(e) {
  27210. var t = si(e.length);
  27211. return function(e, t) {
  27212. I(e.length >= 0,
  27213. "writeArrayToMemory array must have a length (should be an array or typed array)"),
  27214. G.set(e, t)
  27215. }(e, t), t
  27216. }
  27217. },
  27218. s = L(e),
  27219. o = [],
  27220. u = 0;
  27221. if (I("array" !== t, 'Return type should not be "array".'), r)
  27222. for (var l = 0; l < r.length; l++) {
  27223. var d = a[i[l]];
  27224. d ? (0 === u && (u = ai()), o[l] = d(r[l])) : o[l] = r[l]
  27225. }
  27226. var c = s.apply(null, o);
  27227. return c = function(e) {
  27228. return "string" === t ? N(e) : "boolean" === t ? Boolean(e) : e
  27229. }(c), 0 !== u && oi(u), c
  27230. }
  27231. var P = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0;
  27232. function U(e, t, i) {
  27233. for (var r = t + i, n = t; e[n] && !(n >= r);) ++n;
  27234. if (n - t > 16 && e.subarray && P) return P.decode(e.subarray(t, n));
  27235. for (var a = ""; t < n;) {
  27236. var s = e[t++];
  27237. if (128 & s) {
  27238. var o = 63 & e[t++];
  27239. if (192 != (224 & s)) {
  27240. var u = 63 & e[t++];
  27241. if (224 == (240 & s) ? s = (15 & s) << 12 | o << 6 | u : (240 != (248 & s) && A(
  27242. "Invalid UTF-8 leading byte 0x" + s.toString(16) +
  27243. " encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"
  27244. ), s = (7 & s) << 18 | o << 12 | u << 6 | 63 & e[t++]), s < 65536) a += String
  27245. .fromCharCode(s);
  27246. else {
  27247. var l = s - 65536;
  27248. a += String.fromCharCode(55296 | l >> 10, 56320 | 1023 & l)
  27249. }
  27250. } else a += String.fromCharCode((31 & s) << 6 | o)
  27251. } else a += String.fromCharCode(s)
  27252. }
  27253. return a
  27254. }
  27255. function N(e, t) {
  27256. return e ? U(V, e, t) : ""
  27257. }
  27258. function B(e, t, i, r) {
  27259. if (!(r > 0)) return 0;
  27260. for (var n = i, a = i + r - 1, s = 0; s < e.length; ++s) {
  27261. var o = e.charCodeAt(s);
  27262. if (o >= 55296 && o <= 57343 && (o = 65536 + ((1023 & o) << 10) | 1023 & e.charCodeAt(++s)), o <=
  27263. 127) {
  27264. if (i >= a) break;
  27265. t[i++] = o
  27266. } else if (o <= 2047) {
  27267. if (i + 1 >= a) break;
  27268. t[i++] = 192 | o >> 6, t[i++] = 128 | 63 & o
  27269. } else if (o <= 65535) {
  27270. if (i + 2 >= a) break;
  27271. t[i++] = 224 | o >> 12, t[i++] = 128 | o >> 6 & 63, t[i++] = 128 | 63 & o
  27272. } else {
  27273. if (i + 3 >= a) break;
  27274. o >= 2097152 && A("Invalid Unicode code point 0x" + o.toString(16) +
  27275. " encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."
  27276. ), t[i++] = 240 | o >> 18, t[i++] = 128 | o >> 12 & 63, t[i++] = 128 | o >> 6 & 63, t[i++] =
  27277. 128 | 63 & o
  27278. }
  27279. }
  27280. return t[i] = 0, i - n
  27281. }
  27282. function F(e, t, i) {
  27283. return I("number" == typeof i,
  27284. "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"
  27285. ), B(e, V, t, i)
  27286. }
  27287. function j(e) {
  27288. for (var t = 0, i = 0; i < e.length; ++i) {
  27289. var r = e.charCodeAt(i);
  27290. r >= 55296 && r <= 57343 && (r = 65536 + ((1023 & r) << 10) | 1023 & e.charCodeAt(++i)), r <=
  27291. 127 ? ++t : t += r <= 2047 ? 2 : r <= 65535 ? 3 : 4
  27292. }
  27293. return t
  27294. }
  27295. "undefined" != typeof TextDecoder && new TextDecoder("utf-16le");
  27296. var H, G, V, W, q, X;
  27297. function z(e, t) {
  27298. return e % t > 0 && (e += t - e % t), e
  27299. }
  27300. function K(e) {
  27301. H = e, d.HEAP8 = G = new Int8Array(e), d.HEAP16 = W = new Int16Array(e), d.HEAP32 = q =
  27302. new Int32Array(e), d.HEAPU8 = V = new Uint8Array(e), d.HEAPU16 = new Uint16Array(e), d.HEAPU32 =
  27303. X = new Uint32Array(e), d.HEAPF32 = new Float32Array(e), d.HEAPF64 = new Float64Array(e)
  27304. }
  27305. var Y = 1341328;
  27306. I(!0, "stack must start aligned"), I(!0, "heap must start aligned");
  27307. var Q = 5242880;
  27308. d.TOTAL_STACK && I(Q === d.TOTAL_STACK, "the stack size can no longer be determined at runtime");
  27309. var J = d.TOTAL_MEMORY || 67108864;
  27310. function Z() {
  27311. I(0 == (3 & Y)), X[1 + (Y >> 2)] = 34821223, X[2 + (Y >> 2)] = 2310721022, q[0] = 1668509029
  27312. }
  27313. function $() {
  27314. var e = X[1 + (Y >> 2)],
  27315. t = X[2 + (Y >> 2)];
  27316. 34821223 == e && 2310721022 == t || ve(
  27317. "Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x" +
  27318. t.toString(16) + " " + e.toString(16)), 1668509029 !== q[0] && ve(
  27319. "Runtime error: The application has corrupted its heap memory area (address zero)!")
  27320. }
  27321. function ee(e) {
  27322. for (; e.length > 0;) {
  27323. var t = e.shift();
  27324. if ("function" != typeof t) {
  27325. var i = t.func;
  27326. "number" == typeof i ? void 0 === t.arg ? d.dynCall_v(i) : d.dynCall_vi(i, t.arg) : i(void 0 ===
  27327. t.arg ? null : t.arg)
  27328. } else t()
  27329. }
  27330. }
  27331. Object.getOwnPropertyDescriptor(d, "TOTAL_MEMORY") || Object.defineProperty(d, "TOTAL_MEMORY", {
  27332. configurable: !0,
  27333. get: function() {
  27334. ve("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY")
  27335. }
  27336. }), I(J >= Q, "TOTAL_MEMORY should be larger than TOTAL_STACK, was " + J + "! (TOTAL_STACK=" + Q +
  27337. ")"), I("undefined" != typeof Int32Array && "undefined" != typeof Float64Array && void 0 !==
  27338. Int32Array.prototype.subarray && void 0 !== Int32Array.prototype.set,
  27339. "JS engine does not provide full typed array support"), (M = d.wasmMemory ? d.wasmMemory :
  27340. new WebAssembly.Memory({
  27341. initial: J / 65536
  27342. })) && (H = M.buffer), I((J = H.byteLength) % 65536 == 0), K(H), q[335292] = 6584208,
  27343. function() {
  27344. var e = new Int16Array(1),
  27345. t = new Int8Array(e.buffer);
  27346. if (e[0] = 25459, 115 !== t[0] || 99 !== t[1])
  27347. throw "Runtime error: expected the system to be little-endian!"
  27348. }();
  27349. var te = [],
  27350. ie = [],
  27351. re = [],
  27352. ne = [],
  27353. ae = !1,
  27354. se = !1;
  27355. I(Math.imul,
  27356. "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  27357. ), I(Math.fround,
  27358. "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  27359. ), I(Math.clz32,
  27360. "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  27361. ), I(Math.trunc,
  27362. "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  27363. );
  27364. var oe = Math.abs,
  27365. ue = Math.ceil,
  27366. le = Math.floor,
  27367. de = Math.min,
  27368. ce = 0,
  27369. he = null,
  27370. fe = null,
  27371. pe = {};
  27372. function me(e) {
  27373. ce++, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(!pe[e]), pe[e] = 1, null ===
  27374. he && "undefined" != typeof setInterval && (he = setInterval(function() {
  27375. if (D) return clearInterval(he), void(he = null);
  27376. var e = !1;
  27377. for (var t in pe) e || (e = !0, S("still waiting on run dependencies:")), S(
  27378. "dependency: " + t);
  27379. e && S("(end of list)")
  27380. }, 1e4))) : S("warning: run dependency added without ID")
  27381. }
  27382. function ge(e) {
  27383. if (ce--, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(pe[e]), delete pe[e]) :
  27384. S("warning: run dependency removed without ID"), 0 == ce && (null !== he && (clearInterval(he),
  27385. he = null), fe)) {
  27386. var t = fe;
  27387. fe = null, t()
  27388. }
  27389. }
  27390. function ve(e) {
  27391. throw d.onAbort && d.onAbort(e), T(e += ""), S(e), D = !0, e = "abort(" + e + ") at " + Ae(),
  27392. new WebAssembly.RuntimeError(e)
  27393. }
  27394. d.preloadedImages = {}, d.preloadedAudios = {};
  27395. var ye = "data:application/octet-stream;base64,";
  27396. function _e(e) {
  27397. return String.prototype.startsWith ? e.startsWith(ye) : 0 === e.indexOf(ye)
  27398. }
  27399. // var be, we, Ee = l + "bigScreen/monitorWarn/EasyPlayer.wasm";
  27400. var be, we, Ee = l + "EasyPlayer.wasm";
  27401. function Te() {
  27402. try {
  27403. if (R) return new Uint8Array(R);
  27404. if (_) return _(Ee);
  27405. throw "both async and sync fetching of the wasm failed"
  27406. } catch (e) {
  27407. ve(e)
  27408. }
  27409. }
  27410. function Se(e) {
  27411. return e.replace(/\b_Z[\w\d_]+/g, function(e) {
  27412. var t = function(e) {
  27413. return A("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"), e
  27414. }(e);
  27415. return e === t ? e : t + " [" + e + "]"
  27416. })
  27417. }
  27418. function Ae() {
  27419. var e = function() {
  27420. var e = new Error;
  27421. if (!e.stack) {
  27422. try {
  27423. throw new Error(0)
  27424. } catch (t) {
  27425. e = t
  27426. }
  27427. if (!e.stack) return "(no stack trace available)"
  27428. }
  27429. return e.stack.toString()
  27430. }();
  27431. return d.extraStackTrace && (e += "\n" + d.extraStackTrace()), Se(e)
  27432. }
  27433. _e(Ee) || (Ee = function(e) {
  27434. return d.locateFile ? d.locateFile(e, E) : E + e
  27435. }(Ee)), ie.push({
  27436. func: function() {
  27437. ii()
  27438. }
  27439. });
  27440. var ke = {};
  27441. function Re(e) {
  27442. return d.___errno_location ? q[d.___errno_location() >> 2] = e : S("failed to set errno from JS"), e
  27443. }
  27444. var Me = {
  27445. splitPath: function(e) {
  27446. return /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)
  27447. },
  27448. normalizeArray: function(e, t) {
  27449. for (var i = 0, r = e.length - 1; r >= 0; r--) {
  27450. var n = e[r];
  27451. "." === n ? e.splice(r, 1) : ".." === n ? (e.splice(r, 1), i++) : i && (e.splice(r, 1), i--)
  27452. }
  27453. if (t)
  27454. for (; i; i--) e.unshift("..");
  27455. return e
  27456. },
  27457. normalize: function(e) {
  27458. var t = "/" === e.charAt(0),
  27459. i = "/" === e.substr(-1);
  27460. return (e = Me.normalizeArray(e.split("/").filter(function(e) {
  27461. return !!e
  27462. }), !t).join("/")) || t || (e = "."), e && i && (e += "/"), (t ? "/" : "") + e
  27463. },
  27464. dirname: function(e) {
  27465. var t = Me.splitPath(e),
  27466. i = t[0],
  27467. r = t[1];
  27468. return i || r ? (r && (r = r.substr(0, r.length - 1)), i + r) : "."
  27469. },
  27470. basename: function(e) {
  27471. if ("/" === e) return "/";
  27472. var t = e.lastIndexOf("/");
  27473. return -1 === t ? e : e.substr(t + 1)
  27474. },
  27475. extname: function(e) {
  27476. return Me.splitPath(e)[3]
  27477. },
  27478. join: function() {
  27479. var e = Array.prototype.slice.call(arguments, 0);
  27480. return Me.normalize(e.join("/"))
  27481. },
  27482. join2: function(e, t) {
  27483. return Me.normalize(e + "/" + t)
  27484. }
  27485. },
  27486. Oe = {
  27487. resolve: function() {
  27488. for (var e = "", t = !1, i = arguments.length - 1; i >= -1 && !t; i--) {
  27489. var r = i >= 0 ? arguments[i] : xe.cwd();
  27490. if ("string" != typeof r) throw new TypeError("Arguments to path.resolve must be strings");
  27491. if (!r) return "";
  27492. e = r + "/" + e, t = "/" === r.charAt(0)
  27493. }
  27494. return (t ? "/" : "") + (e = Me.normalizeArray(e.split("/").filter(function(e) {
  27495. return !!e
  27496. }), !t).join("/")) || "."
  27497. },
  27498. relative: function(e, t) {
  27499. function i(e) {
  27500. for (var t = 0; t < e.length && "" === e[t]; t++);
  27501. for (var i = e.length - 1; i >= 0 && "" === e[i]; i--);
  27502. return t > i ? [] : e.slice(t, i - t + 1)
  27503. }
  27504. e = Oe.resolve(e).substr(1), t = Oe.resolve(t).substr(1);
  27505. for (var r = i(e.split("/")), n = i(t.split("/")), a = Math.min(r.length, n.length), s = a,
  27506. o = 0; o < a; o++)
  27507. if (r[o] !== n[o]) {
  27508. s = o;
  27509. break
  27510. } var u = [];
  27511. for (o = s; o < r.length; o++) u.push("..");
  27512. return (u = u.concat(n.slice(s))).join("/")
  27513. }
  27514. },
  27515. Ce = {
  27516. ttys: [],
  27517. init: function() {},
  27518. shutdown: function() {},
  27519. register: function(e, t) {
  27520. Ce.ttys[e] = {
  27521. input: [],
  27522. output: [],
  27523. ops: t
  27524. }, xe.registerDevice(e, Ce.stream_ops)
  27525. },
  27526. stream_ops: {
  27527. open: function(e) {
  27528. var t = Ce.ttys[e.node.rdev];
  27529. if (!t) throw new xe.ErrnoError(43);
  27530. e.tty = t, e.seekable = !1
  27531. },
  27532. close: function(e) {
  27533. e.tty.ops.flush(e.tty)
  27534. },
  27535. flush: function(e) {
  27536. e.tty.ops.flush(e.tty)
  27537. },
  27538. read: function(e, t, i, r, n) {
  27539. if (!e.tty || !e.tty.ops.get_char) throw new xe.ErrnoError(60);
  27540. for (var a = 0, s = 0; s < r; s++) {
  27541. var o;
  27542. try {
  27543. o = e.tty.ops.get_char(e.tty)
  27544. } catch (e) {
  27545. throw new xe.ErrnoError(29)
  27546. }
  27547. if (void 0 === o && 0 === a) throw new xe.ErrnoError(6);
  27548. if (null == o) break;
  27549. a++, t[i + s] = o
  27550. }
  27551. return a && (e.node.timestamp = Date.now()), a
  27552. },
  27553. write: function(e, t, i, r, n) {
  27554. if (!e.tty || !e.tty.ops.put_char) throw new xe.ErrnoError(60);
  27555. try {
  27556. for (var a = 0; a < r; a++) e.tty.ops.put_char(e.tty, t[i + a])
  27557. } catch (e) {
  27558. throw new xe.ErrnoError(29)
  27559. }
  27560. return r && (e.node.timestamp = Date.now()), a
  27561. }
  27562. },
  27563. default_tty_ops: {
  27564. get_char: function(t) {
  27565. if (!t.input.length) {
  27566. var i = null;
  27567. if (u) {
  27568. var r = a.alloc ? a.alloc(256) : new a(256),
  27569. n = 0;
  27570. try {
  27571. n = b.readSync(e.stdin.fd, r, 0, 256, null)
  27572. } catch (e) {
  27573. if (-1 == e.toString().indexOf("EOF")) throw e;
  27574. n = 0
  27575. }
  27576. i = n > 0 ? r.slice(0, n).toString("utf-8") : null
  27577. } else "undefined" != typeof window && "function" == typeof window.prompt ? null !== (i =
  27578. window.prompt("Input: ")) && (i += "\n") : "function" == typeof readline && null !== (
  27579. i = readline()) && (i += "\n");
  27580. if (!i) return null;
  27581. t.input = Be(i, !0)
  27582. }
  27583. return t.input.shift()
  27584. },
  27585. put_char: function(e, t) {
  27586. null === t || 10 === t ? e.output = [] : 0 != t && e.output.push(t)
  27587. },
  27588. flush: function(e) {
  27589. e.output && e.output.length > 0 && (e.output = [])
  27590. }
  27591. },
  27592. default_tty1_ops: {
  27593. put_char: function(e, t) {
  27594. null === t || 10 === t ? (S(U(e.output, 0)), e.output = []) : 0 != t && e.output.push(t)
  27595. },
  27596. flush: function(e) {
  27597. e.output && e.output.length > 0 && (S(U(e.output, 0)), e.output = [])
  27598. }
  27599. }
  27600. },
  27601. De = {
  27602. ops_table: null,
  27603. mount: function(e) {
  27604. return De.createNode(null, "/", 16895, 0)
  27605. },
  27606. createNode: function(e, t, i, r) {
  27607. if (xe.isBlkdev(i) || xe.isFIFO(i)) throw new xe.ErrnoError(63);
  27608. De.ops_table || (De.ops_table = {
  27609. dir: {
  27610. node: {
  27611. getattr: De.node_ops.getattr,
  27612. setattr: De.node_ops.setattr,
  27613. lookup: De.node_ops.lookup,
  27614. mknod: De.node_ops.mknod,
  27615. rename: De.node_ops.rename,
  27616. unlink: De.node_ops.unlink,
  27617. rmdir: De.node_ops.rmdir,
  27618. readdir: De.node_ops.readdir,
  27619. symlink: De.node_ops.symlink
  27620. },
  27621. stream: {
  27622. llseek: De.stream_ops.llseek
  27623. }
  27624. },
  27625. file: {
  27626. node: {
  27627. getattr: De.node_ops.getattr,
  27628. setattr: De.node_ops.setattr
  27629. },
  27630. stream: {
  27631. llseek: De.stream_ops.llseek,
  27632. read: De.stream_ops.read,
  27633. write: De.stream_ops.write,
  27634. allocate: De.stream_ops.allocate,
  27635. mmap: De.stream_ops.mmap,
  27636. msync: De.stream_ops.msync
  27637. }
  27638. },
  27639. link: {
  27640. node: {
  27641. getattr: De.node_ops.getattr,
  27642. setattr: De.node_ops.setattr,
  27643. readlink: De.node_ops.readlink
  27644. },
  27645. stream: {}
  27646. },
  27647. chrdev: {
  27648. node: {
  27649. getattr: De.node_ops.getattr,
  27650. setattr: De.node_ops.setattr
  27651. },
  27652. stream: xe.chrdev_stream_ops
  27653. }
  27654. });
  27655. var n = xe.createNode(e, t, i, r);
  27656. return xe.isDir(n.mode) ? (n.node_ops = De.ops_table.dir.node, n.stream_ops = De.ops_table.dir
  27657. .stream, n.contents = {}) : xe.isFile(n.mode) ? (n.node_ops = De.ops_table.file.node, n
  27658. .stream_ops = De.ops_table.file.stream, n.usedBytes = 0, n.contents = null) : xe.isLink(n
  27659. .mode) ? (n.node_ops = De.ops_table.link.node, n.stream_ops = De.ops_table.link.stream) :
  27660. xe.isChrdev(n.mode) && (n.node_ops = De.ops_table.chrdev.node, n.stream_ops = De.ops_table
  27661. .chrdev.stream), n.timestamp = Date.now(), e && (e.contents[t] = n), n
  27662. },
  27663. getFileDataAsRegularArray: function(e) {
  27664. if (e.contents && e.contents.subarray) {
  27665. for (var t = [], i = 0; i < e.usedBytes; ++i) t.push(e.contents[i]);
  27666. return t
  27667. }
  27668. return e.contents
  27669. },
  27670. getFileDataAsTypedArray: function(e) {
  27671. return e.contents ? e.contents.subarray ? e.contents.subarray(0, e.usedBytes) :
  27672. new Uint8Array(e.contents) : new Uint8Array
  27673. },
  27674. expandFileStorage: function(e, t) {
  27675. var i = e.contents ? e.contents.length : 0;
  27676. if (!(i >= t)) {
  27677. t = Math.max(t, i * (i < 1048576 ? 2 : 1.125) | 0), 0 != i && (t = Math.max(t, 256));
  27678. var r = e.contents;
  27679. e.contents = new Uint8Array(t), e.usedBytes > 0 && e.contents.set(r.subarray(0, e
  27680. .usedBytes), 0)
  27681. }
  27682. },
  27683. resizeFileStorage: function(e, t) {
  27684. if (e.usedBytes != t) {
  27685. if (0 == t) return e.contents = null, void(e.usedBytes = 0);
  27686. if (!e.contents || e.contents.subarray) {
  27687. var i = e.contents;
  27688. return e.contents = new Uint8Array(new ArrayBuffer(t)), i && e.contents.set(i.subarray(0,
  27689. Math.min(t, e.usedBytes))), void(e.usedBytes = t)
  27690. }
  27691. if (e.contents || (e.contents = []), e.contents.length > t) e.contents.length = t;
  27692. else
  27693. for (; e.contents.length < t;) e.contents.push(0);
  27694. e.usedBytes = t
  27695. }
  27696. },
  27697. node_ops: {
  27698. getattr: function(e) {
  27699. var t = {};
  27700. return t.dev = xe.isChrdev(e.mode) ? e.id : 1, t.ino = e.id, t.mode = e.mode, t.nlink = 1, t
  27701. .uid = 0, t.gid = 0, t.rdev = e.rdev, xe.isDir(e.mode) ? t.size = 4096 : xe.isFile(e
  27702. .mode) ? t.size = e.usedBytes : xe.isLink(e.mode) ? t.size = e.link.length : t.size = 0, t
  27703. .atime = new Date(e.timestamp), t.mtime = new Date(e.timestamp), t.ctime = new Date(e
  27704. .timestamp), t.blksize = 4096, t.blocks = Math.ceil(t.size / t.blksize), t
  27705. },
  27706. setattr: function(e, t) {
  27707. void 0 !== t.mode && (e.mode = t.mode), void 0 !== t.timestamp && (e.timestamp = t
  27708. .timestamp), void 0 !== t.size && De.resizeFileStorage(e, t.size)
  27709. },
  27710. lookup: function(e, t) {
  27711. throw xe.genericErrors[44]
  27712. },
  27713. mknod: function(e, t, i, r) {
  27714. return De.createNode(e, t, i, r)
  27715. },
  27716. rename: function(e, t, i) {
  27717. if (xe.isDir(e.mode)) {
  27718. var r;
  27719. try {
  27720. r = xe.lookupNode(t, i)
  27721. } catch (e) {}
  27722. if (r)
  27723. for (var n in r.contents) throw new xe.ErrnoError(55)
  27724. }
  27725. delete e.parent.contents[e.name], e.name = i, t.contents[i] = e, e.parent = t
  27726. },
  27727. unlink: function(e, t) {
  27728. delete e.contents[t]
  27729. },
  27730. rmdir: function(e, t) {
  27731. var i = xe.lookupNode(e, t);
  27732. for (var r in i.contents) throw new xe.ErrnoError(55);
  27733. delete e.contents[t]
  27734. },
  27735. readdir: function(e) {
  27736. var t = [".", ".."];
  27737. for (var i in e.contents) e.contents.hasOwnProperty(i) && t.push(i);
  27738. return t
  27739. },
  27740. symlink: function(e, t, i) {
  27741. var r = De.createNode(e, t, 41471, 0);
  27742. return r.link = i, r
  27743. },
  27744. readlink: function(e) {
  27745. if (!xe.isLink(e.mode)) throw new xe.ErrnoError(28);
  27746. return e.link
  27747. }
  27748. },
  27749. stream_ops: {
  27750. read: function(e, t, i, r, n) {
  27751. var a = e.node.contents;
  27752. if (n >= e.node.usedBytes) return 0;
  27753. var s = Math.min(e.node.usedBytes - n, r);
  27754. if (I(s >= 0), s > 8 && a.subarray) t.set(a.subarray(n, n + s), i);
  27755. else
  27756. for (var o = 0; o < s; o++) t[i + o] = a[n + o];
  27757. return s
  27758. },
  27759. write: function(e, t, i, r, n, a) {
  27760. if (a && A(
  27761. "file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)"
  27762. ), a = !1, !r) return 0;
  27763. var s = e.node;
  27764. if (s.timestamp = Date.now(), t.subarray && (!s.contents || s.contents.subarray)) {
  27765. if (a) return I(0 === n, "canOwn must imply no weird position inside the file"), s
  27766. .contents = t.subarray(i, i + r), s.usedBytes = r, r;
  27767. if (0 === s.usedBytes && 0 === n) return s.contents = new Uint8Array(t.subarray(i, i +
  27768. r)), s.usedBytes = r, r;
  27769. if (n + r <= s.usedBytes) return s.contents.set(t.subarray(i, i + r), n), r
  27770. }
  27771. if (De.expandFileStorage(s, n + r), s.contents.subarray && t.subarray) s.contents.set(t
  27772. .subarray(i, i + r), n);
  27773. else
  27774. for (var o = 0; o < r; o++) s.contents[n + o] = t[i + o];
  27775. return s.usedBytes = Math.max(s.usedBytes, n + r), r
  27776. },
  27777. llseek: function(e, t, i) {
  27778. var r = t;
  27779. if (1 === i ? r += e.position : 2 === i && xe.isFile(e.node.mode) && (r += e.node
  27780. .usedBytes), r < 0) throw new xe.ErrnoError(28);
  27781. return r
  27782. },
  27783. allocate: function(e, t, i) {
  27784. De.expandFileStorage(e.node, t + i), e.node.usedBytes = Math.max(e.node.usedBytes, t + i)
  27785. },
  27786. mmap: function(e, t, i, r, n, a, s) {
  27787. if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43);
  27788. var o, u, l = e.node.contents;
  27789. if (2 & s || l.buffer !== t && l.buffer !== t.buffer) {
  27790. (n > 0 || n + r < e.node.usedBytes) && (l = l.subarray ? l.subarray(n, n + r) : Array
  27791. .prototype.slice.call(l, n, n + r)), u = !0;
  27792. var d = t.buffer == G.buffer;
  27793. if (!(o = ri(r))) throw new xe.ErrnoError(48);
  27794. (d ? G : t).set(l, o)
  27795. } else u = !1, o = l.byteOffset;
  27796. return {
  27797. ptr: o,
  27798. allocated: u
  27799. }
  27800. },
  27801. msync: function(e, t, i, r, n) {
  27802. if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43);
  27803. return 2 & n ? 0 : (De.stream_ops.write(e, t, 0, r, i, !1), 0)
  27804. }
  27805. }
  27806. },
  27807. Ie = {
  27808. 0: "Success",
  27809. 1: "Arg list too long",
  27810. 2: "Permission denied",
  27811. 3: "Address already in use",
  27812. 4: "Address not available",
  27813. 5: "Address family not supported by protocol family",
  27814. 6: "No more processes",
  27815. 7: "Socket already connected",
  27816. 8: "Bad file number",
  27817. 9: "Trying to read unreadable message",
  27818. 10: "Mount device busy",
  27819. 11: "Operation canceled",
  27820. 12: "No children",
  27821. 13: "Connection aborted",
  27822. 14: "Connection refused",
  27823. 15: "Connection reset by peer",
  27824. 16: "File locking deadlock error",
  27825. 17: "Destination address required",
  27826. 18: "Math arg out of domain of func",
  27827. 19: "Quota exceeded",
  27828. 20: "File exists",
  27829. 21: "Bad address",
  27830. 22: "File too large",
  27831. 23: "Host is unreachable",
  27832. 24: "Identifier removed",
  27833. 25: "Illegal byte sequence",
  27834. 26: "Connection already in progress",
  27835. 27: "Interrupted system call",
  27836. 28: "Invalid argument",
  27837. 29: "I/O error",
  27838. 30: "Socket is already connected",
  27839. 31: "Is a directory",
  27840. 32: "Too many symbolic links",
  27841. 33: "Too many open files",
  27842. 34: "Too many links",
  27843. 35: "Message too long",
  27844. 36: "Multihop attempted",
  27845. 37: "File or path name too long",
  27846. 38: "Network interface is not configured",
  27847. 39: "Connection reset by network",
  27848. 40: "Network is unreachable",
  27849. 41: "Too many open files in system",
  27850. 42: "No buffer space available",
  27851. 43: "No such device",
  27852. 44: "No such file or directory",
  27853. 45: "Exec format error",
  27854. 46: "No record locks available",
  27855. 47: "The link has been severed",
  27856. 48: "Not enough core",
  27857. 49: "No message of desired type",
  27858. 50: "Protocol not available",
  27859. 51: "No space left on device",
  27860. 52: "Function not implemented",
  27861. 53: "Socket is not connected",
  27862. 54: "Not a directory",
  27863. 55: "Directory not empty",
  27864. 56: "State not recoverable",
  27865. 57: "Socket operation on non-socket",
  27866. 59: "Not a typewriter",
  27867. 60: "No such device or address",
  27868. 61: "Value too large for defined data type",
  27869. 62: "Previous owner died",
  27870. 63: "Not super-user",
  27871. 64: "Broken pipe",
  27872. 65: "Protocol error",
  27873. 66: "Unknown protocol",
  27874. 67: "Protocol wrong type for socket",
  27875. 68: "Math result not representable",
  27876. 69: "Read only file system",
  27877. 70: "Illegal seek",
  27878. 71: "No such process",
  27879. 72: "Stale file handle",
  27880. 73: "Connection timed out",
  27881. 74: "Text file busy",
  27882. 75: "Cross-device link",
  27883. 100: "Device not a stream",
  27884. 101: "Bad font file fmt",
  27885. 102: "Invalid slot",
  27886. 103: "Invalid request code",
  27887. 104: "No anode",
  27888. 105: "Block device required",
  27889. 106: "Channel number out of range",
  27890. 107: "Level 3 halted",
  27891. 108: "Level 3 reset",
  27892. 109: "Link number out of range",
  27893. 110: "Protocol driver not attached",
  27894. 111: "No CSI structure available",
  27895. 112: "Level 2 halted",
  27896. 113: "Invalid exchange",
  27897. 114: "Invalid request descriptor",
  27898. 115: "Exchange full",
  27899. 116: "No data (for no delay io)",
  27900. 117: "Timer expired",
  27901. 118: "Out of streams resources",
  27902. 119: "Machine is not on the network",
  27903. 120: "Package not installed",
  27904. 121: "The object is remote",
  27905. 122: "Advertise error",
  27906. 123: "Srmount error",
  27907. 124: "Communication error on send",
  27908. 125: "Cross mount point (not really error)",
  27909. 126: "Given log. name not unique",
  27910. 127: "f.d. invalid for this operation",
  27911. 128: "Remote address changed",
  27912. 129: "Can access a needed shared lib",
  27913. 130: "Accessing a corrupted shared lib",
  27914. 131: ".lib section in a.out corrupted",
  27915. 132: "Attempting to link in too many libs",
  27916. 133: "Attempting to exec a shared library",
  27917. 135: "Streams pipe error",
  27918. 136: "Too many users",
  27919. 137: "Socket type not supported",
  27920. 138: "Not supported",
  27921. 139: "Protocol family not supported",
  27922. 140: "Can't send after socket shutdown",
  27923. 141: "Too many references",
  27924. 142: "Host is down",
  27925. 148: "No medium (in tape drive)",
  27926. 156: "Level 2 not synchronized"
  27927. },
  27928. Le = {
  27929. EPERM: 63,
  27930. ENOENT: 44,
  27931. ESRCH: 71,
  27932. EINTR: 27,
  27933. EIO: 29,
  27934. ENXIO: 60,
  27935. E2BIG: 1,
  27936. ENOEXEC: 45,
  27937. EBADF: 8,
  27938. ECHILD: 12,
  27939. EAGAIN: 6,
  27940. EWOULDBLOCK: 6,
  27941. ENOMEM: 48,
  27942. EACCES: 2,
  27943. EFAULT: 21,
  27944. ENOTBLK: 105,
  27945. EBUSY: 10,
  27946. EEXIST: 20,
  27947. EXDEV: 75,
  27948. ENODEV: 43,
  27949. ENOTDIR: 54,
  27950. EISDIR: 31,
  27951. EINVAL: 28,
  27952. ENFILE: 41,
  27953. EMFILE: 33,
  27954. ENOTTY: 59,
  27955. ETXTBSY: 74,
  27956. EFBIG: 22,
  27957. ENOSPC: 51,
  27958. ESPIPE: 70,
  27959. EROFS: 69,
  27960. EMLINK: 34,
  27961. EPIPE: 64,
  27962. EDOM: 18,
  27963. ERANGE: 68,
  27964. ENOMSG: 49,
  27965. EIDRM: 24,
  27966. ECHRNG: 106,
  27967. EL2NSYNC: 156,
  27968. EL3HLT: 107,
  27969. EL3RST: 108,
  27970. ELNRNG: 109,
  27971. EUNATCH: 110,
  27972. ENOCSI: 111,
  27973. EL2HLT: 112,
  27974. EDEADLK: 16,
  27975. ENOLCK: 46,
  27976. EBADE: 113,
  27977. EBADR: 114,
  27978. EXFULL: 115,
  27979. ENOANO: 104,
  27980. EBADRQC: 103,
  27981. EBADSLT: 102,
  27982. EDEADLOCK: 16,
  27983. EBFONT: 101,
  27984. ENOSTR: 100,
  27985. ENODATA: 116,
  27986. ETIME: 117,
  27987. ENOSR: 118,
  27988. ENONET: 119,
  27989. ENOPKG: 120,
  27990. EREMOTE: 121,
  27991. ENOLINK: 47,
  27992. EADV: 122,
  27993. ESRMNT: 123,
  27994. ECOMM: 124,
  27995. EPROTO: 65,
  27996. EMULTIHOP: 36,
  27997. EDOTDOT: 125,
  27998. EBADMSG: 9,
  27999. ENOTUNIQ: 126,
  28000. EBADFD: 127,
  28001. EREMCHG: 128,
  28002. ELIBACC: 129,
  28003. ELIBBAD: 130,
  28004. ELIBSCN: 131,
  28005. ELIBMAX: 132,
  28006. ELIBEXEC: 133,
  28007. ENOSYS: 52,
  28008. ENOTEMPTY: 55,
  28009. ENAMETOOLONG: 37,
  28010. ELOOP: 32,
  28011. EOPNOTSUPP: 138,
  28012. EPFNOSUPPORT: 139,
  28013. ECONNRESET: 15,
  28014. ENOBUFS: 42,
  28015. EAFNOSUPPORT: 5,
  28016. EPROTOTYPE: 67,
  28017. ENOTSOCK: 57,
  28018. ENOPROTOOPT: 50,
  28019. ESHUTDOWN: 140,
  28020. ECONNREFUSED: 14,
  28021. EADDRINUSE: 3,
  28022. ECONNABORTED: 13,
  28023. ENETUNREACH: 40,
  28024. ENETDOWN: 38,
  28025. ETIMEDOUT: 73,
  28026. EHOSTDOWN: 142,
  28027. EHOSTUNREACH: 23,
  28028. EINPROGRESS: 26,
  28029. EALREADY: 7,
  28030. EDESTADDRREQ: 17,
  28031. EMSGSIZE: 35,
  28032. EPROTONOSUPPORT: 66,
  28033. ESOCKTNOSUPPORT: 137,
  28034. EADDRNOTAVAIL: 4,
  28035. ENETRESET: 39,
  28036. EISCONN: 30,
  28037. ENOTCONN: 53,
  28038. ETOOMANYREFS: 141,
  28039. EUSERS: 136,
  28040. EDQUOT: 19,
  28041. ESTALE: 72,
  28042. ENOTSUP: 138,
  28043. ENOMEDIUM: 148,
  28044. EILSEQ: 25,
  28045. EOVERFLOW: 61,
  28046. ECANCELED: 11,
  28047. ENOTRECOVERABLE: 56,
  28048. EOWNERDEAD: 62,
  28049. ESTRPIPE: 135
  28050. },
  28051. xe = {
  28052. root: null,
  28053. mounts: [],
  28054. devices: {},
  28055. streams: [],
  28056. nextInode: 1,
  28057. nameTable: null,
  28058. currentPath: "/",
  28059. initialized: !1,
  28060. ignorePermissions: !0,
  28061. trackingDelegate: {},
  28062. tracking: {
  28063. openFlags: {
  28064. READ: 1,
  28065. WRITE: 2
  28066. }
  28067. },
  28068. ErrnoError: null,
  28069. genericErrors: {},
  28070. filesystems: null,
  28071. syncFSRequests: 0,
  28072. handleFSError: function(e) {
  28073. if (!(e instanceof xe.ErrnoError)) throw e + " : " + Ae();
  28074. return Re(e.errno)
  28075. },
  28076. lookupPath: function(e, t) {
  28077. if (t = t || {}, !(e = Oe.resolve(xe.cwd(), e))) return {
  28078. path: "",
  28079. node: null
  28080. };
  28081. var i = {
  28082. follow_mount: !0,
  28083. recurse_count: 0
  28084. };
  28085. for (var r in i) void 0 === t[r] && (t[r] = i[r]);
  28086. if (t.recurse_count > 8) throw new xe.ErrnoError(32);
  28087. for (var n = Me.normalizeArray(e.split("/").filter(function(e) {
  28088. return !!e
  28089. }), !1), a = xe.root, s = "/", o = 0; o < n.length; o++) {
  28090. var u = o === n.length - 1;
  28091. if (u && t.parent) break;
  28092. if (a = xe.lookupNode(a, n[o]), s = Me.join2(s, n[o]), xe.isMountpoint(a) && (!u || u && t
  28093. .follow_mount) && (a = a.mounted.root), !u || t.follow)
  28094. for (var l = 0; xe.isLink(a.mode);) {
  28095. var d = xe.readlink(s);
  28096. if (s = Oe.resolve(Me.dirname(s), d), a = xe.lookupPath(s, {
  28097. recurse_count: t.recurse_count
  28098. }).node, l++ > 40) throw new xe.ErrnoError(32)
  28099. }
  28100. }
  28101. return {
  28102. path: s,
  28103. node: a
  28104. }
  28105. },
  28106. getPath: function(e) {
  28107. for (var t;;) {
  28108. if (xe.isRoot(e)) {
  28109. var i = e.mount.mountpoint;
  28110. return t ? "/" !== i[i.length - 1] ? i + "/" + t : i + t : i
  28111. }
  28112. t = t ? e.name + "/" + t : e.name, e = e.parent
  28113. }
  28114. },
  28115. hashName: function(e, t) {
  28116. for (var i = 0, r = 0; r < t.length; r++) i = (i << 5) - i + t.charCodeAt(r) | 0;
  28117. return (e + i >>> 0) % xe.nameTable.length
  28118. },
  28119. hashAddNode: function(e) {
  28120. var t = xe.hashName(e.parent.id, e.name);
  28121. e.name_next = xe.nameTable[t], xe.nameTable[t] = e
  28122. },
  28123. hashRemoveNode: function(e) {
  28124. var t = xe.hashName(e.parent.id, e.name);
  28125. if (xe.nameTable[t] === e) xe.nameTable[t] = e.name_next;
  28126. else
  28127. for (var i = xe.nameTable[t]; i;) {
  28128. if (i.name_next === e) {
  28129. i.name_next = e.name_next;
  28130. break
  28131. }
  28132. i = i.name_next
  28133. }
  28134. },
  28135. lookupNode: function(e, t) {
  28136. var i = xe.mayLookup(e);
  28137. if (i) throw new xe.ErrnoError(i, e);
  28138. for (var r = xe.hashName(e.id, t), n = xe.nameTable[r]; n; n = n.name_next) {
  28139. var a = n.name;
  28140. if (n.parent.id === e.id && a === t) return n
  28141. }
  28142. return xe.lookup(e, t)
  28143. },
  28144. createNode: function(e, t, i, r) {
  28145. xe.FSNode || (xe.FSNode = function(e, t, i, r) {
  28146. e || (e = this), this.parent = e, this.mount = e.mount, this.mounted = null, this.id =
  28147. xe.nextInode++, this.name = t, this.mode = i, this.node_ops = {}, this
  28148. .stream_ops = {}, this.rdev = r
  28149. }, xe.FSNode.prototype = {}, Object.defineProperties(xe.FSNode.prototype, {
  28150. read: {
  28151. get: function() {
  28152. return 365 == (365 & this.mode)
  28153. },
  28154. set: function(e) {
  28155. e ? this.mode |= 365 : this.mode &= -366
  28156. }
  28157. },
  28158. write: {
  28159. get: function() {
  28160. return 146 == (146 & this.mode)
  28161. },
  28162. set: function(e) {
  28163. e ? this.mode |= 146 : this.mode &= -147
  28164. }
  28165. },
  28166. isFolder: {
  28167. get: function() {
  28168. return xe.isDir(this.mode)
  28169. }
  28170. },
  28171. isDevice: {
  28172. get: function() {
  28173. return xe.isChrdev(this.mode)
  28174. }
  28175. }
  28176. }));
  28177. var n = new xe.FSNode(e, t, i, r);
  28178. return xe.hashAddNode(n), n
  28179. },
  28180. destroyNode: function(e) {
  28181. xe.hashRemoveNode(e)
  28182. },
  28183. isRoot: function(e) {
  28184. return e === e.parent
  28185. },
  28186. isMountpoint: function(e) {
  28187. return !!e.mounted
  28188. },
  28189. isFile: function(e) {
  28190. return 32768 == (61440 & e)
  28191. },
  28192. isDir: function(e) {
  28193. return 16384 == (61440 & e)
  28194. },
  28195. isLink: function(e) {
  28196. return 40960 == (61440 & e)
  28197. },
  28198. isChrdev: function(e) {
  28199. return 8192 == (61440 & e)
  28200. },
  28201. isBlkdev: function(e) {
  28202. return 24576 == (61440 & e)
  28203. },
  28204. isFIFO: function(e) {
  28205. return 4096 == (61440 & e)
  28206. },
  28207. isSocket: function(e) {
  28208. return 49152 == (49152 & e)
  28209. },
  28210. flagModes: {
  28211. r: 0,
  28212. rs: 1052672,
  28213. "r+": 2,
  28214. w: 577,
  28215. wx: 705,
  28216. xw: 705,
  28217. "w+": 578,
  28218. "wx+": 706,
  28219. "xw+": 706,
  28220. a: 1089,
  28221. ax: 1217,
  28222. xa: 1217,
  28223. "a+": 1090,
  28224. "ax+": 1218,
  28225. "xa+": 1218
  28226. },
  28227. modeStringToFlags: function(e) {
  28228. var t = xe.flagModes[e];
  28229. if (void 0 === t) throw new Error("Unknown file open mode: " + e);
  28230. return t
  28231. },
  28232. flagsToPermissionString: function(e) {
  28233. var t = ["r", "w", "rw"][3 & e];
  28234. return 512 & e && (t += "w"), t
  28235. },
  28236. nodePermissions: function(e, t) {
  28237. return xe.ignorePermissions || (-1 === t.indexOf("r") || 292 & e.mode) && (-1 === t.indexOf(
  28238. "w") || 146 & e.mode) && (-1 === t.indexOf("x") || 73 & e.mode) ? 0 : 2
  28239. },
  28240. mayLookup: function(e) {
  28241. return xe.nodePermissions(e, "x") || (e.node_ops.lookup ? 0 : 2)
  28242. },
  28243. mayCreate: function(e, t) {
  28244. try {
  28245. return xe.lookupNode(e, t), 20
  28246. } catch (e) {}
  28247. return xe.nodePermissions(e, "wx")
  28248. },
  28249. mayDelete: function(e, t, i) {
  28250. var r;
  28251. try {
  28252. r = xe.lookupNode(e, t)
  28253. } catch (e) {
  28254. return e.errno
  28255. }
  28256. var n = xe.nodePermissions(e, "wx");
  28257. if (n) return n;
  28258. if (i) {
  28259. if (!xe.isDir(r.mode)) return 54;
  28260. if (xe.isRoot(r) || xe.getPath(r) === xe.cwd()) return 10
  28261. } else if (xe.isDir(r.mode)) return 31;
  28262. return 0
  28263. },
  28264. mayOpen: function(e, t) {
  28265. return e ? xe.isLink(e.mode) ? 32 : xe.isDir(e.mode) && ("r" !== xe.flagsToPermissionString(
  28266. t) || 512 & t) ? 31 : xe.nodePermissions(e, xe.flagsToPermissionString(t)) : 44
  28267. },
  28268. MAX_OPEN_FDS: 4096,
  28269. nextfd: function(e, t) {
  28270. e = e || 0, t = t || xe.MAX_OPEN_FDS;
  28271. for (var i = e; i <= t; i++)
  28272. if (!xe.streams[i]) return i;
  28273. throw new xe.ErrnoError(33)
  28274. },
  28275. getStream: function(e) {
  28276. return xe.streams[e]
  28277. },
  28278. createStream: function(e, t, i) {
  28279. xe.FSStream || (xe.FSStream = function() {}, xe.FSStream.prototype = {}, Object
  28280. .defineProperties(xe.FSStream.prototype, {
  28281. object: {
  28282. get: function() {
  28283. return this.node
  28284. },
  28285. set: function(e) {
  28286. this.node = e
  28287. }
  28288. },
  28289. isRead: {
  28290. get: function() {
  28291. return 1 != (2097155 & this.flags)
  28292. }
  28293. },
  28294. isWrite: {
  28295. get: function() {
  28296. return 0 != (2097155 & this.flags)
  28297. }
  28298. },
  28299. isAppend: {
  28300. get: function() {
  28301. return 1024 & this.flags
  28302. }
  28303. }
  28304. }));
  28305. var r = new xe.FSStream;
  28306. for (var n in e) r[n] = e[n];
  28307. e = r;
  28308. var a = xe.nextfd(t, i);
  28309. return e.fd = a, xe.streams[a] = e, e
  28310. },
  28311. closeStream: function(e) {
  28312. xe.streams[e] = null
  28313. },
  28314. chrdev_stream_ops: {
  28315. open: function(e) {
  28316. var t = xe.getDevice(e.node.rdev);
  28317. e.stream_ops = t.stream_ops, e.stream_ops.open && e.stream_ops.open(e)
  28318. },
  28319. llseek: function() {
  28320. throw new xe.ErrnoError(70)
  28321. }
  28322. },
  28323. major: function(e) {
  28324. return e >> 8
  28325. },
  28326. minor: function(e) {
  28327. return 255 & e
  28328. },
  28329. makedev: function(e, t) {
  28330. return e << 8 | t
  28331. },
  28332. registerDevice: function(e, t) {
  28333. xe.devices[e] = {
  28334. stream_ops: t
  28335. }
  28336. },
  28337. getDevice: function(e) {
  28338. return xe.devices[e]
  28339. },
  28340. getMounts: function(e) {
  28341. for (var t = [], i = [e]; i.length;) {
  28342. var r = i.pop();
  28343. t.push(r), i.push.apply(i, r.mounts)
  28344. }
  28345. return t
  28346. },
  28347. syncfs: function(e, t) {
  28348. "function" == typeof e && (t = e, e = !1), xe.syncFSRequests++, xe.syncFSRequests > 1 &&
  28349. console.log("warning: " + xe.syncFSRequests +
  28350. " FS.syncfs operations in flight at once, probably just doing extra work");
  28351. var i = xe.getMounts(xe.root.mount),
  28352. r = 0;
  28353. function n(e) {
  28354. return I(xe.syncFSRequests > 0), xe.syncFSRequests--, t(e)
  28355. }
  28356. function a(e) {
  28357. if (e) return a.errored ? void 0 : (a.errored = !0, n(e));
  28358. ++r >= i.length && n(null)
  28359. }
  28360. i.forEach(function(t) {
  28361. if (!t.type.syncfs) return a(null);
  28362. t.type.syncfs(t, e, a)
  28363. })
  28364. },
  28365. mount: function(e, t, i) {
  28366. if ("string" == typeof e) throw e;
  28367. var r, n = "/" === i,
  28368. a = !i;
  28369. if (n && xe.root) throw new xe.ErrnoError(10);
  28370. if (!n && !a) {
  28371. var s = xe.lookupPath(i, {
  28372. follow_mount: !1
  28373. });
  28374. if (i = s.path, r = s.node, xe.isMountpoint(r)) throw new xe.ErrnoError(10);
  28375. if (!xe.isDir(r.mode)) throw new xe.ErrnoError(54)
  28376. }
  28377. var o = {
  28378. type: e,
  28379. opts: t,
  28380. mountpoint: i,
  28381. mounts: []
  28382. },
  28383. u = e.mount(o);
  28384. return u.mount = o, o.root = u, n ? xe.root = u : r && (r.mounted = o, r.mount && r.mount
  28385. .mounts.push(o)), u
  28386. },
  28387. unmount: function(e) {
  28388. var t = xe.lookupPath(e, {
  28389. follow_mount: !1
  28390. });
  28391. if (!xe.isMountpoint(t.node)) throw new xe.ErrnoError(28);
  28392. var i = t.node,
  28393. r = i.mounted,
  28394. n = xe.getMounts(r);
  28395. Object.keys(xe.nameTable).forEach(function(e) {
  28396. for (var t = xe.nameTable[e]; t;) {
  28397. var i = t.name_next; - 1 !== n.indexOf(t.mount) && xe.destroyNode(t), t = i
  28398. }
  28399. }), i.mounted = null;
  28400. var a = i.mount.mounts.indexOf(r);
  28401. I(-1 !== a), i.mount.mounts.splice(a, 1)
  28402. },
  28403. lookup: function(e, t) {
  28404. return e.node_ops.lookup(e, t)
  28405. },
  28406. mknod: function(e, t, i) {
  28407. var r = xe.lookupPath(e, {
  28408. parent: !0
  28409. }).node,
  28410. n = Me.basename(e);
  28411. if (!n || "." === n || ".." === n) throw new xe.ErrnoError(28);
  28412. var a = xe.mayCreate(r, n);
  28413. if (a) throw new xe.ErrnoError(a);
  28414. if (!r.node_ops.mknod) throw new xe.ErrnoError(63);
  28415. return r.node_ops.mknod(r, n, t, i)
  28416. },
  28417. create: function(e, t) {
  28418. return t = void 0 !== t ? t : 438, t &= 4095, t |= 32768, xe.mknod(e, t, 0)
  28419. },
  28420. mkdir: function(e, t) {
  28421. return t = void 0 !== t ? t : 511, t &= 1023, t |= 16384, xe.mknod(e, t, 0)
  28422. },
  28423. mkdirTree: function(e, t) {
  28424. for (var i = e.split("/"), r = "", n = 0; n < i.length; ++n)
  28425. if (i[n]) {
  28426. r += "/" + i[n];
  28427. try {
  28428. xe.mkdir(r, t)
  28429. } catch (e) {
  28430. if (20 != e.errno) throw e
  28431. }
  28432. }
  28433. },
  28434. mkdev: function(e, t, i) {
  28435. return void 0 === i && (i = t, t = 438), t |= 8192, xe.mknod(e, t, i)
  28436. },
  28437. symlink: function(e, t) {
  28438. if (!Oe.resolve(e)) throw new xe.ErrnoError(44);
  28439. var i = xe.lookupPath(t, {
  28440. parent: !0
  28441. }).node;
  28442. if (!i) throw new xe.ErrnoError(44);
  28443. var r = Me.basename(t),
  28444. n = xe.mayCreate(i, r);
  28445. if (n) throw new xe.ErrnoError(n);
  28446. if (!i.node_ops.symlink) throw new xe.ErrnoError(63);
  28447. return i.node_ops.symlink(i, r, e)
  28448. },
  28449. rename: function(e, t) {
  28450. var i, r, n = Me.dirname(e),
  28451. a = Me.dirname(t),
  28452. s = Me.basename(e),
  28453. o = Me.basename(t);
  28454. try {
  28455. i = xe.lookupPath(e, {
  28456. parent: !0
  28457. }).node, r = xe.lookupPath(t, {
  28458. parent: !0
  28459. }).node
  28460. } catch (e) {
  28461. throw new xe.ErrnoError(10)
  28462. }
  28463. if (!i || !r) throw new xe.ErrnoError(44);
  28464. if (i.mount !== r.mount) throw new xe.ErrnoError(75);
  28465. var u, l = xe.lookupNode(i, s),
  28466. d = Oe.relative(e, a);
  28467. if ("." !== d.charAt(0)) throw new xe.ErrnoError(28);
  28468. if ("." !== (d = Oe.relative(t, n)).charAt(0)) throw new xe.ErrnoError(55);
  28469. try {
  28470. u = xe.lookupNode(r, o)
  28471. } catch (e) {}
  28472. if (l !== u) {
  28473. var c = xe.isDir(l.mode),
  28474. h = xe.mayDelete(i, s, c);
  28475. if (h) throw new xe.ErrnoError(h);
  28476. if (h = u ? xe.mayDelete(r, o, c) : xe.mayCreate(r, o)) throw new xe.ErrnoError(h);
  28477. if (!i.node_ops.rename) throw new xe.ErrnoError(63);
  28478. if (xe.isMountpoint(l) || u && xe.isMountpoint(u)) throw new xe.ErrnoError(10);
  28479. if (r !== i && (h = xe.nodePermissions(i, "w"))) throw new xe.ErrnoError(h);
  28480. try {
  28481. xe.trackingDelegate.willMovePath && xe.trackingDelegate.willMovePath(e, t)
  28482. } catch (i) {
  28483. console.log("FS.trackingDelegate['willMovePath']('" + e + "', '" + t +
  28484. "') threw an exception: " + i.message)
  28485. }
  28486. xe.hashRemoveNode(l);
  28487. try {
  28488. i.node_ops.rename(l, r, o)
  28489. } catch (e) {
  28490. throw e
  28491. } finally {
  28492. xe.hashAddNode(l)
  28493. }
  28494. try {
  28495. xe.trackingDelegate.onMovePath && xe.trackingDelegate.onMovePath(e, t)
  28496. } catch (i) {
  28497. console.log("FS.trackingDelegate['onMovePath']('" + e + "', '" + t +
  28498. "') threw an exception: " + i.message)
  28499. }
  28500. }
  28501. },
  28502. rmdir: function(e) {
  28503. var t = xe.lookupPath(e, {
  28504. parent: !0
  28505. }).node,
  28506. i = Me.basename(e),
  28507. r = xe.lookupNode(t, i),
  28508. n = xe.mayDelete(t, i, !0);
  28509. if (n) throw new xe.ErrnoError(n);
  28510. if (!t.node_ops.rmdir) throw new xe.ErrnoError(63);
  28511. if (xe.isMountpoint(r)) throw new xe.ErrnoError(10);
  28512. try {
  28513. xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e)
  28514. } catch (t) {
  28515. console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t
  28516. .message)
  28517. }
  28518. t.node_ops.rmdir(t, i), xe.destroyNode(r);
  28519. try {
  28520. xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e)
  28521. } catch (t) {
  28522. console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t
  28523. .message)
  28524. }
  28525. },
  28526. readdir: function(e) {
  28527. var t = xe.lookupPath(e, {
  28528. follow: !0
  28529. }).node;
  28530. if (!t.node_ops.readdir) throw new xe.ErrnoError(54);
  28531. return t.node_ops.readdir(t)
  28532. },
  28533. unlink: function(e) {
  28534. var t = xe.lookupPath(e, {
  28535. parent: !0
  28536. }).node,
  28537. i = Me.basename(e),
  28538. r = xe.lookupNode(t, i),
  28539. n = xe.mayDelete(t, i, !1);
  28540. if (n) throw new xe.ErrnoError(n);
  28541. if (!t.node_ops.unlink) throw new xe.ErrnoError(63);
  28542. if (xe.isMountpoint(r)) throw new xe.ErrnoError(10);
  28543. try {
  28544. xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e)
  28545. } catch (t) {
  28546. console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t
  28547. .message)
  28548. }
  28549. t.node_ops.unlink(t, i), xe.destroyNode(r);
  28550. try {
  28551. xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e)
  28552. } catch (t) {
  28553. console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t
  28554. .message)
  28555. }
  28556. },
  28557. readlink: function(e) {
  28558. var t = xe.lookupPath(e).node;
  28559. if (!t) throw new xe.ErrnoError(44);
  28560. if (!t.node_ops.readlink) throw new xe.ErrnoError(28);
  28561. return Oe.resolve(xe.getPath(t.parent), t.node_ops.readlink(t))
  28562. },
  28563. stat: function(e, t) {
  28564. var i = xe.lookupPath(e, {
  28565. follow: !t
  28566. }).node;
  28567. if (!i) throw new xe.ErrnoError(44);
  28568. if (!i.node_ops.getattr) throw new xe.ErrnoError(63);
  28569. return i.node_ops.getattr(i)
  28570. },
  28571. lstat: function(e) {
  28572. return xe.stat(e, !0)
  28573. },
  28574. chmod: function(e, t, i) {
  28575. var r;
  28576. if (!(r = "string" == typeof e ? xe.lookupPath(e, {
  28577. follow: !i
  28578. }).node : e).node_ops.setattr) throw new xe.ErrnoError(63);
  28579. r.node_ops.setattr(r, {
  28580. mode: 4095 & t | -4096 & r.mode,
  28581. timestamp: Date.now()
  28582. })
  28583. },
  28584. lchmod: function(e, t) {
  28585. xe.chmod(e, t, !0)
  28586. },
  28587. fchmod: function(e, t) {
  28588. var i = xe.getStream(e);
  28589. if (!i) throw new xe.ErrnoError(8);
  28590. xe.chmod(i.node, t)
  28591. },
  28592. chown: function(e, t, i, r) {
  28593. var n;
  28594. if (!(n = "string" == typeof e ? xe.lookupPath(e, {
  28595. follow: !r
  28596. }).node : e).node_ops.setattr) throw new xe.ErrnoError(63);
  28597. n.node_ops.setattr(n, {
  28598. timestamp: Date.now()
  28599. })
  28600. },
  28601. lchown: function(e, t, i) {
  28602. xe.chown(e, t, i, !0)
  28603. },
  28604. fchown: function(e, t, i) {
  28605. var r = xe.getStream(e);
  28606. if (!r) throw new xe.ErrnoError(8);
  28607. xe.chown(r.node, t, i)
  28608. },
  28609. truncate: function(e, t) {
  28610. if (t < 0) throw new xe.ErrnoError(28);
  28611. var i;
  28612. if (!(i = "string" == typeof e ? xe.lookupPath(e, {
  28613. follow: !0
  28614. }).node : e).node_ops.setattr) throw new xe.ErrnoError(63);
  28615. if (xe.isDir(i.mode)) throw new xe.ErrnoError(31);
  28616. if (!xe.isFile(i.mode)) throw new xe.ErrnoError(28);
  28617. var r = xe.nodePermissions(i, "w");
  28618. if (r) throw new xe.ErrnoError(r);
  28619. i.node_ops.setattr(i, {
  28620. size: t,
  28621. timestamp: Date.now()
  28622. })
  28623. },
  28624. ftruncate: function(e, t) {
  28625. var i = xe.getStream(e);
  28626. if (!i) throw new xe.ErrnoError(8);
  28627. if (0 == (2097155 & i.flags)) throw new xe.ErrnoError(28);
  28628. xe.truncate(i.node, t)
  28629. },
  28630. utime: function(e, t, i) {
  28631. var r = xe.lookupPath(e, {
  28632. follow: !0
  28633. }).node;
  28634. r.node_ops.setattr(r, {
  28635. timestamp: Math.max(t, i)
  28636. })
  28637. },
  28638. open: function(e, t, i, r, n) {
  28639. if ("" === e) throw new xe.ErrnoError(44);
  28640. var a;
  28641. if (i = void 0 === i ? 438 : i, i = 64 & (t = "string" == typeof t ? xe.modeStringToFlags(t) :
  28642. t) ? 4095 & i | 32768 : 0, "object" == typeof e) a = e;
  28643. else {
  28644. e = Me.normalize(e);
  28645. try {
  28646. a = xe.lookupPath(e, {
  28647. follow: !(131072 & t)
  28648. }).node
  28649. } catch (e) {}
  28650. }
  28651. var s = !1;
  28652. if (64 & t)
  28653. if (a) {
  28654. if (128 & t) throw new xe.ErrnoError(20)
  28655. } else a = xe.mknod(e, i, 0), s = !0;
  28656. if (!a) throw new xe.ErrnoError(44);
  28657. if (xe.isChrdev(a.mode) && (t &= -513), 65536 & t && !xe.isDir(a.mode)) throw new xe
  28658. .ErrnoError(54);
  28659. if (!s) {
  28660. var o = xe.mayOpen(a, t);
  28661. if (o) throw new xe.ErrnoError(o)
  28662. }
  28663. 512 & t && xe.truncate(a, 0), t &= -641;
  28664. var u = xe.createStream({
  28665. node: a,
  28666. path: xe.getPath(a),
  28667. flags: t,
  28668. seekable: !0,
  28669. position: 0,
  28670. stream_ops: a.stream_ops,
  28671. ungotten: [],
  28672. error: !1
  28673. }, r, n);
  28674. u.stream_ops.open && u.stream_ops.open(u), !d.logReadFiles || 1 & t || (xe.readFiles || (xe
  28675. .readFiles = {}), e in xe.readFiles || (xe.readFiles[e] = 1, console.log(
  28676. "FS.trackingDelegate error on read file: " + e)));
  28677. try {
  28678. if (xe.trackingDelegate.onOpenFile) {
  28679. var l = 0;
  28680. 1 != (2097155 & t) && (l |= xe.tracking.openFlags.READ), 0 != (2097155 & t) && (l |= xe
  28681. .tracking.openFlags.WRITE), xe.trackingDelegate.onOpenFile(e, l)
  28682. }
  28683. } catch (t) {
  28684. console.log("FS.trackingDelegate['onOpenFile']('" + e + "', flags) threw an exception: " + t
  28685. .message)
  28686. }
  28687. return u
  28688. },
  28689. close: function(e) {
  28690. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  28691. e.getdents && (e.getdents = null);
  28692. try {
  28693. e.stream_ops.close && e.stream_ops.close(e)
  28694. } catch (e) {
  28695. throw e
  28696. } finally {
  28697. xe.closeStream(e.fd)
  28698. }
  28699. e.fd = null
  28700. },
  28701. isClosed: function(e) {
  28702. return null === e.fd
  28703. },
  28704. llseek: function(e, t, i) {
  28705. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  28706. if (!e.seekable || !e.stream_ops.llseek) throw new xe.ErrnoError(70);
  28707. if (0 != i && 1 != i && 2 != i) throw new xe.ErrnoError(28);
  28708. return e.position = e.stream_ops.llseek(e, t, i), e.ungotten = [], e.position
  28709. },
  28710. read: function(e, t, i, r, n) {
  28711. if (r < 0 || n < 0) throw new xe.ErrnoError(28);
  28712. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  28713. if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(8);
  28714. if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31);
  28715. if (!e.stream_ops.read) throw new xe.ErrnoError(28);
  28716. var a = void 0 !== n;
  28717. if (a) {
  28718. if (!e.seekable) throw new xe.ErrnoError(70)
  28719. } else n = e.position;
  28720. var s = e.stream_ops.read(e, t, i, r, n);
  28721. return a || (e.position += s), s
  28722. },
  28723. write: function(e, t, i, r, n, a) {
  28724. if (r < 0 || n < 0) throw new xe.ErrnoError(28);
  28725. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  28726. if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8);
  28727. if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31);
  28728. if (!e.stream_ops.write) throw new xe.ErrnoError(28);
  28729. 1024 & e.flags && xe.llseek(e, 0, 2);
  28730. var s = void 0 !== n;
  28731. if (s) {
  28732. if (!e.seekable) throw new xe.ErrnoError(70)
  28733. } else n = e.position;
  28734. var o = e.stream_ops.write(e, t, i, r, n, a);
  28735. s || (e.position += o);
  28736. try {
  28737. e.path && xe.trackingDelegate.onWriteToFile && xe.trackingDelegate.onWriteToFile(e.path)
  28738. } catch (t) {
  28739. console.log("FS.trackingDelegate['onWriteToFile']('" + e.path + "') threw an exception: " +
  28740. t.message)
  28741. }
  28742. return o
  28743. },
  28744. allocate: function(e, t, i) {
  28745. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  28746. if (t < 0 || i <= 0) throw new xe.ErrnoError(28);
  28747. if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8);
  28748. if (!xe.isFile(e.node.mode) && !xe.isDir(e.node.mode)) throw new xe.ErrnoError(43);
  28749. if (!e.stream_ops.allocate) throw new xe.ErrnoError(138);
  28750. e.stream_ops.allocate(e, t, i)
  28751. },
  28752. mmap: function(e, t, i, r, n, a, s) {
  28753. if (0 != (2 & a) && 0 == (2 & s) && 2 != (2097155 & e.flags)) throw new xe.ErrnoError(2);
  28754. if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(2);
  28755. if (!e.stream_ops.mmap) throw new xe.ErrnoError(43);
  28756. return e.stream_ops.mmap(e, t, i, r, n, a, s)
  28757. },
  28758. msync: function(e, t, i, r, n) {
  28759. return e && e.stream_ops.msync ? e.stream_ops.msync(e, t, i, r, n) : 0
  28760. },
  28761. munmap: function(e) {
  28762. return 0
  28763. },
  28764. ioctl: function(e, t, i) {
  28765. if (!e.stream_ops.ioctl) throw new xe.ErrnoError(59);
  28766. return e.stream_ops.ioctl(e, t, i)
  28767. },
  28768. readFile: function(e, t) {
  28769. if ((t = t || {}).flags = t.flags || "r", t.encoding = t.encoding || "binary", "utf8" !== t
  28770. .encoding && "binary" !== t.encoding) throw new Error('Invalid encoding type "' + t
  28771. .encoding + '"');
  28772. var i, r = xe.open(e, t.flags),
  28773. n = xe.stat(e).size,
  28774. a = new Uint8Array(n);
  28775. return xe.read(r, a, 0, n, 0), "utf8" === t.encoding ? i = U(a, 0) : "binary" === t
  28776. .encoding && (i = a), xe.close(r), i
  28777. },
  28778. writeFile: function(e, t, i) {
  28779. (i = i || {}).flags = i.flags || "w";
  28780. var r = xe.open(e, i.flags, i.mode);
  28781. if ("string" == typeof t) {
  28782. var n = new Uint8Array(j(t) + 1),
  28783. a = B(t, n, 0, n.length);
  28784. xe.write(r, n, 0, a, void 0, i.canOwn)
  28785. } else {
  28786. if (!ArrayBuffer.isView(t)) throw new Error("Unsupported data type");
  28787. xe.write(r, t, 0, t.byteLength, void 0, i.canOwn)
  28788. }
  28789. xe.close(r)
  28790. },
  28791. cwd: function() {
  28792. return xe.currentPath
  28793. },
  28794. chdir: function(e) {
  28795. var t = xe.lookupPath(e, {
  28796. follow: !0
  28797. });
  28798. if (null === t.node) throw new xe.ErrnoError(44);
  28799. if (!xe.isDir(t.node.mode)) throw new xe.ErrnoError(54);
  28800. var i = xe.nodePermissions(t.node, "x");
  28801. if (i) throw new xe.ErrnoError(i);
  28802. xe.currentPath = t.path
  28803. },
  28804. createDefaultDirectories: function() {
  28805. xe.mkdir("/tmp"), xe.mkdir("/home"), xe.mkdir("/home/web_user")
  28806. },
  28807. createDefaultDevices: function() {
  28808. var e;
  28809. if (xe.mkdir("/dev"), xe.registerDevice(xe.makedev(1, 3), {
  28810. read: function() {
  28811. return 0
  28812. },
  28813. write: function(e, t, i, r, n) {
  28814. return r
  28815. }
  28816. }), xe.mkdev("/dev/null", xe.makedev(1, 3)), Ce.register(xe.makedev(5, 0), Ce
  28817. .default_tty_ops), Ce.register(xe.makedev(6, 0), Ce.default_tty1_ops), xe.mkdev(
  28818. "/dev/tty", xe.makedev(5, 0)), xe.mkdev("/dev/tty1", xe.makedev(6, 0)), "object" ==
  28819. typeof crypto && "function" == typeof crypto.getRandomValues) {
  28820. var t = new Uint8Array(1);
  28821. e = function() {
  28822. return crypto.getRandomValues(t), t[0]
  28823. }
  28824. } else if (u) try {
  28825. var r = i(71);
  28826. e = function() {
  28827. return r.randomBytes(1)[0]
  28828. }
  28829. } catch (e) {}
  28830. e || (e = function() {
  28831. ve(
  28832. "no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")
  28833. }), xe.createDevice("/dev", "random", e), xe.createDevice("/dev", "urandom", e), xe.mkdir(
  28834. "/dev/shm"), xe.mkdir("/dev/shm/tmp")
  28835. },
  28836. createSpecialDirectories: function() {
  28837. xe.mkdir("/proc"), xe.mkdir("/proc/self"), xe.mkdir("/proc/self/fd"), xe.mount({
  28838. mount: function() {
  28839. var e = xe.createNode("/proc/self", "fd", 16895, 73);
  28840. return e.node_ops = {
  28841. lookup: function(e, t) {
  28842. var i = +t,
  28843. r = xe.getStream(i);
  28844. if (!r) throw new xe.ErrnoError(8);
  28845. var n = {
  28846. parent: null,
  28847. mount: {
  28848. mountpoint: "fake"
  28849. },
  28850. node_ops: {
  28851. readlink: function() {
  28852. return r.path
  28853. }
  28854. }
  28855. };
  28856. return n.parent = n, n
  28857. }
  28858. }, e
  28859. }
  28860. }, {}, "/proc/self/fd")
  28861. },
  28862. createStandardStreams: function() {
  28863. d.stdin ? xe.createDevice("/dev", "stdin", d.stdin) : xe.symlink("/dev/tty", "/dev/stdin"), d
  28864. .stdout ? xe.createDevice("/dev", "stdout", null, d.stdout) : xe.symlink("/dev/tty",
  28865. "/dev/stdout"), d.stderr ? xe.createDevice("/dev", "stderr", null, d.stderr) : xe.symlink(
  28866. "/dev/tty1", "/dev/stderr");
  28867. var e = xe.open("/dev/stdin", "r"),
  28868. t = xe.open("/dev/stdout", "w"),
  28869. i = xe.open("/dev/stderr", "w");
  28870. I(0 === e.fd, "invalid handle for stdin (" + e.fd + ")"), I(1 === t.fd,
  28871. "invalid handle for stdout (" + t.fd + ")"), I(2 === i.fd, "invalid handle for stderr (" +
  28872. i.fd + ")")
  28873. },
  28874. ensureErrnoError: function() {
  28875. xe.ErrnoError || (xe.ErrnoError = function(e, t) {
  28876. this.node = t, this.setErrno = function(e) {
  28877. for (var t in this.errno = e, Le)
  28878. if (Le[t] === e) {
  28879. this.code = t;
  28880. break
  28881. }
  28882. }, this.setErrno(e), this.message = Ie[e], this.stack && (Object.defineProperty(this,
  28883. "stack", {
  28884. value: (new Error).stack,
  28885. writable: !0
  28886. }), this.stack = Se(this.stack))
  28887. }, xe.ErrnoError.prototype = new Error, xe.ErrnoError.prototype.constructor = xe
  28888. .ErrnoError, [44].forEach(function(e) {
  28889. xe.genericErrors[e] = new xe.ErrnoError(e), xe.genericErrors[e].stack =
  28890. "<generic error, no stack>"
  28891. }))
  28892. },
  28893. staticInit: function() {
  28894. xe.ensureErrnoError(), xe.nameTable = new Array(4096), xe.mount(De, {}, "/"), xe
  28895. .createDefaultDirectories(), xe.createDefaultDevices(), xe.createSpecialDirectories(), xe
  28896. .filesystems = {
  28897. MEMFS: De
  28898. }
  28899. },
  28900. init: function(e, t, i) {
  28901. I(!xe.init.initialized,
  28902. "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"
  28903. ), xe.init.initialized = !0, xe.ensureErrnoError(), d.stdin = e || d.stdin, d.stdout =
  28904. t || d.stdout, d.stderr = i || d.stderr, xe.createStandardStreams()
  28905. },
  28906. quit: function() {
  28907. xe.init.initialized = !1;
  28908. var e = d._fflush;
  28909. e && e(0);
  28910. for (var t = 0; t < xe.streams.length; t++) {
  28911. var i = xe.streams[t];
  28912. i && xe.close(i)
  28913. }
  28914. },
  28915. getMode: function(e, t) {
  28916. var i = 0;
  28917. return e && (i |= 365), t && (i |= 146), i
  28918. },
  28919. joinPath: function(e, t) {
  28920. var i = Me.join.apply(null, e);
  28921. return t && "/" == i[0] && (i = i.substr(1)), i
  28922. },
  28923. absolutePath: function(e, t) {
  28924. return Oe.resolve(t, e)
  28925. },
  28926. standardizePath: function(e) {
  28927. return Me.normalize(e)
  28928. },
  28929. findObject: function(e, t) {
  28930. var i = xe.analyzePath(e, t);
  28931. return i.exists ? i.object : (Re(i.error), null)
  28932. },
  28933. analyzePath: function(e, t) {
  28934. try {
  28935. e = (r = xe.lookupPath(e, {
  28936. follow: !t
  28937. })).path
  28938. } catch (e) {}
  28939. var i = {
  28940. isRoot: !1,
  28941. exists: !1,
  28942. error: 0,
  28943. name: null,
  28944. path: null,
  28945. object: null,
  28946. parentExists: !1,
  28947. parentPath: null,
  28948. parentObject: null
  28949. };
  28950. try {
  28951. var r = xe.lookupPath(e, {
  28952. parent: !0
  28953. });
  28954. i.parentExists = !0, i.parentPath = r.path, i.parentObject = r.node, i.name = Me.basename(
  28955. e), r = xe.lookupPath(e, {
  28956. follow: !t
  28957. }), i.exists = !0, i.path = r.path, i.object = r.node, i.name = r.node.name, i.isRoot =
  28958. "/" === r.path
  28959. } catch (e) {
  28960. i.error = e.errno
  28961. }
  28962. return i
  28963. },
  28964. createFolder: function(e, t, i, r) {
  28965. var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t),
  28966. a = xe.getMode(i, r);
  28967. return xe.mkdir(n, a)
  28968. },
  28969. createPath: function(e, t, i, r) {
  28970. e = "string" == typeof e ? e : xe.getPath(e);
  28971. for (var n = t.split("/").reverse(); n.length;) {
  28972. var a = n.pop();
  28973. if (a) {
  28974. var s = Me.join2(e, a);
  28975. try {
  28976. xe.mkdir(s)
  28977. } catch (e) {}
  28978. e = s
  28979. }
  28980. }
  28981. return s
  28982. },
  28983. createFile: function(e, t, i, r, n) {
  28984. var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t),
  28985. s = xe.getMode(r, n);
  28986. return xe.create(a, s)
  28987. },
  28988. createDataFile: function(e, t, i, r, n, a) {
  28989. var s = t ? Me.join2("string" == typeof e ? e : xe.getPath(e), t) : e,
  28990. o = xe.getMode(r, n),
  28991. u = xe.create(s, o);
  28992. if (i) {
  28993. if ("string" == typeof i) {
  28994. for (var l = new Array(i.length), d = 0, c = i.length; d < c; ++d) l[d] = i.charCodeAt(d);
  28995. i = l
  28996. }
  28997. xe.chmod(u, 146 | o);
  28998. var h = xe.open(u, "w");
  28999. xe.write(h, i, 0, i.length, 0, a), xe.close(h), xe.chmod(u, o)
  29000. }
  29001. return u
  29002. },
  29003. createDevice: function(e, t, i, r) {
  29004. var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t),
  29005. a = xe.getMode(!!i, !!r);
  29006. xe.createDevice.major || (xe.createDevice.major = 64);
  29007. var s = xe.makedev(xe.createDevice.major++, 0);
  29008. return xe.registerDevice(s, {
  29009. open: function(e) {
  29010. e.seekable = !1
  29011. },
  29012. close: function(e) {
  29013. r && r.buffer && r.buffer.length && r(10)
  29014. },
  29015. read: function(e, t, r, n, a) {
  29016. for (var s = 0, o = 0; o < n; o++) {
  29017. var u;
  29018. try {
  29019. u = i()
  29020. } catch (e) {
  29021. throw new xe.ErrnoError(29)
  29022. }
  29023. if (void 0 === u && 0 === s) throw new xe.ErrnoError(6);
  29024. if (null == u) break;
  29025. s++, t[r + o] = u
  29026. }
  29027. return s && (e.node.timestamp = Date.now()), s
  29028. },
  29029. write: function(e, t, i, n, a) {
  29030. for (var s = 0; s < n; s++) try {
  29031. r(t[i + s])
  29032. } catch (e) {
  29033. throw new xe.ErrnoError(29)
  29034. }
  29035. return n && (e.node.timestamp = Date.now()), s
  29036. }
  29037. }), xe.mkdev(n, a, s)
  29038. },
  29039. createLink: function(e, t, i, r, n) {
  29040. var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t);
  29041. return xe.symlink(i, a)
  29042. },
  29043. forceLoadFile: function(e) {
  29044. if (e.isDevice || e.isFolder || e.link || e.contents) return !0;
  29045. var t = !0;
  29046. if ("undefined" != typeof XMLHttpRequest) throw new Error(
  29047. "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."
  29048. );
  29049. if (!y) throw new Error("Cannot load without read() or XMLHttpRequest.");
  29050. try {
  29051. e.contents = Be(y(e.url), !0), e.usedBytes = e.contents.length
  29052. } catch (e) {
  29053. t = !1
  29054. }
  29055. return t || Re(29), t
  29056. },
  29057. createLazyFile: function(e, t, i, r, n) {
  29058. function a() {
  29059. this.lengthKnown = !1, this.chunks = []
  29060. }
  29061. if (a.prototype.get = function(e) {
  29062. if (!(e > this.length - 1 || e < 0)) {
  29063. var t = e % this.chunkSize,
  29064. i = e / this.chunkSize | 0;
  29065. return this.getter(i)[t]
  29066. }
  29067. }, a.prototype.setDataGetter = function(e) {
  29068. this.getter = e
  29069. }, a.prototype.cacheLength = function() {
  29070. var e = new XMLHttpRequest;
  29071. if (e.open("HEAD", i, !1), e.send(null), !(e.status >= 200 && e.status < 300 || 304 === e
  29072. .status)) throw new Error("Couldn't load " + i + ". Status: " + e.status);
  29073. var t, r = Number(e.getResponseHeader("Content-length")),
  29074. n = (t = e.getResponseHeader("Accept-Ranges")) && "bytes" === t,
  29075. a = (t = e.getResponseHeader("Content-Encoding")) && "gzip" === t,
  29076. s = 1048576;
  29077. n || (s = r);
  29078. var o = this;
  29079. o.setDataGetter(function(e) {
  29080. var t = e * s,
  29081. n = (e + 1) * s - 1;
  29082. if (n = Math.min(n, r - 1), void 0 === o.chunks[e] && (o.chunks[e] = function(e,
  29083. t) {
  29084. if (e > t) throw new Error("invalid range (" + e + ", " + t +
  29085. ") or no bytes requested!");
  29086. if (t > r - 1) throw new Error("only " + r +
  29087. " bytes available! programmer error!");
  29088. var n = new XMLHttpRequest;
  29089. if (n.open("GET", i, !1), r !== s && n.setRequestHeader("Range", "bytes=" +
  29090. e + "-" + t), "undefined" != typeof Uint8Array && (n.responseType =
  29091. "arraybuffer"), n.overrideMimeType && n.overrideMimeType(
  29092. "text/plain; charset=x-user-defined"), n.send(null), !(n.status >= 200 &&
  29093. n.status < 300 || 304 === n.status)) throw new Error("Couldn't load " +
  29094. i + ". Status: " + n.status);
  29095. return void 0 !== n.response ? new Uint8Array(n.response || []) : Be(n
  29096. .responseText || "", !0)
  29097. }(t, n)), void 0 === o.chunks[e]) throw new Error("doXHR failed!");
  29098. return o.chunks[e]
  29099. }), !a && r || (s = r = 1, r = this.getter(0).length, s = r, console.log(
  29100. "LazyFiles on gzip forces download of the whole file when length is accessed")), this
  29101. ._length = r, this._chunkSize = s, this.lengthKnown = !0
  29102. }, "undefined" != typeof XMLHttpRequest) {
  29103. if (!v)
  29104. throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
  29105. var s = new a;
  29106. Object.defineProperties(s, {
  29107. length: {
  29108. get: function() {
  29109. return this.lengthKnown || this.cacheLength(), this._length
  29110. }
  29111. },
  29112. chunkSize: {
  29113. get: function() {
  29114. return this.lengthKnown || this.cacheLength(), this._chunkSize
  29115. }
  29116. }
  29117. });
  29118. var o = {
  29119. isDevice: !1,
  29120. contents: s
  29121. }
  29122. } else o = {
  29123. isDevice: !1,
  29124. url: i
  29125. };
  29126. var u = xe.createFile(e, t, o, r, n);
  29127. o.contents ? u.contents = o.contents : o.url && (u.contents = null, u.url = o.url), Object
  29128. .defineProperties(u, {
  29129. usedBytes: {
  29130. get: function() {
  29131. return this.contents.length
  29132. }
  29133. }
  29134. });
  29135. var l = {};
  29136. return Object.keys(u.stream_ops).forEach(function(e) {
  29137. var t = u.stream_ops[e];
  29138. l[e] = function() {
  29139. if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29);
  29140. return t.apply(null, arguments)
  29141. }
  29142. }), l.read = function(e, t, i, r, n) {
  29143. if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29);
  29144. var a = e.node.contents;
  29145. if (n >= a.length) return 0;
  29146. var s = Math.min(a.length - n, r);
  29147. if (I(s >= 0), a.slice)
  29148. for (var o = 0; o < s; o++) t[i + o] = a[n + o];
  29149. else
  29150. for (o = 0; o < s; o++) t[i + o] = a.get(n + o);
  29151. return s
  29152. }, u.stream_ops = l, u
  29153. },
  29154. createPreloadedFile: function(e, t, i, r, n, a, s, o, u, l) {
  29155. Browser.init();
  29156. var c = t ? Oe.resolve(Me.join2(e, t)) : e,
  29157. h = function(e) {
  29158. for (var t = e;;) {
  29159. if (!pe[e]) return e;
  29160. e = t + Math.random()
  29161. }
  29162. return e
  29163. }("cp " + c);
  29164. function f(i) {
  29165. function f(i) {
  29166. l && l(), o || xe.createDataFile(e, t, i, r, n, u), a && a(), ge(h)
  29167. }
  29168. var p = !1;
  29169. d.preloadPlugins.forEach(function(e) {
  29170. p || e.canHandle(c) && (e.handle(i, c, f, function() {
  29171. s && s(), ge(h)
  29172. }), p = !0)
  29173. }), p || f(i)
  29174. }
  29175. me(h), "string" == typeof i ? Browser.asyncLoad(i, function(e) {
  29176. f(e)
  29177. }, s) : f(i)
  29178. },
  29179. indexedDB: function() {
  29180. return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB
  29181. },
  29182. DB_NAME: function() {
  29183. return "EM_FS_" + window.location.pathname
  29184. },
  29185. DB_VERSION: 20,
  29186. DB_STORE_NAME: "FILE_DATA",
  29187. saveFilesToDB: function(e, t, i) {
  29188. t = t || function() {}, i = i || function() {};
  29189. var r = xe.indexedDB();
  29190. try {
  29191. var n = r.open(xe.DB_NAME(), xe.DB_VERSION)
  29192. } catch (e) {
  29193. return i(e)
  29194. }
  29195. n.onupgradeneeded = function() {
  29196. console.log("creating db"), n.result.createObjectStore(xe.DB_STORE_NAME)
  29197. }, n.onsuccess = function() {
  29198. var r = n.result.transaction([xe.DB_STORE_NAME], "readwrite"),
  29199. a = r.objectStore(xe.DB_STORE_NAME),
  29200. s = 0,
  29201. o = 0,
  29202. u = e.length;
  29203. function l() {
  29204. 0 == o ? t() : i()
  29205. }
  29206. e.forEach(function(e) {
  29207. var t = a.put(xe.analyzePath(e).object.contents, e);
  29208. t.onsuccess = function() {
  29209. ++s + o == u && l()
  29210. }, t.onerror = function() {
  29211. s + ++o == u && l()
  29212. }
  29213. }), r.onerror = i
  29214. }, n.onerror = i
  29215. },
  29216. loadFilesFromDB: function(e, t, i) {
  29217. t = t || function() {}, i = i || function() {};
  29218. var r = xe.indexedDB();
  29219. try {
  29220. var n = r.open(xe.DB_NAME(), xe.DB_VERSION)
  29221. } catch (e) {
  29222. return i(e)
  29223. }
  29224. n.onupgradeneeded = i, n.onsuccess = function() {
  29225. var r = n.result;
  29226. try {
  29227. var a = r.transaction([xe.DB_STORE_NAME], "readonly")
  29228. } catch (e) {
  29229. return void i(e)
  29230. }
  29231. var s = a.objectStore(xe.DB_STORE_NAME),
  29232. o = 0,
  29233. u = 0,
  29234. l = e.length;
  29235. function d() {
  29236. 0 == u ? t() : i()
  29237. }
  29238. e.forEach(function(e) {
  29239. var t = s.get(e);
  29240. t.onsuccess = function() {
  29241. xe.analyzePath(e).exists && xe.unlink(e), xe.createDataFile(Me.dirname(e), Me
  29242. .basename(e), t.result, !0, !0, !0), ++o + u == l && d()
  29243. }, t.onerror = function() {
  29244. o + ++u == l && d()
  29245. }
  29246. }), a.onerror = i
  29247. }, n.onerror = i
  29248. }
  29249. },
  29250. Pe = {
  29251. DEFAULT_POLLMASK: 5,
  29252. mappings: {},
  29253. umask: 511,
  29254. calculateAt: function(e, t) {
  29255. if ("/" !== t[0]) {
  29256. var i;
  29257. if (-100 === e) i = xe.cwd();
  29258. else {
  29259. var r = xe.getStream(e);
  29260. if (!r) throw new xe.ErrnoError(8);
  29261. i = r.path
  29262. }
  29263. t = Me.join2(i, t)
  29264. }
  29265. return t
  29266. },
  29267. doStat: function(e, t, i) {
  29268. try {
  29269. var r = e(t)
  29270. } catch (e) {
  29271. if (e && e.node && Me.normalize(t) !== Me.normalize(xe.getPath(e.node))) return -54;
  29272. throw e
  29273. }
  29274. return q[i >> 2] = r.dev, q[i + 4 >> 2] = 0, q[i + 8 >> 2] = r.ino, q[i + 12 >> 2] = r.mode,
  29275. q[i + 16 >> 2] = r.nlink, q[i + 20 >> 2] = r.uid, q[i + 24 >> 2] = r.gid, q[i + 28 >> 2] = r
  29276. .rdev, q[i + 32 >> 2] = 0, we = [r.size >>> 0, (be = r.size, +oe(be) >= 1 ? be > 0 ? (0 |
  29277. de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) /
  29278. 4294967296) >>> 0 : 0)], q[i + 40 >> 2] = we[0], q[i + 44 >> 2] = we[1], q[i + 48 >> 2] =
  29279. 4096, q[i + 52 >> 2] = r.blocks, q[i + 56 >> 2] = r.atime.getTime() / 1e3 | 0, q[i + 60 >>
  29280. 2] = 0, q[i + 64 >> 2] = r.mtime.getTime() / 1e3 | 0, q[i + 68 >> 2] = 0, q[i + 72 >> 2] =
  29281. r.ctime.getTime() / 1e3 | 0, q[i + 76 >> 2] = 0, we = [r.ino >>> 0, (be = r.ino, +oe(be) >=
  29282. 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>>
  29283. 0)) / 4294967296) >>> 0 : 0)], q[i + 80 >> 2] = we[0], q[i + 84 >> 2] = we[1], 0
  29284. },
  29285. doMsync: function(e, t, i, r) {
  29286. var n = new Uint8Array(V.subarray(e, e + i));
  29287. xe.msync(t, n, 0, i, r)
  29288. },
  29289. doMkdir: function(e, t) {
  29290. return "/" === (e = Me.normalize(e))[e.length - 1] && (e = e.substr(0, e.length - 1)), xe
  29291. .mkdir(e, t, 0), 0
  29292. },
  29293. doMknod: function(e, t, i) {
  29294. switch (61440 & t) {
  29295. case 32768:
  29296. case 8192:
  29297. case 24576:
  29298. case 4096:
  29299. case 49152:
  29300. break;
  29301. default:
  29302. return -28
  29303. }
  29304. return xe.mknod(e, t, i), 0
  29305. },
  29306. doReadlink: function(e, t, i) {
  29307. if (i <= 0) return -28;
  29308. var r = xe.readlink(e),
  29309. n = Math.min(i, j(r)),
  29310. a = G[t + n];
  29311. return F(r, t, i + 1), G[t + n] = a, n
  29312. },
  29313. doAccess: function(e, t) {
  29314. if (-8 & t) return -28;
  29315. var i;
  29316. if (!(i = xe.lookupPath(e, {
  29317. follow: !0
  29318. }).node)) return -44;
  29319. var r = "";
  29320. return 4 & t && (r += "r"), 2 & t && (r += "w"), 1 & t && (r += "x"), r && xe.nodePermissions(
  29321. i, r) ? -2 : 0
  29322. },
  29323. doDup: function(e, t, i) {
  29324. var r = xe.getStream(i);
  29325. return r && xe.close(r), xe.open(e, t, 0, i, i).fd
  29326. },
  29327. doReadv: function(e, t, i, r) {
  29328. for (var n = 0, a = 0; a < i; a++) {
  29329. var s = q[t + 8 * a >> 2],
  29330. o = q[t + (8 * a + 4) >> 2],
  29331. u = xe.read(e, G, s, o, r);
  29332. if (u < 0) return -1;
  29333. if (n += u, u < o) break
  29334. }
  29335. return n
  29336. },
  29337. doWritev: function(e, t, i, r) {
  29338. for (var n = 0, a = 0; a < i; a++) {
  29339. var s = q[t + 8 * a >> 2],
  29340. o = q[t + (8 * a + 4) >> 2],
  29341. u = xe.write(e, G, s, o, r);
  29342. if (u < 0) return -1;
  29343. n += u
  29344. }
  29345. return n
  29346. },
  29347. varargs: 0,
  29348. get: function(e) {
  29349. return Pe.varargs += 4, q[Pe.varargs - 4 >> 2]
  29350. },
  29351. getStr: function() {
  29352. return N(Pe.get())
  29353. },
  29354. getStreamFromFD: function(e) {
  29355. void 0 === e && (e = Pe.get());
  29356. var t = xe.getStream(e);
  29357. if (!t) throw new xe.ErrnoError(8);
  29358. return t
  29359. },
  29360. get64: function() {
  29361. var e = Pe.get(),
  29362. t = Pe.get();
  29363. return I(e >= 0 ? 0 === t : -1 === t), e
  29364. },
  29365. getZero: function() {
  29366. I(0 === Pe.get())
  29367. }
  29368. };
  29369. var Ue = {};
  29370. function Ne() {
  29371. if (!Ne.strings) {
  29372. var e = {
  29373. USER: "web_user",
  29374. LOGNAME: "web_user",
  29375. PATH: "/",
  29376. PWD: "/",
  29377. HOME: "/home/web_user",
  29378. LANG: ("object" == typeof navigator && navigator.languages && navigator.languages[0] || "C")
  29379. .replace("-", "_") + ".UTF-8",
  29380. _: p
  29381. };
  29382. for (var t in Ue) e[t] = Ue[t];
  29383. var i = [];
  29384. for (var t in e) i.push(t + "=" + e[t]);
  29385. Ne.strings = i
  29386. }
  29387. return Ne.strings
  29388. }
  29389. function Be(e, t, i) {
  29390. var r = i > 0 ? i : j(e) + 1,
  29391. n = new Array(r),
  29392. a = B(e, n, 0, n.length);
  29393. return t && (n.length = a), n
  29394. }
  29395. F("GMT", 1341232, 4), xe.staticInit();
  29396. var Fe = {
  29397. __cxa_allocate_exception: function(e) {
  29398. return ri(e)
  29399. },
  29400. __cxa_throw: function(e, t, i) {
  29401. throw ke[e] = {
  29402. ptr: e,
  29403. adjusted: [e],
  29404. type: t,
  29405. destructor: i,
  29406. refcount: 0,
  29407. caught: !1,
  29408. rethrown: !1
  29409. }, "uncaught_exception" in ni ? ni.uncaught_exceptions++ : ni.uncaught_exceptions = 1, e +
  29410. " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."
  29411. },
  29412. __lock: function() {},
  29413. __syscall221: function(e, t) {
  29414. Pe.varargs = t;
  29415. try {
  29416. var i = Pe.getStreamFromFD();
  29417. switch (Pe.get()) {
  29418. case 0:
  29419. return (r = Pe.get()) < 0 ? -28 : xe.open(i.path, i.flags, 0, r).fd;
  29420. case 1:
  29421. case 2:
  29422. return 0;
  29423. case 3:
  29424. return i.flags;
  29425. case 4:
  29426. var r = Pe.get();
  29427. return i.flags |= r, 0;
  29428. case 12:
  29429. return r = Pe.get(), W[r + 0 >> 1] = 2, 0;
  29430. case 13:
  29431. case 14:
  29432. return 0;
  29433. case 16:
  29434. case 8:
  29435. return -28;
  29436. case 9:
  29437. return Re(28), -1;
  29438. default:
  29439. return -28
  29440. }
  29441. } catch (e) {
  29442. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno
  29443. }
  29444. },
  29445. __syscall3: function(e, t) {
  29446. Pe.varargs = t;
  29447. try {
  29448. var i = Pe.getStreamFromFD(),
  29449. r = Pe.get(),
  29450. n = Pe.get();
  29451. return xe.read(i, G, r, n)
  29452. } catch (e) {
  29453. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno
  29454. }
  29455. },
  29456. __syscall5: function(e, t) {
  29457. Pe.varargs = t;
  29458. try {
  29459. var i = Pe.getStr(),
  29460. r = Pe.get(),
  29461. n = Pe.get();
  29462. return xe.open(i, r, n).fd
  29463. } catch (e) {
  29464. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno
  29465. }
  29466. },
  29467. __unlock: function() {},
  29468. abort: function() {
  29469. ve()
  29470. },
  29471. clock: function e() {
  29472. return void 0 === e.start && (e.start = Date.now()), 1e3 * (Date.now() - e.start) | 0
  29473. },
  29474. emscripten_memcpy_big: function(e, t, i) {
  29475. V.set(V.subarray(t, t + i), e)
  29476. },
  29477. emscripten_resize_heap: function(e) {
  29478. var t = G.length;
  29479. if (I(e > t), e > 2147418112) return S("Cannot enlarge memory, asked to go up to " + e +
  29480. " bytes, but the limit is 2147418112 bytes!"), !1;
  29481. for (var i = Math.max(t, 16777216); i < e;)(i = i <= 536870912 ? z(2 * i, 65536) : Math.min(z(
  29482. (3 * i + 2147483648) / 4, 65536), 2147418112)) === t && A(
  29483. "Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only " +
  29484. G.length);
  29485. return !! function(e) {
  29486. try {
  29487. return M.grow(e - H.byteLength + 65535 >> 16), K(M.buffer), 1
  29488. } catch (t) {
  29489. console.error("emscripten_realloc_buffer: Attempted to grow heap from " + H.byteLength +
  29490. " bytes to " + e + " bytes, but got error: " + t)
  29491. }
  29492. }(i) || (S("Failed to grow the heap from " + t + " bytes to " + i +
  29493. " bytes, not enough memory!"), !1)
  29494. },
  29495. environ_get: function(e, t) {
  29496. var i = 0;
  29497. return Ne().forEach(function(r, n) {
  29498. var a = t + i;
  29499. q[e + 4 * n >> 2] = a,
  29500. function(e, t, i) {
  29501. for (var r = 0; r < e.length; ++r) I(e.charCodeAt(r) == e.charCodeAt(r) & 255), G[
  29502. t++ >> 0] = e.charCodeAt(r);
  29503. i || (G[t >> 0] = 0)
  29504. }(r, a), i += r.length + 1
  29505. }), 0
  29506. },
  29507. environ_sizes_get: function(e, t) {
  29508. var i = Ne();
  29509. q[e >> 2] = i.length;
  29510. var r = 0;
  29511. return i.forEach(function(e) {
  29512. r += e.length + 1
  29513. }), q[t >> 2] = r, 0
  29514. },
  29515. fd_close: function(e) {
  29516. try {
  29517. var t = Pe.getStreamFromFD(e);
  29518. return xe.close(t), 0
  29519. } catch (e) {
  29520. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  29521. }
  29522. },
  29523. fd_fdstat_get: function(e, t) {
  29524. try {
  29525. var i = Pe.getStreamFromFD(e),
  29526. r = i.tty ? 2 : xe.isDir(i.mode) ? 3 : xe.isLink(i.mode) ? 7 : 4;
  29527. return G[t >> 0] = r, 0
  29528. } catch (e) {
  29529. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  29530. }
  29531. },
  29532. fd_seek: function(e, t, i, r, n) {
  29533. try {
  29534. var a = Pe.getStreamFromFD(e),
  29535. s = 4294967296 * i + (t >>> 0);
  29536. return s <= -9007199254740992 || s >= 9007199254740992 ? -61 : (xe.llseek(a, s, r), we = [a
  29537. .position >>> 0, (be = a.position, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be /
  29538. 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 :
  29539. 0)
  29540. ], q[n >> 2] = we[0], q[n + 4 >> 2] = we[1], a.getdents && 0 === s && 0 === r && (a
  29541. .getdents = null), 0)
  29542. } catch (e) {
  29543. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  29544. }
  29545. },
  29546. fd_write: function(e, t, i, r) {
  29547. try {
  29548. var n = Pe.getStreamFromFD(e),
  29549. a = Pe.doWritev(n, t, i);
  29550. return q[r >> 2] = a, 0
  29551. } catch (e) {
  29552. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  29553. }
  29554. },
  29555. gettimeofday: function(e) {
  29556. var t = Date.now();
  29557. return q[e >> 2] = t / 1e3 | 0, q[e + 4 >> 2] = t % 1e3 * 1e3 | 0, 0
  29558. },
  29559. memory: M,
  29560. round: function(e) {
  29561. return (e = +e) >= 0 ? +le(e + .5) : +ue(e - .5)
  29562. },
  29563. setTempRet0: function(e) {
  29564. O(0 | e)
  29565. },
  29566. table: C,
  29567. time: function(e) {
  29568. var t = Date.now() / 1e3 | 0;
  29569. return e && (q[e >> 2] = t), t
  29570. }
  29571. },
  29572. je = function() {
  29573. var e = {
  29574. env: Fe,
  29575. wasi_unstable: Fe
  29576. };
  29577. function t(e, t) {
  29578. var i = e.exports;
  29579. d.asm = i, ge("wasm-instantiate")
  29580. }
  29581. me("wasm-instantiate");
  29582. var i = d;
  29583. function r(e) {
  29584. I(d === i,
  29585. "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"
  29586. ), i = null, t(e.instance)
  29587. }
  29588. function n(t) {
  29589. return (R || !g && !v || "function" != typeof fetch ? new Promise(function(e, t) {
  29590. e(Te())
  29591. }) : fetch(Ee, {
  29592. credentials: "same-origin"
  29593. }).then(function(e) {
  29594. if (!e.ok) throw "failed to load wasm binary file at '" + Ee + "'";
  29595. return e.arrayBuffer()
  29596. }).catch(function() {
  29597. return Te()
  29598. })).then(function(t) {
  29599. return WebAssembly.instantiate(t, e)
  29600. }).then(t, function(e) {
  29601. S("failed to asynchronously prepare wasm: " + e), ve(e)
  29602. })
  29603. }
  29604. if (d.instantiateWasm) try {
  29605. return d.instantiateWasm(e, t)
  29606. } catch (e) {
  29607. return S("Module.instantiateWasm callback failed with error: " + e), !1
  29608. }
  29609. return function() {
  29610. if (R || "function" != typeof WebAssembly.instantiateStreaming || _e(Ee) || "function" !=
  29611. typeof fetch) return n(r);
  29612. fetch(Ee, {
  29613. credentials: "same-origin"
  29614. }).then(function(t) {
  29615. return WebAssembly.instantiateStreaming(t, e).then(r, function(e) {
  29616. S("wasm streaming compile failed: " + e), S(
  29617. "falling back to ArrayBuffer instantiation"), n(r)
  29618. })
  29619. })
  29620. }(), {}
  29621. }(),
  29622. He = je.__wasm_call_ctors;
  29623. je.__wasm_call_ctors = function() {
  29624. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29625. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), He
  29626. .apply(null, arguments)
  29627. };
  29628. var Ge = je.WasmDecoder_Check;
  29629. je.WasmDecoder_Check = function() {
  29630. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29631. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ge
  29632. .apply(null, arguments)
  29633. };
  29634. var Ve = je.WasmDecoder_Init;
  29635. je.WasmDecoder_Init = function() {
  29636. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29637. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ve
  29638. .apply(null, arguments)
  29639. };
  29640. var We = je.WasmDecoder_Deinit;
  29641. je.WasmDecoder_Deinit = function() {
  29642. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29643. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), We
  29644. .apply(null, arguments)
  29645. };
  29646. var qe = je.WasmDecoder_OpenChannel;
  29647. je.WasmDecoder_OpenChannel = function() {
  29648. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29649. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qe
  29650. .apply(null, arguments)
  29651. };
  29652. var Xe = je.WasmDecoder_InputFlvStream;
  29653. je.WasmDecoder_InputFlvStream = function() {
  29654. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29655. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xe
  29656. .apply(null, arguments)
  29657. };
  29658. var ze = je.WasmDecoder_GetFlvDecodeData;
  29659. je.WasmDecoder_GetFlvDecodeData = function() {
  29660. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29661. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ze
  29662. .apply(null, arguments)
  29663. };
  29664. var Ke = je.WasmDecoder_InputFlvStreamAndDecode;
  29665. je.WasmDecoder_InputFlvStreamAndDecode = function() {
  29666. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29667. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ke
  29668. .apply(null, arguments)
  29669. };
  29670. var Ye = je.WasmDecoder_OpenVideoDecoder;
  29671. je.WasmDecoder_OpenVideoDecoder = function() {
  29672. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29673. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ye
  29674. .apply(null, arguments)
  29675. };
  29676. var Qe = je.WasmDecoder_OpenAudioDecoder;
  29677. je.WasmDecoder_OpenAudioDecoder = function() {
  29678. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29679. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qe
  29680. .apply(null, arguments)
  29681. };
  29682. var Je = je.WasmDecoder_DecodeVideoFrame;
  29683. je.WasmDecoder_DecodeVideoFrame = function() {
  29684. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29685. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Je
  29686. .apply(null, arguments)
  29687. };
  29688. var Ze = je.WasmDecoder_DecodeAudioFrame;
  29689. je.WasmDecoder_DecodeAudioFrame = function() {
  29690. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29691. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ze
  29692. .apply(null, arguments)
  29693. };
  29694. var $e = je.WasmDecoder_CloseChannel;
  29695. je.WasmDecoder_CloseChannel = function() {
  29696. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29697. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $e
  29698. .apply(null, arguments)
  29699. };
  29700. var et = je.WasmDecoder_ConvertFrame2Image;
  29701. je.WasmDecoder_ConvertFrame2Image = function() {
  29702. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29703. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), et
  29704. .apply(null, arguments)
  29705. };
  29706. var tt = je.WasmDecoder_ReleaseImageData;
  29707. je.WasmDecoder_ReleaseImageData = function() {
  29708. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29709. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), tt
  29710. .apply(null, arguments)
  29711. };
  29712. var it = je.WasmDecoder_CreateMP4File;
  29713. je.WasmDecoder_CreateMP4File = function() {
  29714. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29715. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), it
  29716. .apply(null, arguments)
  29717. };
  29718. var rt = je.WasmDecoder_WriteData;
  29719. je.WasmDecoder_WriteData = function() {
  29720. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29721. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), rt
  29722. .apply(null, arguments)
  29723. };
  29724. var nt = je.WasmDecoder_ReleaseMP4File;
  29725. je.WasmDecoder_ReleaseMP4File = function() {
  29726. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29727. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), nt
  29728. .apply(null, arguments)
  29729. };
  29730. var at = je.main;
  29731. je.main = function() {
  29732. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29733. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), at
  29734. .apply(null, arguments)
  29735. };
  29736. var st = je.free;
  29737. je.free = function() {
  29738. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29739. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), st
  29740. .apply(null, arguments)
  29741. };
  29742. var ot = je.malloc;
  29743. je.malloc = function() {
  29744. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29745. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ot
  29746. .apply(null, arguments)
  29747. };
  29748. var ut = je.__errno_location;
  29749. je.__errno_location = function() {
  29750. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29751. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ut
  29752. .apply(null, arguments)
  29753. };
  29754. var lt = je.fflush;
  29755. je.fflush = function() {
  29756. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29757. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), lt
  29758. .apply(null, arguments)
  29759. };
  29760. var dt = je._get_tzname;
  29761. je._get_tzname = function() {
  29762. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29763. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), dt
  29764. .apply(null, arguments)
  29765. };
  29766. var ct = je._get_daylight;
  29767. je._get_daylight = function() {
  29768. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29769. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ct
  29770. .apply(null, arguments)
  29771. };
  29772. var ht = je._get_timezone;
  29773. je._get_timezone = function() {
  29774. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29775. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ht
  29776. .apply(null, arguments)
  29777. };
  29778. var ft = je.setThrew;
  29779. je.setThrew = function() {
  29780. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29781. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ft
  29782. .apply(null, arguments)
  29783. };
  29784. var pt = je._ZSt18uncaught_exceptionv;
  29785. je._ZSt18uncaught_exceptionv = function() {
  29786. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29787. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), pt
  29788. .apply(null, arguments)
  29789. };
  29790. var mt = je.stackSave;
  29791. je.stackSave = function() {
  29792. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29793. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), mt
  29794. .apply(null, arguments)
  29795. };
  29796. var gt = je.stackAlloc;
  29797. je.stackAlloc = function() {
  29798. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29799. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), gt
  29800. .apply(null, arguments)
  29801. };
  29802. var vt = je.stackRestore;
  29803. je.stackRestore = function() {
  29804. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29805. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), vt
  29806. .apply(null, arguments)
  29807. };
  29808. var yt = je.__growWasmMemory;
  29809. je.__growWasmMemory = function() {
  29810. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29811. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), yt
  29812. .apply(null, arguments)
  29813. };
  29814. var _t = je.dynCall_ii;
  29815. je.dynCall_ii = function() {
  29816. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29817. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), _t
  29818. .apply(null, arguments)
  29819. };
  29820. var bt = je.dynCall_viiiii;
  29821. je.dynCall_viiiii = function() {
  29822. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29823. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), bt
  29824. .apply(null, arguments)
  29825. };
  29826. var wt = je.dynCall_viiiiiifi;
  29827. je.dynCall_viiiiiifi = function() {
  29828. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29829. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), wt
  29830. .apply(null, arguments)
  29831. };
  29832. var Et = je.dynCall_viiii;
  29833. je.dynCall_viiii = function() {
  29834. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29835. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Et
  29836. .apply(null, arguments)
  29837. };
  29838. var Tt = je.dynCall_viii;
  29839. je.dynCall_viii = function() {
  29840. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29841. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Tt
  29842. .apply(null, arguments)
  29843. };
  29844. var St = je.dynCall_iiiiiii;
  29845. je.dynCall_iiiiiii = function() {
  29846. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29847. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), St
  29848. .apply(null, arguments)
  29849. };
  29850. var At = je.dynCall_iiiiii;
  29851. je.dynCall_iiiiii = function() {
  29852. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29853. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), At
  29854. .apply(null, arguments)
  29855. };
  29856. var kt = je.dynCall_vii;
  29857. je.dynCall_vii = function() {
  29858. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29859. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), kt
  29860. .apply(null, arguments)
  29861. };
  29862. var Rt = je.dynCall_iii;
  29863. je.dynCall_iii = function() {
  29864. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29865. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Rt
  29866. .apply(null, arguments)
  29867. };
  29868. var Mt = je.dynCall_iiii;
  29869. je.dynCall_iiii = function() {
  29870. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29871. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Mt
  29872. .apply(null, arguments)
  29873. };
  29874. var Ot = je.dynCall_viiiiii;
  29875. je.dynCall_viiiiii = function() {
  29876. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29877. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ot
  29878. .apply(null, arguments)
  29879. };
  29880. var Ct = je.dynCall_viiiiiiiii;
  29881. je.dynCall_viiiiiiiii = function() {
  29882. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29883. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ct
  29884. .apply(null, arguments)
  29885. };
  29886. var Dt = je.dynCall_viiiiiiii;
  29887. je.dynCall_viiiiiiii = function() {
  29888. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29889. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Dt
  29890. .apply(null, arguments)
  29891. };
  29892. var It = je.dynCall_iiiii;
  29893. je.dynCall_iiiii = function() {
  29894. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29895. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), It
  29896. .apply(null, arguments)
  29897. };
  29898. var Lt = je.dynCall_viiiiiiiiiiiiii;
  29899. je.dynCall_viiiiiiiiiiiiii = function() {
  29900. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29901. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Lt
  29902. .apply(null, arguments)
  29903. };
  29904. var xt = je.dynCall_viiiiiiiiiii;
  29905. je.dynCall_viiiiiiiiiii = function() {
  29906. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29907. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), xt
  29908. .apply(null, arguments)
  29909. };
  29910. var Pt = je.dynCall_viiiiiii;
  29911. je.dynCall_viiiiiii = function() {
  29912. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29913. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Pt
  29914. .apply(null, arguments)
  29915. };
  29916. var Ut = je.dynCall_viiiiiiiiiiii;
  29917. je.dynCall_viiiiiiiiiiii = function() {
  29918. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29919. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ut
  29920. .apply(null, arguments)
  29921. };
  29922. var Nt = je.dynCall_vi;
  29923. je.dynCall_vi = function() {
  29924. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29925. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Nt
  29926. .apply(null, arguments)
  29927. };
  29928. var Bt = je.dynCall_iiiiiiiii;
  29929. je.dynCall_iiiiiiiii = function() {
  29930. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29931. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Bt
  29932. .apply(null, arguments)
  29933. };
  29934. var Ft = je.dynCall_viiiifii;
  29935. je.dynCall_viiiifii = function() {
  29936. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29937. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ft
  29938. .apply(null, arguments)
  29939. };
  29940. var jt = je.dynCall_fii;
  29941. je.dynCall_fii = function() {
  29942. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29943. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), jt
  29944. .apply(null, arguments)
  29945. };
  29946. var Ht = je.dynCall_viiiiiiiiii;
  29947. je.dynCall_viiiiiiiiii = function() {
  29948. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29949. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ht
  29950. .apply(null, arguments)
  29951. };
  29952. var Gt = je.dynCall_dd;
  29953. je.dynCall_dd = function() {
  29954. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29955. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Gt
  29956. .apply(null, arguments)
  29957. };
  29958. var Vt = je.dynCall_viifi;
  29959. je.dynCall_viifi = function() {
  29960. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29961. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Vt
  29962. .apply(null, arguments)
  29963. };
  29964. var Wt = je.dynCall_fiii;
  29965. je.dynCall_fiii = function() {
  29966. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29967. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Wt
  29968. .apply(null, arguments)
  29969. };
  29970. var qt = je.dynCall_viidi;
  29971. je.dynCall_viidi = function() {
  29972. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29973. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qt
  29974. .apply(null, arguments)
  29975. };
  29976. var Xt = je.dynCall_iiiiiiii;
  29977. je.dynCall_iiiiiiii = function() {
  29978. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29979. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xt
  29980. .apply(null, arguments)
  29981. };
  29982. var zt = je.dynCall_did;
  29983. je.dynCall_did = function() {
  29984. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29985. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), zt
  29986. .apply(null, arguments)
  29987. };
  29988. var Kt = je.dynCall_v;
  29989. je.dynCall_v = function() {
  29990. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29991. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Kt
  29992. .apply(null, arguments)
  29993. };
  29994. var Yt = je.dynCall_viiijj;
  29995. je.dynCall_viiijj = function() {
  29996. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  29997. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Yt
  29998. .apply(null, arguments)
  29999. };
  30000. var Qt = je.dynCall_iiiiiiidiiddii;
  30001. je.dynCall_iiiiiiidiiddii = function() {
  30002. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30003. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qt
  30004. .apply(null, arguments)
  30005. };
  30006. var Jt = je.dynCall_jij;
  30007. je.dynCall_jij = function() {
  30008. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30009. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Jt
  30010. .apply(null, arguments)
  30011. };
  30012. var Zt = je.dynCall_jii;
  30013. je.dynCall_jii = function() {
  30014. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30015. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Zt
  30016. .apply(null, arguments)
  30017. };
  30018. var $t = je.dynCall_jiji;
  30019. je.dynCall_jiji = function() {
  30020. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30021. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $t
  30022. .apply(null, arguments)
  30023. };
  30024. var ei = je.dynCall_iidiiii;
  30025. je.dynCall_iidiiii = function() {
  30026. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30027. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ei
  30028. .apply(null, arguments)
  30029. }, d.asm = je;
  30030. var ti, ii = d.___wasm_call_ctors = function() {
  30031. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30032. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30033. .asm.__wasm_call_ctors.apply(null, arguments)
  30034. },
  30035. ri = (d._WasmDecoder_Check = function() {
  30036. return I(ae,
  30037. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30038. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30039. .WasmDecoder_Check.apply(null, arguments)
  30040. }, d._WasmDecoder_Init = function() {
  30041. return I(ae,
  30042. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30043. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30044. .WasmDecoder_Init.apply(null, arguments)
  30045. }, d._WasmDecoder_Deinit = function() {
  30046. return I(ae,
  30047. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30048. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30049. .WasmDecoder_Deinit.apply(null, arguments)
  30050. }, d._WasmDecoder_OpenChannel = function() {
  30051. return I(ae,
  30052. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30053. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30054. .WasmDecoder_OpenChannel.apply(null, arguments)
  30055. }, d._WasmDecoder_InputFlvStream = function() {
  30056. return I(ae,
  30057. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30058. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30059. .WasmDecoder_InputFlvStream.apply(null, arguments)
  30060. }, d._WasmDecoder_GetFlvDecodeData = function() {
  30061. return I(ae,
  30062. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30063. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30064. .WasmDecoder_GetFlvDecodeData.apply(null, arguments)
  30065. }, d._WasmDecoder_InputFlvStreamAndDecode = function() {
  30066. return I(ae,
  30067. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30068. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30069. .WasmDecoder_InputFlvStreamAndDecode.apply(null, arguments)
  30070. }, d._WasmDecoder_OpenVideoDecoder = function() {
  30071. return I(ae,
  30072. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30073. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30074. .WasmDecoder_OpenVideoDecoder.apply(null, arguments)
  30075. }, d._WasmDecoder_OpenAudioDecoder = function() {
  30076. return I(ae,
  30077. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30078. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30079. .WasmDecoder_OpenAudioDecoder.apply(null, arguments)
  30080. }, d._WasmDecoder_DecodeVideoFrame = function() {
  30081. return I(ae,
  30082. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30083. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30084. .WasmDecoder_DecodeVideoFrame.apply(null, arguments)
  30085. }, d._WasmDecoder_DecodeAudioFrame = function() {
  30086. return I(ae,
  30087. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30088. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30089. .WasmDecoder_DecodeAudioFrame.apply(null, arguments)
  30090. }, d._WasmDecoder_CloseChannel = function() {
  30091. return I(ae,
  30092. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30093. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30094. .WasmDecoder_CloseChannel.apply(null, arguments)
  30095. }, d._WasmDecoder_ConvertFrame2Image = function() {
  30096. return I(ae,
  30097. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30098. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30099. .WasmDecoder_ConvertFrame2Image.apply(null, arguments)
  30100. }, d._WasmDecoder_ReleaseImageData = function() {
  30101. return I(ae,
  30102. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30103. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30104. .WasmDecoder_ReleaseImageData.apply(null, arguments)
  30105. }, d._WasmDecoder_CreateMP4File = function() {
  30106. return I(ae,
  30107. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30108. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30109. .WasmDecoder_CreateMP4File.apply(null, arguments)
  30110. }, d._WasmDecoder_WriteData = function() {
  30111. return I(ae,
  30112. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30113. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30114. .WasmDecoder_WriteData.apply(null, arguments)
  30115. }, d._WasmDecoder_ReleaseMP4File = function() {
  30116. return I(ae,
  30117. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30118. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30119. .WasmDecoder_ReleaseMP4File.apply(null, arguments)
  30120. }, d._main = function() {
  30121. return I(ae,
  30122. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30123. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30124. .main.apply(null, arguments)
  30125. }, d._free = function() {
  30126. return I(ae,
  30127. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30128. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30129. .free.apply(null, arguments)
  30130. }, d._malloc = function() {
  30131. return I(ae,
  30132. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30133. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30134. .malloc.apply(null, arguments)
  30135. }),
  30136. ni = (d.___errno_location = function() {
  30137. return I(ae,
  30138. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30139. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30140. .__errno_location.apply(null, arguments)
  30141. }, d._fflush = function() {
  30142. return I(ae,
  30143. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30144. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30145. .fflush.apply(null, arguments)
  30146. }, d.__get_tzname = function() {
  30147. return I(ae,
  30148. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30149. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30150. ._get_tzname.apply(null, arguments)
  30151. }, d.__get_daylight = function() {
  30152. return I(ae,
  30153. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30154. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30155. ._get_daylight.apply(null, arguments)
  30156. }, d.__get_timezone = function() {
  30157. return I(ae,
  30158. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30159. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30160. ._get_timezone.apply(null, arguments)
  30161. }, d._setThrew = function() {
  30162. return I(ae,
  30163. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30164. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30165. .setThrew.apply(null, arguments)
  30166. }, d.__ZSt18uncaught_exceptionv = function() {
  30167. return I(ae,
  30168. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  30169. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  30170. ._ZSt18uncaught_exceptionv.apply(null, arguments)
  30171. }),
  30172. ai = d.stackSave = function() {
  30173. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30174. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30175. .asm.stackSave.apply(null, arguments)
  30176. },
  30177. si = d.stackAlloc = function() {
  30178. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30179. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30180. .asm.stackAlloc.apply(null, arguments)
  30181. },
  30182. oi = d.stackRestore = function() {
  30183. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30184. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30185. .asm.stackRestore.apply(null, arguments)
  30186. };
  30187. function ui(e) {
  30188. this.name = "ExitStatus", this.message = "Program terminated with exit(" + e + ")", this.status = e
  30189. }
  30190. function li(e) {
  30191. I(0 == ce,
  30192. 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'),
  30193. I(0 == te.length, "cannot call main when preRun functions remain to be called");
  30194. var t = d._main;
  30195. try {
  30196. ! function(e, t) {
  30197. (function() {
  30198. var e = T,
  30199. t = S,
  30200. i = !1;
  30201. T = S = function(e) {
  30202. i = !0
  30203. };
  30204. try {
  30205. var r = d._fflush;
  30206. r && r(0), ["stdout", "stderr"].forEach(function(e) {
  30207. var t = xe.analyzePath("/dev/" + e);
  30208. if (t) {
  30209. var r = t.object.rdev,
  30210. n = Ce.ttys[r];
  30211. n && n.output && n.output.length && (i = !0)
  30212. }
  30213. })
  30214. } catch (e) {}
  30215. T = e, S = t, i && A(
  30216. "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc."
  30217. )
  30218. })(), t && s && 0 === e || (s ? t || S("program exited (with status: " + e +
  30219. "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)"
  30220. ) : (D = !0, $(), se = !0, d.onExit && d.onExit(e)), m(e, new ui(e)))
  30221. }(t(0, 0), !0)
  30222. } catch (e) {
  30223. if (e instanceof ui) return;
  30224. if ("SimulateInfiniteLoop" == e) return void(s = !0);
  30225. var i = e;
  30226. e && "object" == typeof e && e.stack && (i = [e, e.stack]), S("exception thrown: " + i), m(1, e)
  30227. }
  30228. }
  30229. function di(e) {
  30230. function t() {
  30231. ti || (ti = !0, D || ($(), I(!ae), ae = !0, d.noFSInit || xe.init.initialized || xe.init(), Ce
  30232. .init(), ee(ie), $(), xe.ignorePermissions = !1, ee(re), d.onRuntimeInitialized && d
  30233. .onRuntimeInitialized(), ci && li(),
  30234. function() {
  30235. if ($(), d.postRun)
  30236. for ("function" == typeof d.postRun && (d.postRun = [d.postRun]); d.postRun.length;) e =
  30237. d.postRun.shift(), ne.unshift(e);
  30238. var e;
  30239. ee(ne)
  30240. }()))
  30241. }
  30242. e = e || f, ce > 0 || (Z(), function() {
  30243. if (d.preRun)
  30244. for ("function" == typeof d.preRun && (d.preRun = [d.preRun]); d.preRun.length;) e = d
  30245. .preRun.shift(), te.unshift(e);
  30246. var e;
  30247. ee(te)
  30248. }(), ce > 0 || (d.setStatus ? (d.setStatus("Running..."), setTimeout(function() {
  30249. setTimeout(function() {
  30250. d.setStatus("")
  30251. }, 1), t()
  30252. }, 1)) : t(), $()))
  30253. }
  30254. if (d.__growWasmMemory = function() {
  30255. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30256. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30257. .asm.__growWasmMemory.apply(null, arguments)
  30258. }, d.dynCall_ii = function() {
  30259. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30260. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30261. .asm.dynCall_ii.apply(null, arguments)
  30262. }, d.dynCall_viiiii = function() {
  30263. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30264. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30265. .asm.dynCall_viiiii.apply(null, arguments)
  30266. }, d.dynCall_viiiiiifi = function() {
  30267. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30268. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30269. .asm.dynCall_viiiiiifi.apply(null, arguments)
  30270. }, d.dynCall_viiii = function() {
  30271. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30272. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30273. .asm.dynCall_viiii.apply(null, arguments)
  30274. }, d.dynCall_viii = function() {
  30275. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30276. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30277. .asm.dynCall_viii.apply(null, arguments)
  30278. }, d.dynCall_iiiiiii = function() {
  30279. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30280. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30281. .asm.dynCall_iiiiiii.apply(null, arguments)
  30282. }, d.dynCall_iiiiii = function() {
  30283. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30284. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30285. .asm.dynCall_iiiiii.apply(null, arguments)
  30286. }, d.dynCall_vii = function() {
  30287. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30288. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30289. .asm.dynCall_vii.apply(null, arguments)
  30290. }, d.dynCall_iii = function() {
  30291. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30292. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30293. .asm.dynCall_iii.apply(null, arguments)
  30294. }, d.dynCall_iiii = function() {
  30295. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30296. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30297. .asm.dynCall_iiii.apply(null, arguments)
  30298. }, d.dynCall_viiiiii = function() {
  30299. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30300. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30301. .asm.dynCall_viiiiii.apply(null, arguments)
  30302. }, d.dynCall_viiiiiiiii = function() {
  30303. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30304. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30305. .asm.dynCall_viiiiiiiii.apply(null, arguments)
  30306. }, d.dynCall_viiiiiiii = function() {
  30307. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30308. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30309. .asm.dynCall_viiiiiiii.apply(null, arguments)
  30310. }, d.dynCall_iiiii = function() {
  30311. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30312. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30313. .asm.dynCall_iiiii.apply(null, arguments)
  30314. }, d.dynCall_viiiiiiiiiiiiii = function() {
  30315. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30316. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30317. .asm.dynCall_viiiiiiiiiiiiii.apply(null, arguments)
  30318. }, d.dynCall_viiiiiiiiiii = function() {
  30319. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30320. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30321. .asm.dynCall_viiiiiiiiiii.apply(null, arguments)
  30322. }, d.dynCall_viiiiiii = function() {
  30323. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30324. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30325. .asm.dynCall_viiiiiii.apply(null, arguments)
  30326. }, d.dynCall_viiiiiiiiiiii = function() {
  30327. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30328. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30329. .asm.dynCall_viiiiiiiiiiii.apply(null, arguments)
  30330. }, d.dynCall_vi = function() {
  30331. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30332. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30333. .asm.dynCall_vi.apply(null, arguments)
  30334. }, d.dynCall_iiiiiiiii = function() {
  30335. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30336. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30337. .asm.dynCall_iiiiiiiii.apply(null, arguments)
  30338. }, d.dynCall_viiiifii = function() {
  30339. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30340. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30341. .asm.dynCall_viiiifii.apply(null, arguments)
  30342. }, d.dynCall_fii = function() {
  30343. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30344. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30345. .asm.dynCall_fii.apply(null, arguments)
  30346. }, d.dynCall_viiiiiiiiii = function() {
  30347. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30348. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30349. .asm.dynCall_viiiiiiiiii.apply(null, arguments)
  30350. }, d.dynCall_dd = function() {
  30351. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30352. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30353. .asm.dynCall_dd.apply(null, arguments)
  30354. }, d.dynCall_viifi = function() {
  30355. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30356. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30357. .asm.dynCall_viifi.apply(null, arguments)
  30358. }, d.dynCall_fiii = function() {
  30359. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30360. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30361. .asm.dynCall_fiii.apply(null, arguments)
  30362. }, d.dynCall_viidi = function() {
  30363. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30364. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30365. .asm.dynCall_viidi.apply(null, arguments)
  30366. }, d.dynCall_iiiiiiii = function() {
  30367. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30368. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30369. .asm.dynCall_iiiiiiii.apply(null, arguments)
  30370. }, d.dynCall_did = function() {
  30371. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30372. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30373. .asm.dynCall_did.apply(null, arguments)
  30374. }, d.dynCall_v = function() {
  30375. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30376. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30377. .asm.dynCall_v.apply(null, arguments)
  30378. }, d.dynCall_viiijj = function() {
  30379. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30380. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30381. .asm.dynCall_viiijj.apply(null, arguments)
  30382. }, d.dynCall_iiiiiiidiiddii = function() {
  30383. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30384. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30385. .asm.dynCall_iiiiiiidiiddii.apply(null, arguments)
  30386. }, d.dynCall_jij = function() {
  30387. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30388. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30389. .asm.dynCall_jij.apply(null, arguments)
  30390. }, d.dynCall_jii = function() {
  30391. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30392. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30393. .asm.dynCall_jii.apply(null, arguments)
  30394. }, d.dynCall_jiji = function() {
  30395. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30396. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30397. .asm.dynCall_jiji.apply(null, arguments)
  30398. }, d.dynCall_iidiiii = function() {
  30399. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  30400. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  30401. .asm.dynCall_iidiiii.apply(null, arguments)
  30402. }, d.asm = je, Object.getOwnPropertyDescriptor(d, "intArrayFromString") || (d.intArrayFromString =
  30403. function() {
  30404. ve(
  30405. "'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30406. }), Object.getOwnPropertyDescriptor(d, "intArrayToString") || (d.intArrayToString = function() {
  30407. ve(
  30408. "'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30409. }), d.ccall = x, d.cwrap = function(e, t, i, r) {
  30410. return function() {
  30411. return x(e, t, i, arguments)
  30412. }
  30413. }, Object.getOwnPropertyDescriptor(d, "setValue") || (d.setValue = function() {
  30414. ve("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30415. }), Object.getOwnPropertyDescriptor(d, "getValue") || (d.getValue = function() {
  30416. ve("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30417. }), Object.getOwnPropertyDescriptor(d, "allocate") || (d.allocate = function() {
  30418. ve("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30419. }), Object.getOwnPropertyDescriptor(d, "getMemory") || (d.getMemory = function() {
  30420. ve(
  30421. "'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30422. }), Object.getOwnPropertyDescriptor(d, "AsciiToString") || (d.AsciiToString = function() {
  30423. ve("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30424. }), Object.getOwnPropertyDescriptor(d, "stringToAscii") || (d.stringToAscii = function() {
  30425. ve("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30426. }), Object.getOwnPropertyDescriptor(d, "UTF8ArrayToString") || (d.UTF8ArrayToString = function() {
  30427. ve(
  30428. "'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30429. }), Object.getOwnPropertyDescriptor(d, "UTF8ToString") || (d.UTF8ToString = function() {
  30430. ve("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30431. }), Object.getOwnPropertyDescriptor(d, "stringToUTF8Array") || (d.stringToUTF8Array = function() {
  30432. ve(
  30433. "'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30434. }), Object.getOwnPropertyDescriptor(d, "stringToUTF8") || (d.stringToUTF8 = function() {
  30435. ve("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30436. }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF8") || (d.lengthBytesUTF8 = function() {
  30437. ve("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30438. }), Object.getOwnPropertyDescriptor(d, "UTF16ToString") || (d.UTF16ToString = function() {
  30439. ve("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30440. }), Object.getOwnPropertyDescriptor(d, "stringToUTF16") || (d.stringToUTF16 = function() {
  30441. ve("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30442. }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF16") || (d.lengthBytesUTF16 = function() {
  30443. ve(
  30444. "'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30445. }), Object.getOwnPropertyDescriptor(d, "UTF32ToString") || (d.UTF32ToString = function() {
  30446. ve("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30447. }), Object.getOwnPropertyDescriptor(d, "stringToUTF32") || (d.stringToUTF32 = function() {
  30448. ve("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30449. }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF32") || (d.lengthBytesUTF32 = function() {
  30450. ve(
  30451. "'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30452. }), Object.getOwnPropertyDescriptor(d, "allocateUTF8") || (d.allocateUTF8 = function() {
  30453. ve("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30454. }), Object.getOwnPropertyDescriptor(d, "stackTrace") || (d.stackTrace = function() {
  30455. ve("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30456. }), Object.getOwnPropertyDescriptor(d, "addOnPreRun") || (d.addOnPreRun = function() {
  30457. ve("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30458. }), Object.getOwnPropertyDescriptor(d, "addOnInit") || (d.addOnInit = function() {
  30459. ve("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30460. }), Object.getOwnPropertyDescriptor(d, "addOnPreMain") || (d.addOnPreMain = function() {
  30461. ve("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30462. }), Object.getOwnPropertyDescriptor(d, "addOnExit") || (d.addOnExit = function() {
  30463. ve("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30464. }), Object.getOwnPropertyDescriptor(d, "addOnPostRun") || (d.addOnPostRun = function() {
  30465. ve("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30466. }), Object.getOwnPropertyDescriptor(d, "writeStringToMemory") || (d.writeStringToMemory =
  30467. function() {
  30468. ve(
  30469. "'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30470. }), Object.getOwnPropertyDescriptor(d, "writeArrayToMemory") || (d.writeArrayToMemory = function() {
  30471. ve(
  30472. "'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30473. }), Object.getOwnPropertyDescriptor(d, "writeAsciiToMemory") || (d.writeAsciiToMemory = function() {
  30474. ve(
  30475. "'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30476. }), Object.getOwnPropertyDescriptor(d, "addRunDependency") || (d.addRunDependency = function() {
  30477. ve(
  30478. "'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30479. }), Object.getOwnPropertyDescriptor(d, "removeRunDependency") || (d.removeRunDependency =
  30480. function() {
  30481. ve(
  30482. "'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30483. }), Object.getOwnPropertyDescriptor(d, "ENV") || (d.ENV = function() {
  30484. ve("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30485. }), Object.getOwnPropertyDescriptor(d, "FS") || (d.FS = function() {
  30486. ve("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30487. }), Object.getOwnPropertyDescriptor(d, "FS_createFolder") || (d.FS_createFolder = function() {
  30488. ve(
  30489. "'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30490. }), Object.getOwnPropertyDescriptor(d, "FS_createPath") || (d.FS_createPath = function() {
  30491. ve(
  30492. "'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30493. }), Object.getOwnPropertyDescriptor(d, "FS_createDataFile") || (d.FS_createDataFile = function() {
  30494. ve(
  30495. "'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30496. }), Object.getOwnPropertyDescriptor(d, "FS_createPreloadedFile") || (d.FS_createPreloadedFile =
  30497. function() {
  30498. ve(
  30499. "'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30500. }), Object.getOwnPropertyDescriptor(d, "FS_createLazyFile") || (d.FS_createLazyFile = function() {
  30501. ve(
  30502. "'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30503. }), Object.getOwnPropertyDescriptor(d, "FS_createLink") || (d.FS_createLink = function() {
  30504. ve(
  30505. "'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30506. }), Object.getOwnPropertyDescriptor(d, "FS_createDevice") || (d.FS_createDevice = function() {
  30507. ve(
  30508. "'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30509. }), Object.getOwnPropertyDescriptor(d, "FS_unlink") || (d.FS_unlink = function() {
  30510. ve(
  30511. "'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30512. }), Object.getOwnPropertyDescriptor(d, "GL") || (d.GL = function() {
  30513. ve("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30514. }), Object.getOwnPropertyDescriptor(d, "dynamicAlloc") || (d.dynamicAlloc = function() {
  30515. ve("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30516. }), Object.getOwnPropertyDescriptor(d, "loadDynamicLibrary") || (d.loadDynamicLibrary = function() {
  30517. ve(
  30518. "'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30519. }), Object.getOwnPropertyDescriptor(d, "loadWebAssemblyModule") || (d.loadWebAssemblyModule =
  30520. function() {
  30521. ve(
  30522. "'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30523. }), Object.getOwnPropertyDescriptor(d, "getLEB") || (d.getLEB = function() {
  30524. ve("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30525. }), Object.getOwnPropertyDescriptor(d, "getFunctionTables") || (d.getFunctionTables = function() {
  30526. ve(
  30527. "'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30528. }), Object.getOwnPropertyDescriptor(d, "alignFunctionTables") || (d.alignFunctionTables =
  30529. function() {
  30530. ve(
  30531. "'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30532. }), Object.getOwnPropertyDescriptor(d, "registerFunctions") || (d.registerFunctions = function() {
  30533. ve(
  30534. "'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30535. }), d.addFunction = function(e, t) {
  30536. return I(void 0 !== e), k(e, t)
  30537. }, Object.getOwnPropertyDescriptor(d, "removeFunction") || (d.removeFunction = function() {
  30538. ve("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30539. }), Object.getOwnPropertyDescriptor(d, "getFuncWrapper") || (d.getFuncWrapper = function() {
  30540. ve("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30541. }), Object.getOwnPropertyDescriptor(d, "prettyPrint") || (d.prettyPrint = function() {
  30542. ve("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30543. }), Object.getOwnPropertyDescriptor(d, "makeBigInt") || (d.makeBigInt = function() {
  30544. ve("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30545. }), Object.getOwnPropertyDescriptor(d, "dynCall") || (d.dynCall = function() {
  30546. ve("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30547. }), Object.getOwnPropertyDescriptor(d, "getCompilerSetting") || (d.getCompilerSetting = function() {
  30548. ve(
  30549. "'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30550. }), Object.getOwnPropertyDescriptor(d, "stackSave") || (d.stackSave = function() {
  30551. ve("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30552. }), Object.getOwnPropertyDescriptor(d, "stackRestore") || (d.stackRestore = function() {
  30553. ve("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30554. }), Object.getOwnPropertyDescriptor(d, "stackAlloc") || (d.stackAlloc = function() {
  30555. ve("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30556. }), Object.getOwnPropertyDescriptor(d, "establishStackSpace") || (d.establishStackSpace =
  30557. function() {
  30558. ve(
  30559. "'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30560. }), Object.getOwnPropertyDescriptor(d, "print") || (d.print = function() {
  30561. ve("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30562. }), Object.getOwnPropertyDescriptor(d, "printErr") || (d.printErr = function() {
  30563. ve("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30564. }), Object.getOwnPropertyDescriptor(d, "getTempRet0") || (d.getTempRet0 = function() {
  30565. ve("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30566. }), Object.getOwnPropertyDescriptor(d, "setTempRet0") || (d.setTempRet0 = function() {
  30567. ve("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30568. }), d.callMain = li, Object.getOwnPropertyDescriptor(d, "abort") || (d.abort = function() {
  30569. ve("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30570. }), Object.getOwnPropertyDescriptor(d, "Pointer_stringify") || (d.Pointer_stringify = function() {
  30571. ve(
  30572. "'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30573. }), Object.getOwnPropertyDescriptor(d, "warnOnce") || (d.warnOnce = function() {
  30574. ve("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30575. }), d.writeStackCookie = Z, d.checkStackCookie = $, d.abortStackOverflow = function(e) {
  30576. ve("Stack overflow! Attempted to allocate " + e + " bytes on the stack, but stack has only " + (
  30577. Y - ai() + e) + " bytes available!")
  30578. }, Object.getOwnPropertyDescriptor(d, "ALLOC_NORMAL") || Object.defineProperty(d, "ALLOC_NORMAL", {
  30579. configurable: !0,
  30580. get: function() {
  30581. ve(
  30582. "'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30583. }
  30584. }), Object.getOwnPropertyDescriptor(d, "ALLOC_STACK") || Object.defineProperty(d, "ALLOC_STACK", {
  30585. configurable: !0,
  30586. get: function() {
  30587. ve("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30588. }
  30589. }), Object.getOwnPropertyDescriptor(d, "ALLOC_DYNAMIC") || Object.defineProperty(d,
  30590. "ALLOC_DYNAMIC", {
  30591. configurable: !0,
  30592. get: function() {
  30593. ve(
  30594. "'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30595. }
  30596. }), Object.getOwnPropertyDescriptor(d, "ALLOC_NONE") || Object.defineProperty(d, "ALLOC_NONE", {
  30597. configurable: !0,
  30598. get: function() {
  30599. ve("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  30600. }
  30601. }), Object.getOwnPropertyDescriptor(d, "calledRun") || Object.defineProperty(d, "calledRun", {
  30602. configurable: !0,
  30603. get: function() {
  30604. ve(
  30605. "'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  30606. }
  30607. }), fe = function e() {
  30608. ti || di(), ti || (fe = e)
  30609. }, d.run = di, d.preInit)
  30610. for ("function" == typeof d.preInit && (d.preInit = [d.preInit]); d.preInit.length > 0;) d.preInit
  30611. .pop()();
  30612. var ci = !0;
  30613. d.noInitialRun && (ci = !1), s = !0, di()
  30614. }
  30615. t.default = function(e) {
  30616. e.recordChunkData = null, e.recordChunkSize = 0, e.recordChunkPos = 0, e.exitFlag = !1, e
  30617. .audioCodecId = 0, e.audioSamplerate = 8e3, e.audioChannelCount = 1, e.videoRawData = null, e
  30618. .videoPTS = 0, e.audioPTS = 0, e.videoLastPts = 0, e.audioLastPts = 0, e.audioRawData = null, e
  30619. .mp4CallbackFunc = null, d.onRuntimeInitialized = function() {
  30620. u = !0
  30621. }, e.addEventListener("message", function(t) {
  30622. var i = t.data;
  30623. switch (i.cmd) {
  30624. case o.w:
  30625. l = i.url, e.audioSamplerate = i.audioSamplerate, e.audioChannelCount = i.channelCount,
  30626. parseInt(e.audioSamplerate) >= 8e3 && (e.audioCodecId = 86018), u || c(), null == e
  30627. .recordChunkData && (e.recordChunkData = new Uint8Array(i.filesize + 8388608), e
  30628. .recordChunkSize = i.filesize), e.recordChunkPos = 0, e.exitFlag = !1;
  30629. var r = {
  30630. cmd: o.w
  30631. };
  30632. e.postMessage(r);
  30633. break;
  30634. case o.l:
  30635. e.exitFlag = !0, e.recordChunkData && (delete e.recordChunkData, e.recordChunkData =
  30636. null), null != e.videoRawData && (d._free(e.videoRawData), e.videoRawData = null),
  30637. null != e.audioRawData && (d._free(e.audioRawData), e.audioRawData = null);
  30638. break;
  30639. case o.C:
  30640. if (null == e.recordChunkData) break;
  30641. if (e.recordChunkData.byteLength < 1) break;
  30642. e.exitFlag = !0, u && d._WasmDecoder_ReleaseMP4File();
  30643. break;
  30644. case o.q:
  30645. if (e.exitFlag) break;
  30646. if (u && (null == e.videoRawData && (null == e.videoRawData && (e.videoRawData = d
  30647. ._malloc(8294400)), null == e.audioRawData && (e.audioRawData = d._malloc(16384)),
  30648. e.videoPTS = 0, e.videoLastPts = 0, e.audioPTS = 0, e.audioLastPts = 0, e
  30649. .mp4CallbackFunc = d.addFunction(function(t, i, r, n) {
  30650. if (3 == i) {
  30651. var a = d.HEAPU8.subarray(r, r + 4);
  30652. if (e.recordChunkData.set(a, n), e.recordChunkPos > e.recordChunkSize) {
  30653. e.blob = URL.createObjectURL(new Blob([e.recordChunkData], {
  30654. type: "video/mp4"
  30655. }));
  30656. var s = {
  30657. cmd: o.p,
  30658. type: "auto",
  30659. dat: e.blob
  30660. };
  30661. e.postMessage(s)
  30662. } else {
  30663. var u = e.recordChunkData.subarray(0, e.recordChunkPos),
  30664. l = new Uint8Array(u);
  30665. delete e.recordChunkData, e.recordChunkData = null, e.blob = URL
  30666. .createObjectURL(new Blob([l], {
  30667. type: "video/mp4"
  30668. })), s = {
  30669. cmd: o.p,
  30670. type: "manual",
  30671. dat: e.blob
  30672. }, e.postMessage(s)
  30673. }
  30674. } else a = d.HEAPU8.subarray(r, r + n), e.recordChunkData.set(a, e
  30675. .recordChunkPos), e.recordChunkPos += a.length
  30676. }, "iiiii"), d._WasmDecoder_CreateMP4File(i.codecId, 0, 0, e.audioCodecId, e
  30677. .audioSamplerate, e.audioChannelCount, e.mp4CallbackFunc, e)), e.recordChunkPos >
  30678. 0 || i.type)) {
  30679. i.type;
  30680. var n = 1,
  30681. a = e.videoPTS;
  30682. if ("video" == i.mediaType) {
  30683. if (e.videoLastPts < 1) e.videoPTS = 0;
  30684. else {
  30685. var s = i.pts - e.videoLastPts;
  30686. e.videoPTS += s
  30687. }
  30688. e.videoLastPts = i.pts, a = e.videoPTS
  30689. } else {
  30690. if (n = 2, e.audioLastPts < 1) e.audioPTS = 0;
  30691. else {
  30692. var h = i.pts - e.audioLastPts;
  30693. e.audioPTS += h
  30694. }
  30695. e.audioLastPts = i.pts, a = e.audioPTS
  30696. }
  30697. d.HEAPU8.set(i.dat, e.videoRawData), d._WasmDecoder_WriteData(n, e.videoRawData, i.dat
  30698. .length, i.type, a), e.recordChunkPos + i.dat.byteLength > e.recordChunkSize && (e
  30699. .exitFlag = !0, d._WasmDecoder_ReleaseMP4File())
  30700. }
  30701. }
  30702. })
  30703. }
  30704. }.call(this, i(9), "/", i(68)(e), i(10).Buffer)
  30705. }, function(e, t) {
  30706. e.exports = function(e) {
  30707. if (!e.webpackPolyfill) {
  30708. var t = Object.create(e);
  30709. t.children || (t.children = []), Object.defineProperty(t, "loaded", {
  30710. enumerable: !0,
  30711. get: function() {
  30712. return t.l
  30713. }
  30714. }), Object.defineProperty(t, "id", {
  30715. enumerable: !0,
  30716. get: function() {
  30717. return t.i
  30718. }
  30719. }), Object.defineProperty(t, "exports", {
  30720. enumerable: !0
  30721. }), t.webpackPolyfill = 1
  30722. }
  30723. return t
  30724. }
  30725. }, function(e, t) {}, function(e, t, i) {
  30726. (function(e) {
  30727. function i(e, t) {
  30728. for (var i = 0, r = e.length - 1; r >= 0; r--) {
  30729. var n = e[r];
  30730. "." === n ? e.splice(r, 1) : ".." === n ? (e.splice(r, 1), i++) : i && (e.splice(r, 1), i--)
  30731. }
  30732. if (t)
  30733. for (; i--; i) e.unshift("..");
  30734. return e
  30735. }
  30736. function r(e, t) {
  30737. if (e.filter) return e.filter(t);
  30738. for (var i = [], r = 0; r < e.length; r++) t(e[r], r, e) && i.push(e[r]);
  30739. return i
  30740. }
  30741. t.resolve = function() {
  30742. for (var t = "", n = !1, a = arguments.length - 1; a >= -1 && !n; a--) {
  30743. var s = a >= 0 ? arguments[a] : e.cwd();
  30744. if ("string" != typeof s) throw new TypeError("Arguments to path.resolve must be strings");
  30745. s && (t = s + "/" + t, n = "/" === s.charAt(0))
  30746. }
  30747. return (n ? "/" : "") + (t = i(r(t.split("/"), function(e) {
  30748. return !!e
  30749. }), !n).join("/")) || "."
  30750. }, t.normalize = function(e) {
  30751. var a = t.isAbsolute(e),
  30752. s = "/" === n(e, -1);
  30753. return (e = i(r(e.split("/"), function(e) {
  30754. return !!e
  30755. }), !a).join("/")) || a || (e = "."), e && s && (e += "/"), (a ? "/" : "") + e
  30756. }, t.isAbsolute = function(e) {
  30757. return "/" === e.charAt(0)
  30758. }, t.join = function() {
  30759. var e = Array.prototype.slice.call(arguments, 0);
  30760. return t.normalize(r(e, function(e, t) {
  30761. if ("string" != typeof e) throw new TypeError("Arguments to path.join must be strings");
  30762. return e
  30763. }).join("/"))
  30764. }, t.relative = function(e, i) {
  30765. function r(e) {
  30766. for (var t = 0; t < e.length && "" === e[t]; t++);
  30767. for (var i = e.length - 1; i >= 0 && "" === e[i]; i--);
  30768. return t > i ? [] : e.slice(t, i - t + 1)
  30769. }
  30770. e = t.resolve(e).substr(1), i = t.resolve(i).substr(1);
  30771. for (var n = r(e.split("/")), a = r(i.split("/")), s = Math.min(n.length, a.length), o = s, u =
  30772. 0; u < s; u++)
  30773. if (n[u] !== a[u]) {
  30774. o = u;
  30775. break
  30776. } var l = [];
  30777. for (u = o; u < n.length; u++) l.push("..");
  30778. return (l = l.concat(a.slice(o))).join("/")
  30779. }, t.sep = "/", t.delimiter = ":", t.dirname = function(e) {
  30780. if ("string" != typeof e && (e += ""), 0 === e.length) return ".";
  30781. for (var t = e.charCodeAt(0), i = 47 === t, r = -1, n = !0, a = e.length - 1; a >= 1; --a)
  30782. if (47 === (t = e.charCodeAt(a))) {
  30783. if (!n) {
  30784. r = a;
  30785. break
  30786. }
  30787. } else n = !1;
  30788. return -1 === r ? i ? "/" : "." : i && 1 === r ? "/" : e.slice(0, r)
  30789. }, t.basename = function(e, t) {
  30790. var i = function(e) {
  30791. "string" != typeof e && (e += "");
  30792. var t, i = 0,
  30793. r = -1,
  30794. n = !0;
  30795. for (t = e.length - 1; t >= 0; --t)
  30796. if (47 === e.charCodeAt(t)) {
  30797. if (!n) {
  30798. i = t + 1;
  30799. break
  30800. }
  30801. } else -1 === r && (n = !1, r = t + 1);
  30802. return -1 === r ? "" : e.slice(i, r)
  30803. }(e);
  30804. return t && i.substr(-1 * t.length) === t && (i = i.substr(0, i.length - t.length)), i
  30805. }, t.extname = function(e) {
  30806. "string" != typeof e && (e += "");
  30807. for (var t = -1, i = 0, r = -1, n = !0, a = 0, s = e.length - 1; s >= 0; --s) {
  30808. var o = e.charCodeAt(s);
  30809. if (47 !== o) - 1 === r && (n = !1, r = s + 1), 46 === o ? -1 === t ? t = s : 1 !== a && (a = 1) :
  30810. -1 !== t && (a = -1);
  30811. else if (!n) {
  30812. i = s + 1;
  30813. break
  30814. }
  30815. }
  30816. return -1 === t || -1 === r || 0 === a || 1 === a && t === r - 1 && t === i + 1 ? "" : e.slice(t, r)
  30817. };
  30818. var n = "b" === "ab".substr(-1) ? function(e, t, i) {
  30819. return e.substr(t, i)
  30820. } : function(e, t, i) {
  30821. return t < 0 && (t = e.length + t), e.substr(t, i)
  30822. }
  30823. }).call(this, i(9))
  30824. }, function(e, t, i) {
  30825. "use strict";
  30826. t.randomBytes = t.rng = t.pseudoRandomBytes = t.prng = i(24), t.createHash = t.Hash = i(31), t.createHmac =
  30827. t.Hmac = i(85);
  30828. var r = i(160),
  30829. n = Object.keys(r),
  30830. a = ["sha1", "sha224", "sha256", "sha384", "sha512", "md5", "rmd160"].concat(n);
  30831. t.getHashes = function() {
  30832. return a
  30833. };
  30834. var s = i(88);
  30835. t.pbkdf2 = s.pbkdf2, t.pbkdf2Sync = s.pbkdf2Sync;
  30836. var o = i(162);
  30837. t.Cipher = o.Cipher, t.createCipher = o.createCipher, t.Cipheriv = o.Cipheriv, t.createCipheriv = o
  30838. .createCipheriv, t.Decipher = o.Decipher, t.createDecipher = o.createDecipher, t.Decipheriv = o
  30839. .Decipheriv, t.createDecipheriv = o.createDecipheriv, t.getCiphers = o.getCiphers, t.listCiphers = o
  30840. .listCiphers;
  30841. var u = i(177);
  30842. t.DiffieHellmanGroup = u.DiffieHellmanGroup, t.createDiffieHellmanGroup = u.createDiffieHellmanGroup, t
  30843. .getDiffieHellman = u.getDiffieHellman, t.createDiffieHellman = u.createDiffieHellman, t.DiffieHellman = u
  30844. .DiffieHellman;
  30845. var l = i(182);
  30846. t.createSign = l.createSign, t.Sign = l.Sign, t.createVerify = l.createVerify, t.Verify = l.Verify, t
  30847. .createECDH = i(223);
  30848. var d = i(224);
  30849. t.publicEncrypt = d.publicEncrypt, t.privateEncrypt = d.privateEncrypt, t.publicDecrypt = d.publicDecrypt, t
  30850. .privateDecrypt = d.privateDecrypt;
  30851. var c = i(227);
  30852. t.randomFill = c.randomFill, t.randomFillSync = c.randomFillSync, t.createCredentials = function() {
  30853. throw new Error(["sorry, createCredentials is not implemented yet", "we accept pull requests",
  30854. "https://github.com/crypto-browserify/crypto-browserify"
  30855. ].join("\n"))
  30856. }, t.constants = {
  30857. DH_CHECK_P_NOT_SAFE_PRIME: 2,
  30858. DH_CHECK_P_NOT_PRIME: 1,
  30859. DH_UNABLE_TO_CHECK_GENERATOR: 4,
  30860. DH_NOT_SUITABLE_GENERATOR: 8,
  30861. NPN_ENABLED: 1,
  30862. ALPN_ENABLED: 1,
  30863. RSA_PKCS1_PADDING: 1,
  30864. RSA_SSLV23_PADDING: 2,
  30865. RSA_NO_PADDING: 3,
  30866. RSA_PKCS1_OAEP_PADDING: 4,
  30867. RSA_X931_PADDING: 5,
  30868. RSA_PKCS1_PSS_PADDING: 6,
  30869. POINT_CONVERSION_COMPRESSED: 2,
  30870. POINT_CONVERSION_UNCOMPRESSED: 4,
  30871. POINT_CONVERSION_HYBRID: 6
  30872. }
  30873. }, function(e, t, i) {
  30874. "use strict";
  30875. var r = i(6).Buffer,
  30876. n = i(136).Transform;
  30877. function a(e) {
  30878. n.call(this), this._block = r.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [
  30879. 0, 0, 0, 0
  30880. ], this._finalized = !1
  30881. }
  30882. i(5)(a, n), a.prototype._transform = function(e, t, i) {
  30883. var r = null;
  30884. try {
  30885. this.update(e, t)
  30886. } catch (e) {
  30887. r = e
  30888. }
  30889. i(r)
  30890. }, a.prototype._flush = function(e) {
  30891. var t = null;
  30892. try {
  30893. this.push(this.digest())
  30894. } catch (e) {
  30895. t = e
  30896. }
  30897. e(t)
  30898. }, a.prototype.update = function(e, t) {
  30899. if (function(e, t) {
  30900. if (!r.isBuffer(e) && "string" != typeof e) throw new TypeError("Data must be a string or a buffer")
  30901. }(e), this._finalized) throw new Error("Digest already called");
  30902. r.isBuffer(e) || (e = r.from(e, t));
  30903. for (var i = this._block, n = 0; this._blockOffset + e.length - n >= this._blockSize;) {
  30904. for (var a = this._blockOffset; a < this._blockSize;) i[a++] = e[n++];
  30905. this._update(), this._blockOffset = 0
  30906. }
  30907. for (; n < e.length;) i[this._blockOffset++] = e[n++];
  30908. for (var s = 0, o = 8 * e.length; o > 0; ++s) this._length[s] += o, (o = this._length[s] / 4294967296 |
  30909. 0) > 0 && (this._length[s] -= 4294967296 * o);
  30910. return this
  30911. }, a.prototype._update = function() {
  30912. throw new Error("_update is not implemented")
  30913. }, a.prototype.digest = function(e) {
  30914. if (this._finalized) throw new Error("Digest already called");
  30915. this._finalized = !0;
  30916. var t = this._digest();
  30917. void 0 !== e && (t = t.toString(e)), this._block.fill(0), this._blockOffset = 0;
  30918. for (var i = 0; i < 4; ++i) this._length[i] = 0;
  30919. return t
  30920. }, a.prototype._digest = function() {
  30921. throw new Error("_digest is not implemented")
  30922. }, e.exports = a
  30923. }, function(e, t, i) {
  30924. "use strict";
  30925. (function(t, r) {
  30926. var n;
  30927. e.exports = A, A.ReadableState = S, i(8).EventEmitter;
  30928. var a, s = function(e, t) {
  30929. return e.listeners(t).length
  30930. },
  30931. o = i(74),
  30932. u = i(10).Buffer,
  30933. l = t.Uint8Array || function() {},
  30934. d = i(137);
  30935. a = d && d.debuglog ? d.debuglog("stream") : function() {};
  30936. var c, h, f, p = i(138),
  30937. m = i(75),
  30938. g = i(76).getHighWaterMark,
  30939. v = i(25).codes,
  30940. y = v.ERR_INVALID_ARG_TYPE,
  30941. _ = v.ERR_STREAM_PUSH_AFTER_EOF,
  30942. b = v.ERR_METHOD_NOT_IMPLEMENTED,
  30943. w = v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
  30944. i(5)(A, o);
  30945. var E = m.errorOrDestroy,
  30946. T = ["error", "close", "destroy", "pause", "resume"];
  30947. function S(e, t, r) {
  30948. n = n || i(26), e = e || {}, "boolean" != typeof r && (r = t instanceof n), this.objectMode = !!e
  30949. .objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode), this
  30950. .highWaterMark = g(this, e, "readableHighWaterMark", r), this.buffer = new p, this.length = 0, this
  30951. .pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this
  30952. .reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this
  30953. .readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = !1 !== e
  30954. .emitClose, this.autoDestroy = !!e.autoDestroy, this.destroyed = !1, this.defaultEncoding = e
  30955. .defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this
  30956. .encoding = null, e.encoding && (c || (c = i(22).StringDecoder), this.decoder = new c(e.encoding),
  30957. this.encoding = e.encoding)
  30958. }
  30959. function A(e) {
  30960. if (n = n || i(26), !(this instanceof A)) return new A(e);
  30961. var t = this instanceof n;
  30962. this._readableState = new S(e, this, t), this.readable = !0, e && ("function" == typeof e.read && (
  30963. this._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), o.call(this)
  30964. }
  30965. function k(e, t, i, r, n) {
  30966. a("readableAddChunk", t);
  30967. var s, o = e._readableState;
  30968. if (null === t) o.reading = !1,
  30969. function(e, t) {
  30970. if (a("onEofChunk"), !t.ended) {
  30971. if (t.decoder) {
  30972. var i = t.decoder.end();
  30973. i && i.length && (t.buffer.push(i), t.length += t.objectMode ? 1 : i.length)
  30974. }
  30975. t.ended = !0, t.sync ? O(e) : (t.needReadable = !1, t.emittedReadable || (t.emittedReadable = !
  30976. 0, C(e)))
  30977. }
  30978. }(e, o);
  30979. else if (n || (s = function(e, t) {
  30980. var i, r;
  30981. return r = t, u.isBuffer(r) || r instanceof l || "string" == typeof t || void 0 === t || e
  30982. .objectMode || (i = new y("chunk", ["string", "Buffer", "Uint8Array"], t)), i
  30983. }(o, t)), s) E(e, s);
  30984. else if (o.objectMode || t && t.length > 0)
  30985. if ("string" == typeof t || o.objectMode || Object.getPrototypeOf(t) === u.prototype || (t =
  30986. function(e) {
  30987. return u.from(e)
  30988. }(t)), r) o.endEmitted ? E(e, new w) : R(e, o, t, !0);
  30989. else if (o.ended) E(e, new _);
  30990. else {
  30991. if (o.destroyed) return !1;
  30992. o.reading = !1, o.decoder && !i ? (t = o.decoder.write(t), o.objectMode || 0 !== t.length ? R(e, o,
  30993. t, !1) : D(e, o)) : R(e, o, t, !1)
  30994. } else r || (o.reading = !1, D(e, o));
  30995. return !o.ended && (o.length < o.highWaterMark || 0 === o.length)
  30996. }
  30997. function R(e, t, i, r) {
  30998. t.flowing && 0 === t.length && !t.sync ? (t.awaitDrain = 0, e.emit("data", i)) : (t.length += t
  30999. .objectMode ? 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && O(e)),
  31000. D(e, t)
  31001. }
  31002. function M(e, t) {
  31003. return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t
  31004. .buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) {
  31005. return e >= 1073741824 ? e = 1073741824 : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |=
  31006. e >>> 8, e |= e >>> 16, e++), e
  31007. }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0))
  31008. }
  31009. function O(e) {
  31010. var t = e._readableState;
  31011. a("emitReadable", t.needReadable, t.emittedReadable), t.needReadable = !1, t.emittedReadable || (a(
  31012. "emitReadable", t.flowing), t.emittedReadable = !0, r.nextTick(C, e))
  31013. }
  31014. function C(e) {
  31015. var t = e._readableState;
  31016. a("emitReadable_", t.destroyed, t.length, t.ended), t.destroyed || !t.length && !t.ended || (e.emit(
  31017. "readable"), t.emittedReadable = !1), t.needReadable = !t.flowing && !t.ended && t.length <= t
  31018. .highWaterMark, U(e)
  31019. }
  31020. function D(e, t) {
  31021. t.readingMore || (t.readingMore = !0, r.nextTick(I, e, t))
  31022. }
  31023. function I(e, t) {
  31024. for (; !t.reading && !t.ended && (t.length < t.highWaterMark || t.flowing && 0 === t.length);) {
  31025. var i = t.length;
  31026. if (a("maybeReadMore read 0"), e.read(0), i === t.length) break
  31027. }
  31028. t.readingMore = !1
  31029. }
  31030. function L(e) {
  31031. var t = e._readableState;
  31032. t.readableListening = e.listenerCount("readable") > 0, t.resumeScheduled && !t.paused ? t.flowing = !
  31033. 0 : e.listenerCount("data") > 0 && e.resume()
  31034. }
  31035. function x(e) {
  31036. a("readable nexttick read 0"), e.read(0)
  31037. }
  31038. function P(e, t) {
  31039. a("resume", t.reading), t.reading || e.read(0), t.resumeScheduled = !1, e.emit("resume"), U(e), t
  31040. .flowing && !t.reading && e.read(0)
  31041. }
  31042. function U(e) {
  31043. var t = e._readableState;
  31044. for (a("flow", t.flowing); t.flowing && null !== e.read(););
  31045. }
  31046. function N(e, t) {
  31047. return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t
  31048. .decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.first() : t.buffer.concat(t
  31049. .length), t.buffer.clear()) : i = t.buffer.consume(e, t.decoder), i);
  31050. var i
  31051. }
  31052. function B(e) {
  31053. var t = e._readableState;
  31054. a("endReadable", t.endEmitted), t.endEmitted || (t.ended = !0, r.nextTick(F, t, e))
  31055. }
  31056. function F(e, t) {
  31057. if (a("endReadableNT", e.endEmitted, e.length), !e.endEmitted && 0 === e.length && (e.endEmitted = !0,
  31058. t.readable = !1, t.emit("end"), e.autoDestroy)) {
  31059. var i = t._writableState;
  31060. (!i || i.autoDestroy && i.finished) && t.destroy()
  31061. }
  31062. }
  31063. function j(e, t) {
  31064. for (var i = 0, r = e.length; i < r; i++)
  31065. if (e[i] === t) return i;
  31066. return -1
  31067. }
  31068. Object.defineProperty(A.prototype, "destroyed", {
  31069. enumerable: !1,
  31070. get: function() {
  31071. return void 0 !== this._readableState && this._readableState.destroyed
  31072. },
  31073. set: function(e) {
  31074. this._readableState && (this._readableState.destroyed = e)
  31075. }
  31076. }), A.prototype.destroy = m.destroy, A.prototype._undestroy = m.undestroy, A.prototype._destroy =
  31077. function(e, t) {
  31078. t(e)
  31079. }, A.prototype.push = function(e, t) {
  31080. var i, r = this._readableState;
  31081. return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r
  31082. .encoding && (e = u.from(e, t), t = ""), i = !0), k(this, e, t, !1, i)
  31083. }, A.prototype.unshift = function(e) {
  31084. return k(this, e, null, !0, !1)
  31085. }, A.prototype.isPaused = function() {
  31086. return !1 === this._readableState.flowing
  31087. }, A.prototype.setEncoding = function(e) {
  31088. c || (c = i(22).StringDecoder);
  31089. var t = new c(e);
  31090. this._readableState.decoder = t, this._readableState.encoding = this._readableState.decoder
  31091. .encoding;
  31092. for (var r = this._readableState.buffer.head, n = ""; null !== r;) n += t.write(r.data), r = r.next;
  31093. return this._readableState.buffer.clear(), "" !== n && this._readableState.buffer.push(n), this
  31094. ._readableState.length = n.length, this
  31095. }, A.prototype.read = function(e) {
  31096. a("read", e), e = parseInt(e, 10);
  31097. var t = this._readableState,
  31098. i = e;
  31099. if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && ((0 !== t.highWaterMark ? t
  31100. .length >= t.highWaterMark : t.length > 0) || t.ended)) return a("read: emitReadable", t.length,
  31101. t.ended), 0 === t.length && t.ended ? B(this) : O(this), null;
  31102. if (0 === (e = M(e, t)) && t.ended) return 0 === t.length && B(this), null;
  31103. var r, n = t.needReadable;
  31104. return a("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && a(
  31105. "length less than watermark", n = !0), t.ended || t.reading ? a("reading or ended", n = !1) :
  31106. n && (a("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this
  31107. ._read(t.highWaterMark), t.sync = !1, t.reading || (e = M(i, t))), null === (r = e > 0 ? N(e,
  31108. t) : null) ? (t.needReadable = t.length <= t.highWaterMark, e = 0) : (t.length -= e, t
  31109. .awaitDrain = 0), 0 === t.length && (t.ended || (t.needReadable = !0), i !== e && t.ended && B(
  31110. this)), null !== r && this.emit("data", r), r
  31111. }, A.prototype._read = function(e) {
  31112. E(this, new b("_read()"))
  31113. }, A.prototype.pipe = function(e, t) {
  31114. var i = this,
  31115. n = this._readableState;
  31116. switch (n.pipesCount) {
  31117. case 0:
  31118. n.pipes = e;
  31119. break;
  31120. case 1:
  31121. n.pipes = [n.pipes, e];
  31122. break;
  31123. default:
  31124. n.pipes.push(e)
  31125. }
  31126. n.pipesCount += 1, a("pipe count=%d opts=%j", n.pipesCount, t);
  31127. var o = t && !1 === t.end || e === r.stdout || e === r.stderr ? m : u;
  31128. function u() {
  31129. a("onend"), e.end()
  31130. }
  31131. n.endEmitted ? r.nextTick(o) : i.once("end", o), e.on("unpipe", function t(r, s) {
  31132. a("onunpipe"), r === i && s && !1 === s.hasUnpiped && (s.hasUnpiped = !0, a("cleanup"), e
  31133. .removeListener("close", f), e.removeListener("finish", p), e.removeListener("drain", l),
  31134. e.removeListener("error", h), e.removeListener("unpipe", t), i.removeListener("end", u), i
  31135. .removeListener("end", m), i.removeListener("data", c), d = !0, !n.awaitDrain || e
  31136. ._writableState && !e._writableState.needDrain || l())
  31137. });
  31138. var l = function(e) {
  31139. return function() {
  31140. var t = e._readableState;
  31141. a("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && s(e,
  31142. "data") && (t.flowing = !0, U(e))
  31143. }
  31144. }(i);
  31145. e.on("drain", l);
  31146. var d = !1;
  31147. function c(t) {
  31148. a("ondata");
  31149. var r = e.write(t);
  31150. a("dest.write", r), !1 === r && ((1 === n.pipesCount && n.pipes === e || n.pipesCount > 1 && -
  31151. 1 !== j(n.pipes, e)) && !d && (a("false write response, pause", n.awaitDrain), n
  31152. .awaitDrain++), i.pause())
  31153. }
  31154. function h(t) {
  31155. a("onerror", t), m(), e.removeListener("error", h), 0 === s(e, "error") && E(e, t)
  31156. }
  31157. function f() {
  31158. e.removeListener("finish", p), m()
  31159. }
  31160. function p() {
  31161. a("onfinish"), e.removeListener("close", f), m()
  31162. }
  31163. function m() {
  31164. a("unpipe"), i.unpipe(e)
  31165. }
  31166. return i.on("data", c),
  31167. function(e, t, i) {
  31168. if ("function" == typeof e.prependListener) return e.prependListener(t, i);
  31169. e._events && e._events[t] ? Array.isArray(e._events[t]) ? e._events[t].unshift(i) : e._events[
  31170. t] = [i, e._events[t]] : e.on(t, i)
  31171. }(e, "error", h), e.once("close", f), e.once("finish", p), e.emit("pipe", i), n.flowing || (a(
  31172. "pipe resume"), i.resume()), e
  31173. }, A.prototype.unpipe = function(e) {
  31174. var t = this._readableState,
  31175. i = {
  31176. hasUnpiped: !1
  31177. };
  31178. if (0 === t.pipesCount) return this;
  31179. if (1 === t.pipesCount) return e && e !== t.pipes || (e || (e = t.pipes), t.pipes = null, t
  31180. .pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, i)), this;
  31181. if (!e) {
  31182. var r = t.pipes,
  31183. n = t.pipesCount;
  31184. t.pipes = null, t.pipesCount = 0, t.flowing = !1;
  31185. for (var a = 0; a < n; a++) r[a].emit("unpipe", this, {
  31186. hasUnpiped: !1
  31187. });
  31188. return this
  31189. }
  31190. var s = j(t.pipes, e);
  31191. return -1 === s || (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t
  31192. .pipes[0]), e.emit("unpipe", this, i)), this
  31193. }, A.prototype.on = function(e, t) {
  31194. var i = o.prototype.on.call(this, e, t),
  31195. n = this._readableState;
  31196. return "data" === e ? (n.readableListening = this.listenerCount("readable") > 0, !1 !== n.flowing &&
  31197. this.resume()) : "readable" === e && (n.endEmitted || n.readableListening || (n
  31198. .readableListening = n.needReadable = !0, n.flowing = !1, n.emittedReadable = !1, a(
  31199. "on readable", n.length, n.reading), n.length ? O(this) : n.reading || r.nextTick(x, this))),
  31200. i
  31201. }, A.prototype.addListener = A.prototype.on, A.prototype.removeListener = function(e, t) {
  31202. var i = o.prototype.removeListener.call(this, e, t);
  31203. return "readable" === e && r.nextTick(L, this), i
  31204. }, A.prototype.removeAllListeners = function(e) {
  31205. var t = o.prototype.removeAllListeners.apply(this, arguments);
  31206. return "readable" !== e && void 0 !== e || r.nextTick(L, this), t
  31207. }, A.prototype.resume = function() {
  31208. var e = this._readableState;
  31209. return e.flowing || (a("resume"), e.flowing = !e.readableListening, function(e, t) {
  31210. t.resumeScheduled || (t.resumeScheduled = !0, r.nextTick(P, e, t))
  31211. }(this, e)), e.paused = !1, this
  31212. }, A.prototype.pause = function() {
  31213. return a("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState
  31214. .flowing && (a("pause"), this._readableState.flowing = !1, this.emit("pause")), this
  31215. ._readableState.paused = !0, this
  31216. }, A.prototype.wrap = function(e) {
  31217. var t = this,
  31218. i = this._readableState,
  31219. r = !1;
  31220. for (var n in e.on("end", function() {
  31221. if (a("wrapped end"), i.decoder && !i.ended) {
  31222. var e = i.decoder.end();
  31223. e && e.length && t.push(e)
  31224. }
  31225. t.push(null)
  31226. }), e.on("data", function(n) {
  31227. a("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n || (i
  31228. .objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause()))
  31229. }), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function(t) {
  31230. return function() {
  31231. return e[t].apply(e, arguments)
  31232. }
  31233. }(n));
  31234. for (var s = 0; s < T.length; s++) e.on(T[s], this.emit.bind(this, T[s]));
  31235. return this._read = function(t) {
  31236. a("wrapped _read", t), r && (r = !1, e.resume())
  31237. }, this
  31238. }, "function" == typeof Symbol && (A.prototype[Symbol.asyncIterator] = function() {
  31239. return void 0 === h && (h = i(140)), h(this)
  31240. }), Object.defineProperty(A.prototype, "readableHighWaterMark", {
  31241. enumerable: !1,
  31242. get: function() {
  31243. return this._readableState.highWaterMark
  31244. }
  31245. }), Object.defineProperty(A.prototype, "readableBuffer", {
  31246. enumerable: !1,
  31247. get: function() {
  31248. return this._readableState && this._readableState.buffer
  31249. }
  31250. }), Object.defineProperty(A.prototype, "readableFlowing", {
  31251. enumerable: !1,
  31252. get: function() {
  31253. return this._readableState.flowing
  31254. },
  31255. set: function(e) {
  31256. this._readableState && (this._readableState.flowing = e)
  31257. }
  31258. }), A._fromList = N, Object.defineProperty(A.prototype, "readableLength", {
  31259. enumerable: !1,
  31260. get: function() {
  31261. return this._readableState.length
  31262. }
  31263. }), "function" == typeof Symbol && (A.from = function(e, t) {
  31264. return void 0 === f && (f = i(141)), f(A, e, t)
  31265. })
  31266. }).call(this, i(13), i(9))
  31267. }, function(e, t, i) {
  31268. e.exports = i(8).EventEmitter
  31269. }, function(e, t, i) {
  31270. "use strict";
  31271. (function(t) {
  31272. function i(e, t) {
  31273. n(e, t), r(e)
  31274. }
  31275. function r(e) {
  31276. e._writableState && !e._writableState.emitClose || e._readableState && !e._readableState.emitClose ||
  31277. e.emit("close")
  31278. }
  31279. function n(e, t) {
  31280. e.emit("error", t)
  31281. }
  31282. e.exports = {
  31283. destroy: function(e, a) {
  31284. var s = this,
  31285. o = this._readableState && this._readableState.destroyed,
  31286. u = this._writableState && this._writableState.destroyed;
  31287. return o || u ? (a ? a(e) : e && (this._writableState ? this._writableState.errorEmitted || (
  31288. this._writableState.errorEmitted = !0, t.nextTick(n, this, e)) : t.nextTick(n, this, e)),
  31289. this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState &&
  31290. (this._writableState.destroyed = !0), this._destroy(e || null, function(e) {
  31291. !a && e ? s._writableState ? s._writableState.errorEmitted ? t.nextTick(r, s) : (s
  31292. ._writableState.errorEmitted = !0, t.nextTick(i, s, e)) : t.nextTick(i, s, e) : a ?
  31293. (t.nextTick(r, s), a(e)) : t.nextTick(r, s)
  31294. }), this)
  31295. },
  31296. undestroy: function() {
  31297. this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1,
  31298. this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState &&
  31299. (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState
  31300. .ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1,
  31301. this._writableState.finished = !1, this._writableState.errorEmitted = !1)
  31302. },
  31303. errorOrDestroy: function(e, t) {
  31304. var i = e._readableState,
  31305. r = e._writableState;
  31306. i && i.autoDestroy || r && r.autoDestroy ? e.destroy(t) : e.emit("error", t)
  31307. }
  31308. }
  31309. }).call(this, i(9))
  31310. }, function(e, t, i) {
  31311. "use strict";
  31312. var r = i(25).codes.ERR_INVALID_OPT_VALUE;
  31313. e.exports = {
  31314. getHighWaterMark: function(e, t, i, n) {
  31315. var a = function(e, t, i) {
  31316. return null != e.highWaterMark ? e.highWaterMark : t ? e[i] : null
  31317. }(t, n, i);
  31318. if (null != a) {
  31319. if (!isFinite(a) || Math.floor(a) !== a || a < 0) throw new r(n ? i : "highWaterMark", a);
  31320. return Math.floor(a)
  31321. }
  31322. return e.objectMode ? 16 : 16384
  31323. }
  31324. }
  31325. }, function(e, t, i) {
  31326. "use strict";
  31327. (function(t, r) {
  31328. function n(e) {
  31329. var t = this;
  31330. this.next = null, this.entry = null, this.finish = function() {
  31331. ! function(e, t, i) {
  31332. var r = e.entry;
  31333. for (e.entry = null; r;) {
  31334. var n = r.callback;
  31335. t.pendingcb--, n(void 0), r = r.next
  31336. }
  31337. t.corkedRequestsFree.next = e
  31338. }(t, e)
  31339. }
  31340. }
  31341. var a;
  31342. e.exports = A, A.WritableState = S;
  31343. var s, o = {
  31344. deprecate: i(45)
  31345. },
  31346. u = i(74),
  31347. l = i(10).Buffer,
  31348. d = t.Uint8Array || function() {},
  31349. c = i(75),
  31350. h = i(76).getHighWaterMark,
  31351. f = i(25).codes,
  31352. p = f.ERR_INVALID_ARG_TYPE,
  31353. m = f.ERR_METHOD_NOT_IMPLEMENTED,
  31354. g = f.ERR_MULTIPLE_CALLBACK,
  31355. v = f.ERR_STREAM_CANNOT_PIPE,
  31356. y = f.ERR_STREAM_DESTROYED,
  31357. _ = f.ERR_STREAM_NULL_VALUES,
  31358. b = f.ERR_STREAM_WRITE_AFTER_END,
  31359. w = f.ERR_UNKNOWN_ENCODING,
  31360. E = c.errorOrDestroy;
  31361. function T() {}
  31362. function S(e, t, s) {
  31363. a = a || i(26), e = e || {}, "boolean" != typeof s && (s = t instanceof a), this.objectMode = !!e
  31364. .objectMode, s && (this.objectMode = this.objectMode || !!e.writableObjectMode), this
  31365. .highWaterMark = h(this, e, "writableHighWaterMark", s), this.finalCalled = !1, this.needDrain = !1,
  31366. this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
  31367. var o = !1 === e.decodeStrings;
  31368. this.decodeStrings = !o, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this
  31369. .writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(
  31370. e) {
  31371. ! function(e, t) {
  31372. var i = e._writableState,
  31373. n = i.sync,
  31374. a = i.writecb;
  31375. if ("function" != typeof a) throw new g;
  31376. if (function(e) {
  31377. e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0
  31378. }(i), t) ! function(e, t, i, n, a) {
  31379. --t.pendingcb, i ? (r.nextTick(a, n), r.nextTick(D, e, t), e._writableState.errorEmitted = !
  31380. 0, E(e, n)) : (a(n), e._writableState.errorEmitted = !0, E(e, n), D(e, t))
  31381. }(e, i, n, t, a);
  31382. else {
  31383. var s = O(i) || e.destroyed;
  31384. s || i.corked || i.bufferProcessing || !i.bufferedRequest || M(e, i), n ? r.nextTick(R, e, i,
  31385. s, a) : R(e, i, s, a)
  31386. }
  31387. }(t, e)
  31388. }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest =
  31389. null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !1 !== e
  31390. .emitClose, this.autoDestroy = !!e.autoDestroy, this.bufferedRequestCount = 0, this
  31391. .corkedRequestsFree = new n(this)
  31392. }
  31393. function A(e) {
  31394. var t = this instanceof(a = a || i(26));
  31395. if (!t && !s.call(A, this)) return new A(e);
  31396. this._writableState = new S(e, this, t), this.writable = !0, e && ("function" == typeof e.write && (
  31397. this._write = e.write), "function" == typeof e.writev && (this._writev = e.writev),
  31398. "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && (
  31399. this._final = e.final)), u.call(this)
  31400. }
  31401. function k(e, t, i, r, n, a, s) {
  31402. t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, t.destroyed ? t.onwrite(new y("write")) :
  31403. i ? e._writev(n, t.onwrite) : e._write(n, a, t.onwrite), t.sync = !1
  31404. }
  31405. function R(e, t, i, r) {
  31406. i || function(e, t) {
  31407. 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain"))
  31408. }(e, t), t.pendingcb--, r(), D(e, t)
  31409. }
  31410. function M(e, t) {
  31411. t.bufferProcessing = !0;
  31412. var i = t.bufferedRequest;
  31413. if (e._writev && i && i.next) {
  31414. var r = t.bufferedRequestCount,
  31415. a = new Array(r),
  31416. s = t.corkedRequestsFree;
  31417. s.entry = i;
  31418. for (var o = 0, u = !0; i;) a[o] = i, i.isBuf || (u = !1), i = i.next, o += 1;
  31419. a.allBuffers = u, k(e, t, !0, t.length, a, "", s.finish), t.pendingcb++, t.lastBufferedRequest =
  31420. null, s.next ? (t.corkedRequestsFree = s.next, s.next = null) : t.corkedRequestsFree = new n(t), t
  31421. .bufferedRequestCount = 0
  31422. } else {
  31423. for (; i;) {
  31424. var l = i.chunk,
  31425. d = i.encoding,
  31426. c = i.callback;
  31427. if (k(e, t, !1, t.objectMode ? 1 : l.length, l, d, c), i = i.next, t.bufferedRequestCount--, t
  31428. .writing) break
  31429. }
  31430. null === i && (t.lastBufferedRequest = null)
  31431. }
  31432. t.bufferedRequest = i, t.bufferProcessing = !1
  31433. }
  31434. function O(e) {
  31435. return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing
  31436. }
  31437. function C(e, t) {
  31438. e._final(function(i) {
  31439. t.pendingcb--, i && E(e, i), t.prefinished = !0, e.emit("prefinish"), D(e, t)
  31440. })
  31441. }
  31442. function D(e, t) {
  31443. var i = O(t);
  31444. if (i && (function(e, t) {
  31445. t.prefinished || t.finalCalled || ("function" != typeof e._final || t.destroyed ? (t
  31446. .prefinished = !0, e.emit("prefinish")) : (t.pendingcb++, t.finalCalled = !0, r.nextTick(
  31447. C, e, t)))
  31448. }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"), t.autoDestroy))) {
  31449. var n = e._readableState;
  31450. (!n || n.autoDestroy && n.endEmitted) && e.destroy()
  31451. }
  31452. return i
  31453. }
  31454. i(5)(A, u), S.prototype.getBuffer = function() {
  31455. for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next;
  31456. return t
  31457. },
  31458. function() {
  31459. try {
  31460. Object.defineProperty(S.prototype, "buffer", {
  31461. get: o.deprecate(function() {
  31462. return this.getBuffer()
  31463. }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.",
  31464. "DEP0003")
  31465. })
  31466. } catch (e) {}
  31467. }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[
  31468. Symbol.hasInstance] ? (s = Function.prototype[Symbol.hasInstance], Object.defineProperty(A, Symbol
  31469. .hasInstance, {
  31470. value: function(e) {
  31471. return !!s.call(this, e) || this === A && e && e._writableState instanceof S
  31472. }
  31473. })) : s = function(e) {
  31474. return e instanceof this
  31475. }, A.prototype.pipe = function() {
  31476. E(this, new v)
  31477. }, A.prototype.write = function(e, t, i) {
  31478. var n, a = this._writableState,
  31479. s = !1,
  31480. o = !a.objectMode && (n = e, l.isBuffer(n) || n instanceof d);
  31481. return o && !l.isBuffer(e) && (e = function(e) {
  31482. return l.from(e)
  31483. }(e)), "function" == typeof t && (i = t, t = null), o ? t = "buffer" : t || (t = a
  31484. .defaultEncoding), "function" != typeof i && (i = T), a.ending ? function(e, t) {
  31485. var i = new b;
  31486. E(e, i), r.nextTick(t, i)
  31487. }(this, i) : (o || function(e, t, i, n) {
  31488. var a;
  31489. return null === i ? a = new _ : "string" == typeof i || t.objectMode || (a = new p("chunk", [
  31490. "string", "Buffer"
  31491. ], i)), !a || (E(e, a), r.nextTick(n, a), !1)
  31492. }(this, a, e, i)) && (a.pendingcb++, s = function(e, t, i, r, n, a) {
  31493. if (!i) {
  31494. var s = function(e, t, i) {
  31495. return e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = l.from(t,
  31496. i)), t
  31497. }(t, r, n);
  31498. r !== s && (i = !0, n = "buffer", r = s)
  31499. }
  31500. var o = t.objectMode ? 1 : r.length;
  31501. t.length += o;
  31502. var u = t.length < t.highWaterMark;
  31503. if (u || (t.needDrain = !0), t.writing || t.corked) {
  31504. var d = t.lastBufferedRequest;
  31505. t.lastBufferedRequest = {
  31506. chunk: r,
  31507. encoding: n,
  31508. isBuf: i,
  31509. callback: a,
  31510. next: null
  31511. }, d ? d.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t
  31512. .bufferedRequestCount += 1
  31513. } else k(e, t, !1, o, r, n, a);
  31514. return u
  31515. }(this, a, o, e, t, i)), s
  31516. }, A.prototype.cork = function() {
  31517. this._writableState.corked++
  31518. }, A.prototype.uncork = function() {
  31519. var e = this._writableState;
  31520. e.corked && (e.corked--, e.writing || e.corked || e.bufferProcessing || !e.bufferedRequest || M(
  31521. this, e))
  31522. }, A.prototype.setDefaultEncoding = function(e) {
  31523. if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary",
  31524. "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"
  31525. ].indexOf((e + "").toLowerCase()) > -1)) throw new w(e);
  31526. return this._writableState.defaultEncoding = e, this
  31527. }, Object.defineProperty(A.prototype, "writableBuffer", {
  31528. enumerable: !1,
  31529. get: function() {
  31530. return this._writableState && this._writableState.getBuffer()
  31531. }
  31532. }), Object.defineProperty(A.prototype, "writableHighWaterMark", {
  31533. enumerable: !1,
  31534. get: function() {
  31535. return this._writableState.highWaterMark
  31536. }
  31537. }), A.prototype._write = function(e, t, i) {
  31538. i(new m("_write()"))
  31539. }, A.prototype._writev = null, A.prototype.end = function(e, t, i) {
  31540. var n = this._writableState;
  31541. return "function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t =
  31542. null), null != e && this.write(e, t), n.corked && (n.corked = 1, this.uncork()), n.ending ||
  31543. function(e, t, i) {
  31544. t.ending = !0, D(e, t), i && (t.finished ? r.nextTick(i) : e.once("finish", i)), t.ended = !0, e
  31545. .writable = !1
  31546. }(this, n, i), this
  31547. }, Object.defineProperty(A.prototype, "writableLength", {
  31548. enumerable: !1,
  31549. get: function() {
  31550. return this._writableState.length
  31551. }
  31552. }), Object.defineProperty(A.prototype, "destroyed", {
  31553. enumerable: !1,
  31554. get: function() {
  31555. return void 0 !== this._writableState && this._writableState.destroyed
  31556. },
  31557. set: function(e) {
  31558. this._writableState && (this._writableState.destroyed = e)
  31559. }
  31560. }), A.prototype.destroy = c.destroy, A.prototype._undestroy = c.undestroy, A.prototype._destroy =
  31561. function(e, t) {
  31562. t(e)
  31563. }
  31564. }).call(this, i(13), i(9))
  31565. }, function(e, t, i) {
  31566. "use strict";
  31567. e.exports = l;
  31568. var r = i(25).codes,
  31569. n = r.ERR_METHOD_NOT_IMPLEMENTED,
  31570. a = r.ERR_MULTIPLE_CALLBACK,
  31571. s = r.ERR_TRANSFORM_ALREADY_TRANSFORMING,
  31572. o = r.ERR_TRANSFORM_WITH_LENGTH_0,
  31573. u = i(26);
  31574. function l(e) {
  31575. if (!(this instanceof l)) return new l(e);
  31576. u.call(this, e), this._transformState = {
  31577. afterTransform: function(e, t) {
  31578. var i = this._transformState;
  31579. i.transforming = !1;
  31580. var r = i.writecb;
  31581. if (null === r) return this.emit("error", new a);
  31582. i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e);
  31583. var n = this._readableState;
  31584. n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
  31585. }.bind(this),
  31586. needTransform: !1,
  31587. transforming: !1,
  31588. writecb: null,
  31589. writechunk: null,
  31590. writeencoding: null
  31591. }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e
  31592. .transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush)
  31593. ), this.on("prefinish", d)
  31594. }
  31595. function d() {
  31596. var e = this;
  31597. "function" != typeof this._flush || this._readableState.destroyed ? c(this, null, null) : this._flush(
  31598. function(t, i) {
  31599. c(e, t, i)
  31600. })
  31601. }
  31602. function c(e, t, i) {
  31603. if (t) return e.emit("error", t);
  31604. if (null != i && e.push(i), e._writableState.length) throw new o;
  31605. if (e._transformState.transforming) throw new s;
  31606. return e.push(null)
  31607. }
  31608. i(5)(l, u), l.prototype.push = function(e, t) {
  31609. return this._transformState.needTransform = !1, u.prototype.push.call(this, e, t)
  31610. }, l.prototype._transform = function(e, t, i) {
  31611. i(new n("_transform()"))
  31612. }, l.prototype._write = function(e, t, i) {
  31613. var r = this._transformState;
  31614. if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) {
  31615. var n = this._readableState;
  31616. (r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
  31617. }
  31618. }, l.prototype._read = function(e) {
  31619. var t = this._transformState;
  31620. null === t.writechunk || t.transforming ? t.needTransform = !0 : (t.transforming = !0, this._transform(t
  31621. .writechunk, t.writeencoding, t.afterTransform))
  31622. }, l.prototype._destroy = function(e, t) {
  31623. u.prototype._destroy.call(this, e, function(e) {
  31624. t(e)
  31625. })
  31626. }
  31627. }, function(e, t, i) {
  31628. var r = i(5),
  31629. n = i(27),
  31630. a = i(6).Buffer,
  31631. s = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221,
  31632. 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580,
  31633. 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882,
  31634. 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912,
  31635. 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411,
  31636. 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556,
  31637. 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452,
  31638. 2361852424, 2428436474, 2756734187, 3204031479, 3329325298
  31639. ],
  31640. o = new Array(64);
  31641. function u() {
  31642. this.init(), this._w = o, n.call(this, 64, 56)
  31643. }
  31644. function l(e, t, i) {
  31645. return i ^ e & (t ^ i)
  31646. }
  31647. function d(e, t, i) {
  31648. return e & t | i & (e | t)
  31649. }
  31650. function c(e) {
  31651. return (e >>> 2 | e << 30) ^ (e >>> 13 | e << 19) ^ (e >>> 22 | e << 10)
  31652. }
  31653. function h(e) {
  31654. return (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7)
  31655. }
  31656. function f(e) {
  31657. return (e >>> 7 | e << 25) ^ (e >>> 18 | e << 14) ^ e >>> 3
  31658. }
  31659. r(u, n), u.prototype.init = function() {
  31660. return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, this._e =
  31661. 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, this
  31662. }, u.prototype._update = function(e) {
  31663. for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, a = 0 | this._c, o = 0 | this._d, u = 0 |
  31664. this._e, p = 0 | this._f, m = 0 | this._g, g = 0 | this._h, v = 0; v < 16; ++v) i[v] = e
  31665. .readInt32BE(4 * v);
  31666. for (; v < 64; ++v) i[v] = 0 | (((t = i[v - 2]) >>> 17 | t << 15) ^ (t >>> 19 | t << 13) ^ t >>> 10) +
  31667. i[v - 7] + f(i[v - 15]) + i[v - 16];
  31668. for (var y = 0; y < 64; ++y) {
  31669. var _ = g + h(u) + l(u, p, m) + s[y] + i[y] | 0,
  31670. b = c(r) + d(r, n, a) | 0;
  31671. g = m, m = p, p = u, u = o + _ | 0, o = a, a = n, n = r, r = _ + b | 0
  31672. }
  31673. this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = a + this._c | 0, this._d = o + this._d |
  31674. 0, this._e = u + this._e | 0, this._f = p + this._f | 0, this._g = m + this._g | 0, this._h = g + this
  31675. ._h | 0
  31676. }, u.prototype._hash = function() {
  31677. var e = a.allocUnsafe(32);
  31678. return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e
  31679. .writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(
  31680. this._g, 24), e.writeInt32BE(this._h, 28), e
  31681. }, e.exports = u
  31682. }, function(e, t, i) {
  31683. var r = i(5),
  31684. n = i(27),
  31685. a = i(6).Buffer,
  31686. s = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548,
  31687. 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560,
  31688. 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994,
  31689. 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868,
  31690. 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983,
  31691. 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882,
  31692. 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891,
  31693. 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964,
  31694. 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390,
  31695. 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460,
  31696. 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344,
  31697. 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616,
  31698. 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403,
  31699. 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928,
  31700. 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249,
  31701. 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711,
  31702. 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356,
  31703. 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100,
  31704. 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468,
  31705. 1816402316, 1246189591
  31706. ],
  31707. o = new Array(160);
  31708. function u() {
  31709. this.init(), this._w = o, n.call(this, 128, 112)
  31710. }
  31711. function l(e, t, i) {
  31712. return i ^ e & (t ^ i)
  31713. }
  31714. function d(e, t, i) {
  31715. return e & t | i & (e | t)
  31716. }
  31717. function c(e, t) {
  31718. return (e >>> 28 | t << 4) ^ (t >>> 2 | e << 30) ^ (t >>> 7 | e << 25)
  31719. }
  31720. function h(e, t) {
  31721. return (e >>> 14 | t << 18) ^ (e >>> 18 | t << 14) ^ (t >>> 9 | e << 23)
  31722. }
  31723. function f(e, t) {
  31724. return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ e >>> 7
  31725. }
  31726. function p(e, t) {
  31727. return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ (e >>> 7 | t << 25)
  31728. }
  31729. function m(e, t) {
  31730. return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ e >>> 6
  31731. }
  31732. function g(e, t) {
  31733. return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ (e >>> 6 | t << 26)
  31734. }
  31735. function v(e, t) {
  31736. return e >>> 0 < t >>> 0 ? 1 : 0
  31737. }
  31738. r(u, n), u.prototype.init = function() {
  31739. return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, this
  31740. ._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, this._al =
  31741. 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, this._el =
  31742. 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, this
  31743. }, u.prototype._update = function(e) {
  31744. for (var t = this._w, i = 0 | this._ah, r = 0 | this._bh, n = 0 | this._ch, a = 0 | this._dh, o = 0 |
  31745. this._eh, u = 0 | this._fh, y = 0 | this._gh, _ = 0 | this._hh, b = 0 | this._al, w = 0 | this._bl,
  31746. E = 0 | this._cl, T = 0 | this._dl, S = 0 | this._el, A = 0 | this._fl, k = 0 | this._gl, R = 0 |
  31747. this._hl, M = 0; M < 32; M += 2) t[M] = e.readInt32BE(4 * M), t[M + 1] = e.readInt32BE(4 * M + 4);
  31748. for (; M < 160; M += 2) {
  31749. var O = t[M - 30],
  31750. C = t[M - 30 + 1],
  31751. D = f(O, C),
  31752. I = p(C, O),
  31753. L = m(O = t[M - 4], C = t[M - 4 + 1]),
  31754. x = g(C, O),
  31755. P = t[M - 14],
  31756. U = t[M - 14 + 1],
  31757. N = t[M - 32],
  31758. B = t[M - 32 + 1],
  31759. F = I + U | 0,
  31760. j = D + P + v(F, I) | 0;
  31761. j = (j = j + L + v(F = F + x | 0, x) | 0) + N + v(F = F + B | 0, B) | 0, t[M] = j, t[M + 1] = F
  31762. }
  31763. for (var H = 0; H < 160; H += 2) {
  31764. j = t[H], F = t[H + 1];
  31765. var G = d(i, r, n),
  31766. V = d(b, w, E),
  31767. W = c(i, b),
  31768. q = c(b, i),
  31769. X = h(o, S),
  31770. z = h(S, o),
  31771. K = s[H],
  31772. Y = s[H + 1],
  31773. Q = l(o, u, y),
  31774. J = l(S, A, k),
  31775. Z = R + z | 0,
  31776. $ = _ + X + v(Z, R) | 0;
  31777. $ = ($ = ($ = $ + Q + v(Z = Z + J | 0, J) | 0) + K + v(Z = Z + Y | 0, Y) | 0) + j + v(Z = Z + F | 0,
  31778. F) | 0;
  31779. var ee = q + V | 0,
  31780. te = W + G + v(ee, q) | 0;
  31781. _ = y, R = k, y = u, k = A, u = o, A = S, o = a + $ + v(S = T + Z | 0, T) | 0, a = n, T = E, n = r,
  31782. E = w, r = i, w = b, i = $ + te + v(b = Z + ee | 0, Z) | 0
  31783. }
  31784. this._al = this._al + b | 0, this._bl = this._bl + w | 0, this._cl = this._cl + E | 0, this._dl = this
  31785. ._dl + T | 0, this._el = this._el + S | 0, this._fl = this._fl + A | 0, this._gl = this._gl + k | 0,
  31786. this._hl = this._hl + R | 0, this._ah = this._ah + i + v(this._al, b) | 0, this._bh = this._bh + r +
  31787. v(this._bl, w) | 0, this._ch = this._ch + n + v(this._cl, E) | 0, this._dh = this._dh + a + v(this
  31788. ._dl, T) | 0, this._eh = this._eh + o + v(this._el, S) | 0, this._fh = this._fh + u + v(this._fl,
  31789. A) | 0, this._gh = this._gh + y + v(this._gl, k) | 0, this._hh = this._hh + _ + v(this._hl, R) | 0
  31790. }, u.prototype._hash = function() {
  31791. var e = a.allocUnsafe(64);
  31792. function t(t, i, r) {
  31793. e.writeInt32BE(t, r), e.writeInt32BE(i, r + 4)
  31794. }
  31795. return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this
  31796. ._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), t(this._gh, this._gl, 48), t(this
  31797. ._hh, this._hl, 56), e
  31798. }, e.exports = u
  31799. }, function(e, t, i) {
  31800. "use strict";
  31801. (function(t, r) {
  31802. var n = i(38);
  31803. e.exports = _;
  31804. var a, s = i(66);
  31805. _.ReadableState = y, i(8).EventEmitter;
  31806. var o = function(e, t) {
  31807. return e.listeners(t).length
  31808. },
  31809. u = i(82),
  31810. l = i(50).Buffer,
  31811. d = t.Uint8Array || function() {},
  31812. c = Object.create(i(32));
  31813. c.inherits = i(5);
  31814. var h = i(149),
  31815. f = void 0;
  31816. f = h && h.debuglog ? h.debuglog("stream") : function() {};
  31817. var p, m = i(150),
  31818. g = i(83);
  31819. c.inherits(_, u);
  31820. var v = ["error", "close", "destroy", "pause", "resume"];
  31821. function y(e, t) {
  31822. e = e || {};
  31823. var r = t instanceof(a = a || i(23));
  31824. this.objectMode = !!e.objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode);
  31825. var n = e.highWaterMark,
  31826. s = e.readableHighWaterMark,
  31827. o = this.objectMode ? 16 : 16384;
  31828. this.highWaterMark = n || 0 === n ? n : r && (s || 0 === s) ? s : o, this.highWaterMark = Math.floor(
  31829. this.highWaterMark), this.buffer = new m, this.length = 0, this.pipes = null, this.pipesCount = 0,
  31830. this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this
  31831. .needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !
  31832. 1, this.destroyed = !1, this.defaultEncoding = e.defaultEncoding || "utf8", this.awaitDrain = 0,
  31833. this.readingMore = !1, this.decoder = null, this.encoding = null, e.encoding && (p || (p = i(22)
  31834. .StringDecoder), this.decoder = new p(e.encoding), this.encoding = e.encoding)
  31835. }
  31836. function _(e) {
  31837. if (a = a || i(23), !(this instanceof _)) return new _(e);
  31838. this._readableState = new y(e, this), this.readable = !0, e && ("function" == typeof e.read && (this
  31839. ._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), u.call(this)
  31840. }
  31841. function b(e, t, i, r, n) {
  31842. var a, s = e._readableState;
  31843. return null === t ? (s.reading = !1, function(e, t) {
  31844. if (!t.ended) {
  31845. if (t.decoder) {
  31846. var i = t.decoder.end();
  31847. i && i.length && (t.buffer.push(i), t.length += t.objectMode ? 1 : i.length)
  31848. }
  31849. t.ended = !0, T(e)
  31850. }
  31851. }(e, s)) : (n || (a = function(e, t) {
  31852. var i, r;
  31853. return r = t, l.isBuffer(r) || r instanceof d || "string" == typeof t || void 0 === t || e
  31854. .objectMode || (i = new TypeError("Invalid non-string/buffer chunk")), i
  31855. }(s, t)), a ? e.emit("error", a) : s.objectMode || t && t.length > 0 ? ("string" == typeof t || s
  31856. .objectMode || Object.getPrototypeOf(t) === l.prototype || (t = function(e) {
  31857. return l.from(e)
  31858. }(t)), r ? s.endEmitted ? e.emit("error", new Error("stream.unshift() after end event")) : w(e,
  31859. s, t, !0) : s.ended ? e.emit("error", new Error("stream.push() after EOF")) : (s.reading = !1,
  31860. s.decoder && !i ? (t = s.decoder.write(t), s.objectMode || 0 !== t.length ? w(e, s, t, !1) :
  31861. A(e, s)) : w(e, s, t, !1))) : r || (s.reading = !1)),
  31862. function(e) {
  31863. return !e.ended && (e.needReadable || e.length < e.highWaterMark || 0 === e.length)
  31864. }(s)
  31865. }
  31866. function w(e, t, i, r) {
  31867. t.flowing && 0 === t.length && !t.sync ? (e.emit("data", i), e.read(0)) : (t.length += t.objectMode ?
  31868. 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && T(e)), A(e, t)
  31869. }
  31870. function E(e, t) {
  31871. return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t
  31872. .buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) {
  31873. return e >= 8388608 ? e = 8388608 : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>>
  31874. 8, e |= e >>> 16, e++), e
  31875. }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0))
  31876. }
  31877. function T(e) {
  31878. var t = e._readableState;
  31879. t.needReadable = !1, t.emittedReadable || (f("emitReadable", t.flowing), t.emittedReadable = !0, t
  31880. .sync ? n.nextTick(S, e) : S(e))
  31881. }
  31882. function S(e) {
  31883. f("emit readable"), e.emit("readable"), O(e)
  31884. }
  31885. function A(e, t) {
  31886. t.readingMore || (t.readingMore = !0, n.nextTick(k, e, t))
  31887. }
  31888. function k(e, t) {
  31889. for (var i = t.length; !t.reading && !t.flowing && !t.ended && t.length < t.highWaterMark && (f(
  31890. "maybeReadMore read 0"), e.read(0), i !== t.length);) i = t.length;
  31891. t.readingMore = !1
  31892. }
  31893. function R(e) {
  31894. f("readable nexttick read 0"), e.read(0)
  31895. }
  31896. function M(e, t) {
  31897. t.reading || (f("resume read 0"), e.read(0)), t.resumeScheduled = !1, t.awaitDrain = 0, e.emit(
  31898. "resume"), O(e), t.flowing && !t.reading && e.read(0)
  31899. }
  31900. function O(e) {
  31901. var t = e._readableState;
  31902. for (f("flow", t.flowing); t.flowing && null !== e.read(););
  31903. }
  31904. function C(e, t) {
  31905. return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t
  31906. .decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.head.data : t.buffer.concat(t
  31907. .length), t.buffer.clear()) : i = function(e, t, i) {
  31908. var r;
  31909. return e < t.head.data.length ? (r = t.head.data.slice(0, e), t.head.data = t.head.data.slice(
  31910. e)) : r = e === t.head.data.length ? t.shift() : i ? function(e, t) {
  31911. var i = t.head,
  31912. r = 1,
  31913. n = i.data;
  31914. for (e -= n.length; i = i.next;) {
  31915. var a = i.data,
  31916. s = e > a.length ? a.length : e;
  31917. if (s === a.length ? n += a : n += a.slice(0, e), 0 == (e -= s)) {
  31918. s === a.length ? (++r, i.next ? t.head = i.next : t.head = t.tail = null) : (t.head = i,
  31919. i.data = a.slice(s));
  31920. break
  31921. }++r
  31922. }
  31923. return t.length -= r, n
  31924. }(e, t) : function(e, t) {
  31925. var i = l.allocUnsafe(e),
  31926. r = t.head,
  31927. n = 1;
  31928. for (r.data.copy(i), e -= r.data.length; r = r.next;) {
  31929. var a = r.data,
  31930. s = e > a.length ? a.length : e;
  31931. if (a.copy(i, i.length - e, 0, s), 0 == (e -= s)) {
  31932. s === a.length ? (++n, r.next ? t.head = r.next : t.head = t.tail = null) : (t.head = r,
  31933. r.data = a.slice(s));
  31934. break
  31935. }++n
  31936. }
  31937. return t.length -= n, i
  31938. }(e, t), r
  31939. }(e, t.buffer, t.decoder), i);
  31940. var i
  31941. }
  31942. function D(e) {
  31943. var t = e._readableState;
  31944. if (t.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  31945. t.endEmitted || (t.ended = !0, n.nextTick(I, t, e))
  31946. }
  31947. function I(e, t) {
  31948. e.endEmitted || 0 !== e.length || (e.endEmitted = !0, t.readable = !1, t.emit("end"))
  31949. }
  31950. function L(e, t) {
  31951. for (var i = 0, r = e.length; i < r; i++)
  31952. if (e[i] === t) return i;
  31953. return -1
  31954. }
  31955. Object.defineProperty(_.prototype, "destroyed", {
  31956. get: function() {
  31957. return void 0 !== this._readableState && this._readableState.destroyed
  31958. },
  31959. set: function(e) {
  31960. this._readableState && (this._readableState.destroyed = e)
  31961. }
  31962. }), _.prototype.destroy = g.destroy, _.prototype._undestroy = g.undestroy, _.prototype._destroy =
  31963. function(e, t) {
  31964. this.push(null), t(e)
  31965. }, _.prototype.push = function(e, t) {
  31966. var i, r = this._readableState;
  31967. return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r
  31968. .encoding && (e = l.from(e, t), t = ""), i = !0), b(this, e, t, !1, i)
  31969. }, _.prototype.unshift = function(e) {
  31970. return b(this, e, null, !0, !1)
  31971. }, _.prototype.isPaused = function() {
  31972. return !1 === this._readableState.flowing
  31973. }, _.prototype.setEncoding = function(e) {
  31974. return p || (p = i(22).StringDecoder), this._readableState.decoder = new p(e), this._readableState
  31975. .encoding = e, this
  31976. }, _.prototype.read = function(e) {
  31977. f("read", e), e = parseInt(e, 10);
  31978. var t = this._readableState,
  31979. i = e;
  31980. if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && (t.length >= t
  31981. .highWaterMark || t.ended)) return f("read: emitReadable", t.length, t.ended), 0 === t.length &&
  31982. t.ended ? D(this) : T(this), null;
  31983. if (0 === (e = E(e, t)) && t.ended) return 0 === t.length && D(this), null;
  31984. var r, n = t.needReadable;
  31985. return f("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && f(
  31986. "length less than watermark", n = !0), t.ended || t.reading ? f("reading or ended", n = !1) :
  31987. n && (f("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this
  31988. ._read(t.highWaterMark), t.sync = !1, t.reading || (e = E(i, t))), null === (r = e > 0 ? C(e,
  31989. t) : null) ? (t.needReadable = !0, e = 0) : t.length -= e, 0 === t.length && (t.ended || (t
  31990. .needReadable = !0), i !== e && t.ended && D(this)), null !== r && this.emit("data", r), r
  31991. }, _.prototype._read = function(e) {
  31992. this.emit("error", new Error("_read() is not implemented"))
  31993. }, _.prototype.pipe = function(e, t) {
  31994. var i = this,
  31995. a = this._readableState;
  31996. switch (a.pipesCount) {
  31997. case 0:
  31998. a.pipes = e;
  31999. break;
  32000. case 1:
  32001. a.pipes = [a.pipes, e];
  32002. break;
  32003. default:
  32004. a.pipes.push(e)
  32005. }
  32006. a.pipesCount += 1, f("pipe count=%d opts=%j", a.pipesCount, t);
  32007. var u = t && !1 === t.end || e === r.stdout || e === r.stderr ? y : l;
  32008. function l() {
  32009. f("onend"), e.end()
  32010. }
  32011. a.endEmitted ? n.nextTick(u) : i.once("end", u), e.on("unpipe", function t(r, n) {
  32012. f("onunpipe"), r === i && n && !1 === n.hasUnpiped && (n.hasUnpiped = !0, f("cleanup"), e
  32013. .removeListener("close", g), e.removeListener("finish", v), e.removeListener("drain", d),
  32014. e.removeListener("error", m), e.removeListener("unpipe", t), i.removeListener("end", l), i
  32015. .removeListener("end", y), i.removeListener("data", p), c = !0, !a.awaitDrain || e
  32016. ._writableState && !e._writableState.needDrain || d())
  32017. });
  32018. var d = function(e) {
  32019. return function() {
  32020. var t = e._readableState;
  32021. f("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && o(e,
  32022. "data") && (t.flowing = !0, O(e))
  32023. }
  32024. }(i);
  32025. e.on("drain", d);
  32026. var c = !1,
  32027. h = !1;
  32028. function p(t) {
  32029. f("ondata"), h = !1, !1 !== e.write(t) || h || ((1 === a.pipesCount && a.pipes === e || a
  32030. .pipesCount > 1 && -1 !== L(a.pipes, e)) && !c && (f("false write response, pause", i
  32031. ._readableState.awaitDrain), i._readableState.awaitDrain++, h = !0), i.pause())
  32032. }
  32033. function m(t) {
  32034. f("onerror", t), y(), e.removeListener("error", m), 0 === o(e, "error") && e.emit("error", t)
  32035. }
  32036. function g() {
  32037. e.removeListener("finish", v), y()
  32038. }
  32039. function v() {
  32040. f("onfinish"), e.removeListener("close", g), y()
  32041. }
  32042. function y() {
  32043. f("unpipe"), i.unpipe(e)
  32044. }
  32045. return i.on("data", p),
  32046. function(e, t, i) {
  32047. if ("function" == typeof e.prependListener) return e.prependListener(t, i);
  32048. e._events && e._events[t] ? s(e._events[t]) ? e._events[t].unshift(i) : e._events[t] = [i, e
  32049. ._events[t]
  32050. ] : e.on(t, i)
  32051. }(e, "error", m), e.once("close", g), e.once("finish", v), e.emit("pipe", i), a.flowing || (f(
  32052. "pipe resume"), i.resume()), e
  32053. }, _.prototype.unpipe = function(e) {
  32054. var t = this._readableState,
  32055. i = {
  32056. hasUnpiped: !1
  32057. };
  32058. if (0 === t.pipesCount) return this;
  32059. if (1 === t.pipesCount) return e && e !== t.pipes || (e || (e = t.pipes), t.pipes = null, t
  32060. .pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, i)), this;
  32061. if (!e) {
  32062. var r = t.pipes,
  32063. n = t.pipesCount;
  32064. t.pipes = null, t.pipesCount = 0, t.flowing = !1;
  32065. for (var a = 0; a < n; a++) r[a].emit("unpipe", this, i);
  32066. return this
  32067. }
  32068. var s = L(t.pipes, e);
  32069. return -1 === s || (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t
  32070. .pipes[0]), e.emit("unpipe", this, i)), this
  32071. }, _.prototype.on = function(e, t) {
  32072. var i = u.prototype.on.call(this, e, t);
  32073. if ("data" === e) !1 !== this._readableState.flowing && this.resume();
  32074. else if ("readable" === e) {
  32075. var r = this._readableState;
  32076. r.endEmitted || r.readableListening || (r.readableListening = r.needReadable = !0, r
  32077. .emittedReadable = !1, r.reading ? r.length && T(this) : n.nextTick(R, this))
  32078. }
  32079. return i
  32080. }, _.prototype.addListener = _.prototype.on, _.prototype.resume = function() {
  32081. var e = this._readableState;
  32082. return e.flowing || (f("resume"), e.flowing = !0, function(e, t) {
  32083. t.resumeScheduled || (t.resumeScheduled = !0, n.nextTick(M, e, t))
  32084. }(this, e)), this
  32085. }, _.prototype.pause = function() {
  32086. return f("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState
  32087. .flowing && (f("pause"), this._readableState.flowing = !1, this.emit("pause")), this
  32088. }, _.prototype.wrap = function(e) {
  32089. var t = this,
  32090. i = this._readableState,
  32091. r = !1;
  32092. for (var n in e.on("end", function() {
  32093. if (f("wrapped end"), i.decoder && !i.ended) {
  32094. var e = i.decoder.end();
  32095. e && e.length && t.push(e)
  32096. }
  32097. t.push(null)
  32098. }), e.on("data", function(n) {
  32099. f("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n || (i
  32100. .objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause()))
  32101. }), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function(t) {
  32102. return function() {
  32103. return e[t].apply(e, arguments)
  32104. }
  32105. }(n));
  32106. for (var a = 0; a < v.length; a++) e.on(v[a], this.emit.bind(this, v[a]));
  32107. return this._read = function(t) {
  32108. f("wrapped _read", t), r && (r = !1, e.resume())
  32109. }, this
  32110. }, Object.defineProperty(_.prototype, "readableHighWaterMark", {
  32111. enumerable: !1,
  32112. get: function() {
  32113. return this._readableState.highWaterMark
  32114. }
  32115. }), _._fromList = C
  32116. }).call(this, i(13), i(9))
  32117. }, function(e, t, i) {
  32118. e.exports = i(8).EventEmitter
  32119. }, function(e, t, i) {
  32120. "use strict";
  32121. var r = i(38);
  32122. function n(e, t) {
  32123. e.emit("error", t)
  32124. }
  32125. e.exports = {
  32126. destroy: function(e, t) {
  32127. var i = this,
  32128. a = this._readableState && this._readableState.destroyed,
  32129. s = this._writableState && this._writableState.destroyed;
  32130. return a || s ? (t ? t(e) : !e || this._writableState && this._writableState.errorEmitted || r
  32131. .nextTick(n, this, e), this) : (this._readableState && (this._readableState.destroyed = !0),
  32132. this._writableState && (this._writableState.destroyed = !0), this._destroy(e || null, function(
  32133. e) {
  32134. !t && e ? (r.nextTick(n, i, e), i._writableState && (i._writableState.errorEmitted = !0)) :
  32135. t && t(e)
  32136. }), this)
  32137. },
  32138. undestroy: function() {
  32139. this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this
  32140. ._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this
  32141. ._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1,
  32142. this._writableState.finished = !1, this._writableState.errorEmitted = !1)
  32143. }
  32144. }
  32145. }, function(e, t, i) {
  32146. "use strict";
  32147. e.exports = a;
  32148. var r = i(23),
  32149. n = Object.create(i(32));
  32150. function a(e) {
  32151. if (!(this instanceof a)) return new a(e);
  32152. r.call(this, e), this._transformState = {
  32153. afterTransform: function(e, t) {
  32154. var i = this._transformState;
  32155. i.transforming = !1;
  32156. var r = i.writecb;
  32157. if (!r) return this.emit("error", new Error("write callback called multiple times"));
  32158. i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e);
  32159. var n = this._readableState;
  32160. n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
  32161. }.bind(this),
  32162. needTransform: !1,
  32163. transforming: !1,
  32164. writecb: null,
  32165. writechunk: null,
  32166. writeencoding: null
  32167. }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e
  32168. .transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush)
  32169. ), this.on("prefinish", s)
  32170. }
  32171. function s() {
  32172. var e = this;
  32173. "function" == typeof this._flush ? this._flush(function(t, i) {
  32174. o(e, t, i)
  32175. }) : o(this, null, null)
  32176. }
  32177. function o(e, t, i) {
  32178. if (t) return e.emit("error", t);
  32179. if (null != i && e.push(i), e._writableState.length) throw new Error(
  32180. "Calling transform done when ws.length != 0");
  32181. if (e._transformState.transforming) throw new Error("Calling transform done when still transforming");
  32182. return e.push(null)
  32183. }
  32184. n.inherits = i(5), n.inherits(a, r), a.prototype.push = function(e, t) {
  32185. return this._transformState.needTransform = !1, r.prototype.push.call(this, e, t)
  32186. }, a.prototype._transform = function(e, t, i) {
  32187. throw new Error("_transform() is not implemented")
  32188. }, a.prototype._write = function(e, t, i) {
  32189. var r = this._transformState;
  32190. if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) {
  32191. var n = this._readableState;
  32192. (r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
  32193. }
  32194. }, a.prototype._read = function(e) {
  32195. var t = this._transformState;
  32196. null !== t.writechunk && t.writecb && !t.transforming ? (t.transforming = !0, this._transform(t
  32197. .writechunk, t.writeencoding, t.afterTransform)) : t.needTransform = !0
  32198. }, a.prototype._destroy = function(e, t) {
  32199. var i = this;
  32200. r.prototype._destroy.call(this, e, function(e) {
  32201. t(e), i.emit("close")
  32202. })
  32203. }
  32204. }, function(e, t, i) {
  32205. "use strict";
  32206. var r = i(5),
  32207. n = i(159),
  32208. a = i(20),
  32209. s = i(6).Buffer,
  32210. o = i(86),
  32211. u = i(47),
  32212. l = i(48),
  32213. d = s.alloc(128);
  32214. function c(e, t) {
  32215. a.call(this, "digest"), "string" == typeof t && (t = s.from(t));
  32216. var i = "sha512" === e || "sha384" === e ? 128 : 64;
  32217. this._alg = e, this._key = t, t.length > i ? t = ("rmd160" === e ? new u : l(e)).update(t).digest() : t
  32218. .length < i && (t = s.concat([t, d], i));
  32219. for (var r = this._ipad = s.allocUnsafe(i), n = this._opad = s.allocUnsafe(i), o = 0; o < i; o++) r[o] =
  32220. 54 ^ t[o], n[o] = 92 ^ t[o];
  32221. this._hash = "rmd160" === e ? new u : l(e), this._hash.update(r)
  32222. }
  32223. r(c, a), c.prototype._update = function(e) {
  32224. this._hash.update(e)
  32225. }, c.prototype._final = function() {
  32226. var e = this._hash.digest();
  32227. return ("rmd160" === this._alg ? new u : l(this._alg)).update(this._opad).update(e).digest()
  32228. }, e.exports = function(e, t) {
  32229. return "rmd160" === (e = e.toLowerCase()) || "ripemd160" === e ? new c("rmd160", t) : "md5" === e ?
  32230. new n(o, t) : new c(e, t)
  32231. }
  32232. }, function(e, t, i) {
  32233. var r = i(44);
  32234. e.exports = function(e) {
  32235. return (new r).update(e).digest()
  32236. }
  32237. }, function(e) {
  32238. e.exports = JSON.parse(
  32239. '{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}'
  32240. )
  32241. }, function(e, t, i) {
  32242. t.pbkdf2 = i(161), t.pbkdf2Sync = i(91)
  32243. }, function(e, t) {
  32244. var i = Math.pow(2, 30) - 1;
  32245. e.exports = function(e, t) {
  32246. if ("number" != typeof e) throw new TypeError("Iterations not a number");
  32247. if (e < 0) throw new TypeError("Bad iterations");
  32248. if ("number" != typeof t) throw new TypeError("Key length not a number");
  32249. if (t < 0 || t > i || t != t) throw new TypeError("Bad key length")
  32250. }
  32251. }, function(e, t, i) {
  32252. (function(t, i) {
  32253. var r;
  32254. r = t.process && t.process.browser ? "utf-8" : t.process && t.process.version ? parseInt(i.version
  32255. .split(".")[0].slice(1), 10) >= 6 ? "utf-8" : "binary" : "utf-8", e.exports = r
  32256. }).call(this, i(13), i(9))
  32257. }, function(e, t, i) {
  32258. var r = i(86),
  32259. n = i(47),
  32260. a = i(48),
  32261. s = i(6).Buffer,
  32262. o = i(89),
  32263. u = i(90),
  32264. l = i(92),
  32265. d = s.alloc(128),
  32266. c = {
  32267. md5: 16,
  32268. sha1: 20,
  32269. sha224: 28,
  32270. sha256: 32,
  32271. sha384: 48,
  32272. sha512: 64,
  32273. rmd160: 20,
  32274. ripemd160: 20
  32275. };
  32276. function h(e, t, i) {
  32277. var o = function(e) {
  32278. return "rmd160" === e || "ripemd160" === e ? function(e) {
  32279. return (new n).update(e).digest()
  32280. } : "md5" === e ? r : function(t) {
  32281. return a(e).update(t).digest()
  32282. }
  32283. }(e),
  32284. u = "sha512" === e || "sha384" === e ? 128 : 64;
  32285. t.length > u ? t = o(t) : t.length < u && (t = s.concat([t, d], u));
  32286. for (var l = s.allocUnsafe(u + c[e]), h = s.allocUnsafe(u + c[e]), f = 0; f < u; f++) l[f] = 54 ^ t[f], h[
  32287. f] = 92 ^ t[f];
  32288. var p = s.allocUnsafe(u + i + 4);
  32289. l.copy(p, 0, 0, u), this.ipad1 = p, this.ipad2 = l, this.opad = h, this.alg = e, this.blocksize = u, this
  32290. .hash = o, this.size = c[e]
  32291. }
  32292. h.prototype.run = function(e, t) {
  32293. return e.copy(t, this.blocksize), this.hash(t).copy(this.opad, this.blocksize), this.hash(this.opad)
  32294. }, e.exports = function(e, t, i, r, n) {
  32295. o(i, r);
  32296. var a = new h(n = n || "sha1", e = l(e, u, "Password"), (t = l(t, u, "Salt")).length),
  32297. d = s.allocUnsafe(r),
  32298. f = s.allocUnsafe(t.length + 4);
  32299. t.copy(f, 0, 0, t.length);
  32300. for (var p = 0, m = c[n], g = Math.ceil(r / m), v = 1; v <= g; v++) {
  32301. f.writeUInt32BE(v, t.length);
  32302. for (var y = a.run(f, a.ipad1), _ = y, b = 1; b < i; b++) {
  32303. _ = a.run(_, a.ipad2);
  32304. for (var w = 0; w < m; w++) y[w] ^= _[w]
  32305. }
  32306. y.copy(d, p), p += m
  32307. }
  32308. return d
  32309. }
  32310. }, function(e, t, i) {
  32311. var r = i(6).Buffer;
  32312. e.exports = function(e, t, i) {
  32313. if (r.isBuffer(e)) return e;
  32314. if ("string" == typeof e) return r.from(e, t);
  32315. if (ArrayBuffer.isView(e)) return r.from(e.buffer);
  32316. throw new TypeError(i + " must be a string, a Buffer, a typed array or a DataView")
  32317. }
  32318. }, function(e, t, i) {
  32319. "use strict";
  32320. t.readUInt32BE = function(e, t) {
  32321. return (e[0 + t] << 24 | e[1 + t] << 16 | e[2 + t] << 8 | e[3 + t]) >>> 0
  32322. }, t.writeUInt32BE = function(e, t, i) {
  32323. e[0 + i] = t >>> 24, e[1 + i] = t >>> 16 & 255, e[2 + i] = t >>> 8 & 255, e[3 + i] = 255 & t
  32324. }, t.ip = function(e, t, i, r) {
  32325. for (var n = 0, a = 0, s = 6; s >= 0; s -= 2) {
  32326. for (var o = 0; o <= 24; o += 8) n <<= 1, n |= t >>> o + s & 1;
  32327. for (o = 0; o <= 24; o += 8) n <<= 1, n |= e >>> o + s & 1
  32328. }
  32329. for (s = 6; s >= 0; s -= 2) {
  32330. for (o = 1; o <= 25; o += 8) a <<= 1, a |= t >>> o + s & 1;
  32331. for (o = 1; o <= 25; o += 8) a <<= 1, a |= e >>> o + s & 1
  32332. }
  32333. i[r + 0] = n >>> 0, i[r + 1] = a >>> 0
  32334. }, t.rip = function(e, t, i, r) {
  32335. for (var n = 0, a = 0, s = 0; s < 4; s++)
  32336. for (var o = 24; o >= 0; o -= 8) n <<= 1, n |= t >>> o + s & 1, n <<= 1, n |= e >>> o + s & 1;
  32337. for (s = 4; s < 8; s++)
  32338. for (o = 24; o >= 0; o -= 8) a <<= 1, a |= t >>> o + s & 1, a <<= 1, a |= e >>> o + s & 1;
  32339. i[r + 0] = n >>> 0, i[r + 1] = a >>> 0
  32340. }, t.pc1 = function(e, t, i, r) {
  32341. for (var n = 0, a = 0, s = 7; s >= 5; s--) {
  32342. for (var o = 0; o <= 24; o += 8) n <<= 1, n |= t >> o + s & 1;
  32343. for (o = 0; o <= 24; o += 8) n <<= 1, n |= e >> o + s & 1
  32344. }
  32345. for (o = 0; o <= 24; o += 8) n <<= 1, n |= t >> o + s & 1;
  32346. for (s = 1; s <= 3; s++) {
  32347. for (o = 0; o <= 24; o += 8) a <<= 1, a |= t >> o + s & 1;
  32348. for (o = 0; o <= 24; o += 8) a <<= 1, a |= e >> o + s & 1
  32349. }
  32350. for (o = 0; o <= 24; o += 8) a <<= 1, a |= e >> o + s & 1;
  32351. i[r + 0] = n >>> 0, i[r + 1] = a >>> 0
  32352. }, t.r28shl = function(e, t) {
  32353. return e << t & 268435455 | e >>> 28 - t
  32354. };
  32355. var r = [14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, 15, 4, 25,
  32356. 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24
  32357. ];
  32358. t.pc2 = function(e, t, i, n) {
  32359. for (var a = 0, s = 0, o = r.length >>> 1, u = 0; u < o; u++) a <<= 1, a |= e >>> r[u] & 1;
  32360. for (u = o; u < r.length; u++) s <<= 1, s |= t >>> r[u] & 1;
  32361. i[n + 0] = a >>> 0, i[n + 1] = s >>> 0
  32362. }, t.expand = function(e, t, i) {
  32363. var r = 0,
  32364. n = 0;
  32365. r = (1 & e) << 5 | e >>> 27;
  32366. for (var a = 23; a >= 15; a -= 4) r <<= 6, r |= e >>> a & 63;
  32367. for (a = 11; a >= 3; a -= 4) n |= e >>> a & 63, n <<= 6;
  32368. n |= (31 & e) << 1 | e >>> 31, t[i + 0] = r >>> 0, t[i + 1] = n >>> 0
  32369. };
  32370. var n = [14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0,
  32371. 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0,
  32372. 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0,
  32373. 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0,
  32374. 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11,
  32375. 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3,
  32376. 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5,
  32377. 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3,
  32378. 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0,
  32379. 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6,
  32380. 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0,
  32381. 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
  32382. 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13,
  32383. 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10,
  32384. 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11,
  32385. 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10,
  32386. 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
  32387. ];
  32388. t.substitute = function(e, t) {
  32389. for (var i = 0, r = 0; r < 4; r++) i <<= 4, i |= n[64 * r + (e >>> 18 - 6 * r & 63)];
  32390. for (r = 0; r < 4; r++) i <<= 4, i |= n[256 + 64 * r + (t >>> 18 - 6 * r & 63)];
  32391. return i >>> 0
  32392. };
  32393. var a = [16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2,
  32394. 26, 10, 21, 28, 7
  32395. ];
  32396. t.permute = function(e) {
  32397. for (var t = 0, i = 0; i < a.length; i++) t <<= 1, t |= e >>> a[i] & 1;
  32398. return t >>> 0
  32399. }, t.padSplit = function(e, t, i) {
  32400. for (var r = e.toString(2); r.length < t;) r = "0" + r;
  32401. for (var n = [], a = 0; a < t; a += i) n.push(r.slice(a, a + i));
  32402. return n.join(" ")
  32403. }
  32404. }, function(e, t, i) {
  32405. "use strict";
  32406. var r = i(14),
  32407. n = i(5),
  32408. a = i(93),
  32409. s = i(52);
  32410. function o(e) {
  32411. s.call(this, e);
  32412. var t = new function() {
  32413. this.tmp = new Array(2), this.keys = null
  32414. };
  32415. this._desState = t, this.deriveKeys(t, e.key)
  32416. }
  32417. n(o, s), e.exports = o, o.create = function(e) {
  32418. return new o(e)
  32419. };
  32420. var u = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];
  32421. o.prototype.deriveKeys = function(e, t) {
  32422. e.keys = new Array(32), r.equal(t.length, this.blockSize, "Invalid key length");
  32423. var i = a.readUInt32BE(t, 0),
  32424. n = a.readUInt32BE(t, 4);
  32425. a.pc1(i, n, e.tmp, 0), i = e.tmp[0], n = e.tmp[1];
  32426. for (var s = 0; s < e.keys.length; s += 2) {
  32427. var o = u[s >>> 1];
  32428. i = a.r28shl(i, o), n = a.r28shl(n, o), a.pc2(i, n, e.keys, s)
  32429. }
  32430. }, o.prototype._update = function(e, t, i, r) {
  32431. var n = this._desState,
  32432. s = a.readUInt32BE(e, t),
  32433. o = a.readUInt32BE(e, t + 4);
  32434. a.ip(s, o, n.tmp, 0), s = n.tmp[0], o = n.tmp[1], "encrypt" === this.type ? this._encrypt(n, s, o, n
  32435. .tmp, 0) : this._decrypt(n, s, o, n.tmp, 0), s = n.tmp[0], o = n.tmp[1], a.writeUInt32BE(i, s, r), a
  32436. .writeUInt32BE(i, o, r + 4)
  32437. }, o.prototype._pad = function(e, t) {
  32438. for (var i = e.length - t, r = t; r < e.length; r++) e[r] = i;
  32439. return !0
  32440. }, o.prototype._unpad = function(e) {
  32441. for (var t = e[e.length - 1], i = e.length - t; i < e.length; i++) r.equal(e[i], t);
  32442. return e.slice(0, e.length - t)
  32443. }, o.prototype._encrypt = function(e, t, i, r, n) {
  32444. for (var s = t, o = i, u = 0; u < e.keys.length; u += 2) {
  32445. var l = e.keys[u],
  32446. d = e.keys[u + 1];
  32447. a.expand(o, e.tmp, 0), l ^= e.tmp[0], d ^= e.tmp[1];
  32448. var c = a.substitute(l, d),
  32449. h = o;
  32450. o = (s ^ a.permute(c)) >>> 0, s = h
  32451. }
  32452. a.rip(o, s, r, n)
  32453. }, o.prototype._decrypt = function(e, t, i, r, n) {
  32454. for (var s = i, o = t, u = e.keys.length - 2; u >= 0; u -= 2) {
  32455. var l = e.keys[u],
  32456. d = e.keys[u + 1];
  32457. a.expand(s, e.tmp, 0), l ^= e.tmp[0], d ^= e.tmp[1];
  32458. var c = a.substitute(l, d),
  32459. h = s;
  32460. s = (o ^ a.permute(c)) >>> 0, o = h
  32461. }
  32462. a.rip(s, o, r, n)
  32463. }
  32464. }, function(e, t, i) {
  32465. var r = i(33),
  32466. n = i(6).Buffer,
  32467. a = i(96);
  32468. function s(e) {
  32469. var t = e._cipher.encryptBlockRaw(e._prev);
  32470. return a(e._prev), t
  32471. }
  32472. t.encrypt = function(e, t) {
  32473. var i = Math.ceil(t.length / 16),
  32474. a = e._cache.length;
  32475. e._cache = n.concat([e._cache, n.allocUnsafe(16 * i)]);
  32476. for (var o = 0; o < i; o++) {
  32477. var u = s(e),
  32478. l = a + 16 * o;
  32479. e._cache.writeUInt32BE(u[0], l + 0), e._cache.writeUInt32BE(u[1], l + 4), e._cache.writeUInt32BE(u[2],
  32480. l + 8), e._cache.writeUInt32BE(u[3], l + 12)
  32481. }
  32482. var d = e._cache.slice(0, t.length);
  32483. return e._cache = e._cache.slice(t.length), r(t, d)
  32484. }
  32485. }, function(e, t) {
  32486. e.exports = function(e) {
  32487. for (var t, i = e.length; i--;) {
  32488. if (255 !== (t = e.readUInt8(i))) {
  32489. t++, e.writeUInt8(t, i);
  32490. break
  32491. }
  32492. e.writeUInt8(0, i)
  32493. }
  32494. }
  32495. }, function(e) {
  32496. e.exports = JSON.parse(
  32497. '{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}'
  32498. )
  32499. }, function(e, t, i) {
  32500. var r = i(39),
  32501. n = i(6).Buffer,
  32502. a = i(20),
  32503. s = i(5),
  32504. o = i(174),
  32505. u = i(33),
  32506. l = i(96);
  32507. function d(e, t, i, s) {
  32508. a.call(this);
  32509. var u = n.alloc(4, 0);
  32510. this._cipher = new r.AES(t);
  32511. var d = this._cipher.encryptBlock(u);
  32512. this._ghash = new o(d), i = function(e, t, i) {
  32513. if (12 === t.length) return e._finID = n.concat([t, n.from([0, 0, 0, 1])]), n.concat([t, n.from([0, 0,
  32514. 0, 2
  32515. ])]);
  32516. var r = new o(i),
  32517. a = t.length,
  32518. s = a % 16;
  32519. r.update(t), s && (s = 16 - s, r.update(n.alloc(s, 0))), r.update(n.alloc(8, 0));
  32520. var u = 8 * a,
  32521. d = n.alloc(8);
  32522. d.writeUIntBE(u, 0, 8), r.update(d), e._finID = r.state;
  32523. var c = n.from(e._finID);
  32524. return l(c), c
  32525. }(this, i, d), this._prev = n.from(i), this._cache = n.allocUnsafe(0), this._secCache = n.allocUnsafe(
  32526. 0), this._decrypt = s, this._alen = 0, this._len = 0, this._mode = e, this._authTag = null, this
  32527. ._called = !1
  32528. }
  32529. s(d, a), d.prototype._update = function(e) {
  32530. if (!this._called && this._alen) {
  32531. var t = 16 - this._alen % 16;
  32532. t < 16 && (t = n.alloc(t, 0), this._ghash.update(t))
  32533. }
  32534. this._called = !0;
  32535. var i = this._mode.encrypt(this, e);
  32536. return this._decrypt ? this._ghash.update(e) : this._ghash.update(i), this._len += e.length, i
  32537. }, d.prototype._final = function() {
  32538. if (this._decrypt && !this._authTag) throw new Error(
  32539. "Unsupported state or unable to authenticate data");
  32540. var e = u(this._ghash.final(8 * this._alen, 8 * this._len), this._cipher.encryptBlock(this._finID));
  32541. if (this._decrypt && function(e, t) {
  32542. var i = 0;
  32543. e.length !== t.length && i++;
  32544. for (var r = Math.min(e.length, t.length), n = 0; n < r; ++n) i += e[n] ^ t[n];
  32545. return i
  32546. }(e, this._authTag)) throw new Error("Unsupported state or unable to authenticate data");
  32547. this._authTag = e, this._cipher.scrub()
  32548. }, d.prototype.getAuthTag = function() {
  32549. if (this._decrypt || !n.isBuffer(this._authTag)) throw new Error(
  32550. "Attempting to get auth tag in unsupported state");
  32551. return this._authTag
  32552. }, d.prototype.setAuthTag = function(e) {
  32553. if (!this._decrypt) throw new Error("Attempting to set auth tag in unsupported state");
  32554. this._authTag = e
  32555. }, d.prototype.setAAD = function(e) {
  32556. if (this._called) throw new Error("Attempting to set AAD in unsupported state");
  32557. this._ghash.update(e), this._alen += e.length
  32558. }, e.exports = d
  32559. }, function(e, t, i) {
  32560. var r = i(39),
  32561. n = i(6).Buffer,
  32562. a = i(20);
  32563. function s(e, t, i, s) {
  32564. a.call(this), this._cipher = new r.AES(t), this._prev = n.from(i), this._cache = n.allocUnsafe(0), this
  32565. ._secCache = n.allocUnsafe(0), this._decrypt = s, this._mode = e
  32566. }
  32567. i(5)(s, a), s.prototype._update = function(e) {
  32568. return this._mode.encrypt(this, e, this._decrypt)
  32569. }, s.prototype._final = function() {
  32570. this._cipher.scrub()
  32571. }, e.exports = s
  32572. }, function(e, t, i) {
  32573. var r = i(24);
  32574. e.exports = v, v.simpleSieve = m, v.fermatTest = g;
  32575. var n = i(11),
  32576. a = new n(24),
  32577. s = new(i(101)),
  32578. o = new n(1),
  32579. u = new n(2),
  32580. l = new n(5),
  32581. d = (new n(16), new n(8), new n(10)),
  32582. c = new n(3),
  32583. h = (new n(7), new n(11)),
  32584. f = new n(4),
  32585. p = (new n(12), null);
  32586. function m(e) {
  32587. for (var t = function() {
  32588. if (null !== p) return p;
  32589. var e = [];
  32590. e[0] = 2;
  32591. for (var t = 1, i = 3; i < 1048576; i += 2) {
  32592. for (var r = Math.ceil(Math.sqrt(i)), n = 0; n < t && e[n] <= r && i % e[n] != 0; n++);
  32593. t !== n && e[n] <= r || (e[t++] = i)
  32594. }
  32595. return p = e, e
  32596. }(), i = 0; i < t.length; i++)
  32597. if (0 === e.modn(t[i])) return 0 === e.cmpn(t[i]);
  32598. return !0
  32599. }
  32600. function g(e) {
  32601. var t = n.mont(e);
  32602. return 0 === u.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)
  32603. }
  32604. function v(e, t) {
  32605. if (e < 16) return new n(2 === t || 5 === t ? [140, 123] : [140, 39]);
  32606. var i, p;
  32607. for (t = new n(t);;) {
  32608. for (i = new n(r(Math.ceil(e / 8))); i.bitLength() > e;) i.ishrn(1);
  32609. if (i.isEven() && i.iadd(o), i.testn(1) || i.iadd(u), t.cmp(u)) {
  32610. if (!t.cmp(l))
  32611. for (; i.mod(d).cmp(c);) i.iadd(f)
  32612. } else
  32613. for (; i.mod(a).cmp(h);) i.iadd(f);
  32614. if (m(p = i.shrn(1)) && m(i) && g(p) && g(i) && s.test(p) && s.test(i)) return i
  32615. }
  32616. }
  32617. }, function(e, t, i) {
  32618. var r = i(11),
  32619. n = i(56);
  32620. function a(e) {
  32621. this.rand = e || new n.Rand
  32622. }
  32623. e.exports = a, a.create = function(e) {
  32624. return new a(e)
  32625. }, a.prototype._randbelow = function(e) {
  32626. var t = e.bitLength(),
  32627. i = Math.ceil(t / 8);
  32628. do {
  32629. var n = new r(this.rand.generate(i))
  32630. } while (n.cmp(e) >= 0);
  32631. return n
  32632. }, a.prototype._randrange = function(e, t) {
  32633. var i = t.sub(e);
  32634. return e.add(this._randbelow(i))
  32635. }, a.prototype.test = function(e, t, i) {
  32636. var n = e.bitLength(),
  32637. a = r.mont(e),
  32638. s = new r(1).toRed(a);
  32639. t || (t = Math.max(1, n / 48 | 0));
  32640. for (var o = e.subn(1), u = 0; !o.testn(u); u++);
  32641. for (var l = e.shrn(u), d = o.toRed(a); t > 0; t--) {
  32642. var c = this._randrange(new r(2), o);
  32643. i && i(c);
  32644. var h = c.toRed(a).redPow(l);
  32645. if (0 !== h.cmp(s) && 0 !== h.cmp(d)) {
  32646. for (var f = 1; f < u; f++) {
  32647. if (0 === (h = h.redSqr()).cmp(s)) return !1;
  32648. if (0 === h.cmp(d)) break
  32649. }
  32650. if (f === u) return !1
  32651. }
  32652. }
  32653. return !0
  32654. }, a.prototype.getDivisor = function(e, t) {
  32655. var i = e.bitLength(),
  32656. n = r.mont(e),
  32657. a = new r(1).toRed(n);
  32658. t || (t = Math.max(1, i / 48 | 0));
  32659. for (var s = e.subn(1), o = 0; !s.testn(o); o++);
  32660. for (var u = e.shrn(o), l = s.toRed(n); t > 0; t--) {
  32661. var d = this._randrange(new r(2), s),
  32662. c = e.gcd(d);
  32663. if (0 !== c.cmpn(1)) return c;
  32664. var h = d.toRed(n).redPow(u);
  32665. if (0 !== h.cmp(a) && 0 !== h.cmp(l)) {
  32666. for (var f = 1; f < o; f++) {
  32667. if (0 === (h = h.redSqr()).cmp(a)) return h.fromRed().subn(1).gcd(e);
  32668. if (0 === h.cmp(l)) break
  32669. }
  32670. if (f === o) return (h = h.redSqr()).fromRed().subn(1).gcd(e)
  32671. }
  32672. }
  32673. return !1
  32674. }
  32675. }, function(e, t, i) {
  32676. "use strict";
  32677. (function(t, r) {
  32678. var n;
  32679. e.exports = A, A.ReadableState = S, i(8).EventEmitter;
  32680. var a, s = function(e, t) {
  32681. return e.listeners(t).length
  32682. },
  32683. o = i(103),
  32684. u = i(10).Buffer,
  32685. l = t.Uint8Array || function() {},
  32686. d = i(184);
  32687. a = d && d.debuglog ? d.debuglog("stream") : function() {};
  32688. var c, h, f, p = i(185),
  32689. m = i(104),
  32690. g = i(105).getHighWaterMark,
  32691. v = i(28).codes,
  32692. y = v.ERR_INVALID_ARG_TYPE,
  32693. _ = v.ERR_STREAM_PUSH_AFTER_EOF,
  32694. b = v.ERR_METHOD_NOT_IMPLEMENTED,
  32695. w = v.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
  32696. i(5)(A, o);
  32697. var E = m.errorOrDestroy,
  32698. T = ["error", "close", "destroy", "pause", "resume"];
  32699. function S(e, t, r) {
  32700. n = n || i(29), e = e || {}, "boolean" != typeof r && (r = t instanceof n), this.objectMode = !!e
  32701. .objectMode, r && (this.objectMode = this.objectMode || !!e.readableObjectMode), this
  32702. .highWaterMark = g(this, e, "readableHighWaterMark", r), this.buffer = new p, this.length = 0, this
  32703. .pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this
  32704. .reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this
  32705. .readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = !1 !== e
  32706. .emitClose, this.autoDestroy = !!e.autoDestroy, this.destroyed = !1, this.defaultEncoding = e
  32707. .defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this
  32708. .encoding = null, e.encoding && (c || (c = i(22).StringDecoder), this.decoder = new c(e.encoding),
  32709. this.encoding = e.encoding)
  32710. }
  32711. function A(e) {
  32712. if (n = n || i(29), !(this instanceof A)) return new A(e);
  32713. var t = this instanceof n;
  32714. this._readableState = new S(e, this, t), this.readable = !0, e && ("function" == typeof e.read && (
  32715. this._read = e.read), "function" == typeof e.destroy && (this._destroy = e.destroy)), o.call(this)
  32716. }
  32717. function k(e, t, i, r, n) {
  32718. a("readableAddChunk", t);
  32719. var s, o = e._readableState;
  32720. if (null === t) o.reading = !1,
  32721. function(e, t) {
  32722. if (a("onEofChunk"), !t.ended) {
  32723. if (t.decoder) {
  32724. var i = t.decoder.end();
  32725. i && i.length && (t.buffer.push(i), t.length += t.objectMode ? 1 : i.length)
  32726. }
  32727. t.ended = !0, t.sync ? O(e) : (t.needReadable = !1, t.emittedReadable || (t.emittedReadable = !
  32728. 0, C(e)))
  32729. }
  32730. }(e, o);
  32731. else if (n || (s = function(e, t) {
  32732. var i, r;
  32733. return r = t, u.isBuffer(r) || r instanceof l || "string" == typeof t || void 0 === t || e
  32734. .objectMode || (i = new y("chunk", ["string", "Buffer", "Uint8Array"], t)), i
  32735. }(o, t)), s) E(e, s);
  32736. else if (o.objectMode || t && t.length > 0)
  32737. if ("string" == typeof t || o.objectMode || Object.getPrototypeOf(t) === u.prototype || (t =
  32738. function(e) {
  32739. return u.from(e)
  32740. }(t)), r) o.endEmitted ? E(e, new w) : R(e, o, t, !0);
  32741. else if (o.ended) E(e, new _);
  32742. else {
  32743. if (o.destroyed) return !1;
  32744. o.reading = !1, o.decoder && !i ? (t = o.decoder.write(t), o.objectMode || 0 !== t.length ? R(e, o,
  32745. t, !1) : D(e, o)) : R(e, o, t, !1)
  32746. } else r || (o.reading = !1, D(e, o));
  32747. return !o.ended && (o.length < o.highWaterMark || 0 === o.length)
  32748. }
  32749. function R(e, t, i, r) {
  32750. t.flowing && 0 === t.length && !t.sync ? (t.awaitDrain = 0, e.emit("data", i)) : (t.length += t
  32751. .objectMode ? 1 : i.length, r ? t.buffer.unshift(i) : t.buffer.push(i), t.needReadable && O(e)),
  32752. D(e, t)
  32753. }
  32754. function M(e, t) {
  32755. return e <= 0 || 0 === t.length && t.ended ? 0 : t.objectMode ? 1 : e != e ? t.flowing && t.length ? t
  32756. .buffer.head.data.length : t.length : (e > t.highWaterMark && (t.highWaterMark = function(e) {
  32757. return e >= 1073741824 ? e = 1073741824 : (e--, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |=
  32758. e >>> 8, e |= e >>> 16, e++), e
  32759. }(e)), e <= t.length ? e : t.ended ? t.length : (t.needReadable = !0, 0))
  32760. }
  32761. function O(e) {
  32762. var t = e._readableState;
  32763. a("emitReadable", t.needReadable, t.emittedReadable), t.needReadable = !1, t.emittedReadable || (a(
  32764. "emitReadable", t.flowing), t.emittedReadable = !0, r.nextTick(C, e))
  32765. }
  32766. function C(e) {
  32767. var t = e._readableState;
  32768. a("emitReadable_", t.destroyed, t.length, t.ended), t.destroyed || !t.length && !t.ended || (e.emit(
  32769. "readable"), t.emittedReadable = !1), t.needReadable = !t.flowing && !t.ended && t.length <= t
  32770. .highWaterMark, U(e)
  32771. }
  32772. function D(e, t) {
  32773. t.readingMore || (t.readingMore = !0, r.nextTick(I, e, t))
  32774. }
  32775. function I(e, t) {
  32776. for (; !t.reading && !t.ended && (t.length < t.highWaterMark || t.flowing && 0 === t.length);) {
  32777. var i = t.length;
  32778. if (a("maybeReadMore read 0"), e.read(0), i === t.length) break
  32779. }
  32780. t.readingMore = !1
  32781. }
  32782. function L(e) {
  32783. var t = e._readableState;
  32784. t.readableListening = e.listenerCount("readable") > 0, t.resumeScheduled && !t.paused ? t.flowing = !
  32785. 0 : e.listenerCount("data") > 0 && e.resume()
  32786. }
  32787. function x(e) {
  32788. a("readable nexttick read 0"), e.read(0)
  32789. }
  32790. function P(e, t) {
  32791. a("resume", t.reading), t.reading || e.read(0), t.resumeScheduled = !1, e.emit("resume"), U(e), t
  32792. .flowing && !t.reading && e.read(0)
  32793. }
  32794. function U(e) {
  32795. var t = e._readableState;
  32796. for (a("flow", t.flowing); t.flowing && null !== e.read(););
  32797. }
  32798. function N(e, t) {
  32799. return 0 === t.length ? null : (t.objectMode ? i = t.buffer.shift() : !e || e >= t.length ? (i = t
  32800. .decoder ? t.buffer.join("") : 1 === t.buffer.length ? t.buffer.first() : t.buffer.concat(t
  32801. .length), t.buffer.clear()) : i = t.buffer.consume(e, t.decoder), i);
  32802. var i
  32803. }
  32804. function B(e) {
  32805. var t = e._readableState;
  32806. a("endReadable", t.endEmitted), t.endEmitted || (t.ended = !0, r.nextTick(F, t, e))
  32807. }
  32808. function F(e, t) {
  32809. if (a("endReadableNT", e.endEmitted, e.length), !e.endEmitted && 0 === e.length && (e.endEmitted = !0,
  32810. t.readable = !1, t.emit("end"), e.autoDestroy)) {
  32811. var i = t._writableState;
  32812. (!i || i.autoDestroy && i.finished) && t.destroy()
  32813. }
  32814. }
  32815. function j(e, t) {
  32816. for (var i = 0, r = e.length; i < r; i++)
  32817. if (e[i] === t) return i;
  32818. return -1
  32819. }
  32820. Object.defineProperty(A.prototype, "destroyed", {
  32821. enumerable: !1,
  32822. get: function() {
  32823. return void 0 !== this._readableState && this._readableState.destroyed
  32824. },
  32825. set: function(e) {
  32826. this._readableState && (this._readableState.destroyed = e)
  32827. }
  32828. }), A.prototype.destroy = m.destroy, A.prototype._undestroy = m.undestroy, A.prototype._destroy =
  32829. function(e, t) {
  32830. t(e)
  32831. }, A.prototype.push = function(e, t) {
  32832. var i, r = this._readableState;
  32833. return r.objectMode ? i = !0 : "string" == typeof e && ((t = t || r.defaultEncoding) !== r
  32834. .encoding && (e = u.from(e, t), t = ""), i = !0), k(this, e, t, !1, i)
  32835. }, A.prototype.unshift = function(e) {
  32836. return k(this, e, null, !0, !1)
  32837. }, A.prototype.isPaused = function() {
  32838. return !1 === this._readableState.flowing
  32839. }, A.prototype.setEncoding = function(e) {
  32840. c || (c = i(22).StringDecoder);
  32841. var t = new c(e);
  32842. this._readableState.decoder = t, this._readableState.encoding = this._readableState.decoder
  32843. .encoding;
  32844. for (var r = this._readableState.buffer.head, n = ""; null !== r;) n += t.write(r.data), r = r.next;
  32845. return this._readableState.buffer.clear(), "" !== n && this._readableState.buffer.push(n), this
  32846. ._readableState.length = n.length, this
  32847. }, A.prototype.read = function(e) {
  32848. a("read", e), e = parseInt(e, 10);
  32849. var t = this._readableState,
  32850. i = e;
  32851. if (0 !== e && (t.emittedReadable = !1), 0 === e && t.needReadable && ((0 !== t.highWaterMark ? t
  32852. .length >= t.highWaterMark : t.length > 0) || t.ended)) return a("read: emitReadable", t.length,
  32853. t.ended), 0 === t.length && t.ended ? B(this) : O(this), null;
  32854. if (0 === (e = M(e, t)) && t.ended) return 0 === t.length && B(this), null;
  32855. var r, n = t.needReadable;
  32856. return a("need readable", n), (0 === t.length || t.length - e < t.highWaterMark) && a(
  32857. "length less than watermark", n = !0), t.ended || t.reading ? a("reading or ended", n = !1) :
  32858. n && (a("do read"), t.reading = !0, t.sync = !0, 0 === t.length && (t.needReadable = !0), this
  32859. ._read(t.highWaterMark), t.sync = !1, t.reading || (e = M(i, t))), null === (r = e > 0 ? N(e,
  32860. t) : null) ? (t.needReadable = t.length <= t.highWaterMark, e = 0) : (t.length -= e, t
  32861. .awaitDrain = 0), 0 === t.length && (t.ended || (t.needReadable = !0), i !== e && t.ended && B(
  32862. this)), null !== r && this.emit("data", r), r
  32863. }, A.prototype._read = function(e) {
  32864. E(this, new b("_read()"))
  32865. }, A.prototype.pipe = function(e, t) {
  32866. var i = this,
  32867. n = this._readableState;
  32868. switch (n.pipesCount) {
  32869. case 0:
  32870. n.pipes = e;
  32871. break;
  32872. case 1:
  32873. n.pipes = [n.pipes, e];
  32874. break;
  32875. default:
  32876. n.pipes.push(e)
  32877. }
  32878. n.pipesCount += 1, a("pipe count=%d opts=%j", n.pipesCount, t);
  32879. var o = t && !1 === t.end || e === r.stdout || e === r.stderr ? m : u;
  32880. function u() {
  32881. a("onend"), e.end()
  32882. }
  32883. n.endEmitted ? r.nextTick(o) : i.once("end", o), e.on("unpipe", function t(r, s) {
  32884. a("onunpipe"), r === i && s && !1 === s.hasUnpiped && (s.hasUnpiped = !0, a("cleanup"), e
  32885. .removeListener("close", f), e.removeListener("finish", p), e.removeListener("drain", l),
  32886. e.removeListener("error", h), e.removeListener("unpipe", t), i.removeListener("end", u), i
  32887. .removeListener("end", m), i.removeListener("data", c), d = !0, !n.awaitDrain || e
  32888. ._writableState && !e._writableState.needDrain || l())
  32889. });
  32890. var l = function(e) {
  32891. return function() {
  32892. var t = e._readableState;
  32893. a("pipeOnDrain", t.awaitDrain), t.awaitDrain && t.awaitDrain--, 0 === t.awaitDrain && s(e,
  32894. "data") && (t.flowing = !0, U(e))
  32895. }
  32896. }(i);
  32897. e.on("drain", l);
  32898. var d = !1;
  32899. function c(t) {
  32900. a("ondata");
  32901. var r = e.write(t);
  32902. a("dest.write", r), !1 === r && ((1 === n.pipesCount && n.pipes === e || n.pipesCount > 1 && -
  32903. 1 !== j(n.pipes, e)) && !d && (a("false write response, pause", n.awaitDrain), n
  32904. .awaitDrain++), i.pause())
  32905. }
  32906. function h(t) {
  32907. a("onerror", t), m(), e.removeListener("error", h), 0 === s(e, "error") && E(e, t)
  32908. }
  32909. function f() {
  32910. e.removeListener("finish", p), m()
  32911. }
  32912. function p() {
  32913. a("onfinish"), e.removeListener("close", f), m()
  32914. }
  32915. function m() {
  32916. a("unpipe"), i.unpipe(e)
  32917. }
  32918. return i.on("data", c),
  32919. function(e, t, i) {
  32920. if ("function" == typeof e.prependListener) return e.prependListener(t, i);
  32921. e._events && e._events[t] ? Array.isArray(e._events[t]) ? e._events[t].unshift(i) : e._events[
  32922. t] = [i, e._events[t]] : e.on(t, i)
  32923. }(e, "error", h), e.once("close", f), e.once("finish", p), e.emit("pipe", i), n.flowing || (a(
  32924. "pipe resume"), i.resume()), e
  32925. }, A.prototype.unpipe = function(e) {
  32926. var t = this._readableState,
  32927. i = {
  32928. hasUnpiped: !1
  32929. };
  32930. if (0 === t.pipesCount) return this;
  32931. if (1 === t.pipesCount) return e && e !== t.pipes || (e || (e = t.pipes), t.pipes = null, t
  32932. .pipesCount = 0, t.flowing = !1, e && e.emit("unpipe", this, i)), this;
  32933. if (!e) {
  32934. var r = t.pipes,
  32935. n = t.pipesCount;
  32936. t.pipes = null, t.pipesCount = 0, t.flowing = !1;
  32937. for (var a = 0; a < n; a++) r[a].emit("unpipe", this, {
  32938. hasUnpiped: !1
  32939. });
  32940. return this
  32941. }
  32942. var s = j(t.pipes, e);
  32943. return -1 === s || (t.pipes.splice(s, 1), t.pipesCount -= 1, 1 === t.pipesCount && (t.pipes = t
  32944. .pipes[0]), e.emit("unpipe", this, i)), this
  32945. }, A.prototype.on = function(e, t) {
  32946. var i = o.prototype.on.call(this, e, t),
  32947. n = this._readableState;
  32948. return "data" === e ? (n.readableListening = this.listenerCount("readable") > 0, !1 !== n.flowing &&
  32949. this.resume()) : "readable" === e && (n.endEmitted || n.readableListening || (n
  32950. .readableListening = n.needReadable = !0, n.flowing = !1, n.emittedReadable = !1, a(
  32951. "on readable", n.length, n.reading), n.length ? O(this) : n.reading || r.nextTick(x, this))),
  32952. i
  32953. }, A.prototype.addListener = A.prototype.on, A.prototype.removeListener = function(e, t) {
  32954. var i = o.prototype.removeListener.call(this, e, t);
  32955. return "readable" === e && r.nextTick(L, this), i
  32956. }, A.prototype.removeAllListeners = function(e) {
  32957. var t = o.prototype.removeAllListeners.apply(this, arguments);
  32958. return "readable" !== e && void 0 !== e || r.nextTick(L, this), t
  32959. }, A.prototype.resume = function() {
  32960. var e = this._readableState;
  32961. return e.flowing || (a("resume"), e.flowing = !e.readableListening, function(e, t) {
  32962. t.resumeScheduled || (t.resumeScheduled = !0, r.nextTick(P, e, t))
  32963. }(this, e)), e.paused = !1, this
  32964. }, A.prototype.pause = function() {
  32965. return a("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState
  32966. .flowing && (a("pause"), this._readableState.flowing = !1, this.emit("pause")), this
  32967. ._readableState.paused = !0, this
  32968. }, A.prototype.wrap = function(e) {
  32969. var t = this,
  32970. i = this._readableState,
  32971. r = !1;
  32972. for (var n in e.on("end", function() {
  32973. if (a("wrapped end"), i.decoder && !i.ended) {
  32974. var e = i.decoder.end();
  32975. e && e.length && t.push(e)
  32976. }
  32977. t.push(null)
  32978. }), e.on("data", function(n) {
  32979. a("wrapped data"), i.decoder && (n = i.decoder.write(n)), i.objectMode && null == n || (i
  32980. .objectMode || n && n.length) && (t.push(n) || (r = !0, e.pause()))
  32981. }), e) void 0 === this[n] && "function" == typeof e[n] && (this[n] = function(t) {
  32982. return function() {
  32983. return e[t].apply(e, arguments)
  32984. }
  32985. }(n));
  32986. for (var s = 0; s < T.length; s++) e.on(T[s], this.emit.bind(this, T[s]));
  32987. return this._read = function(t) {
  32988. a("wrapped _read", t), r && (r = !1, e.resume())
  32989. }, this
  32990. }, "function" == typeof Symbol && (A.prototype[Symbol.asyncIterator] = function() {
  32991. return void 0 === h && (h = i(187)), h(this)
  32992. }), Object.defineProperty(A.prototype, "readableHighWaterMark", {
  32993. enumerable: !1,
  32994. get: function() {
  32995. return this._readableState.highWaterMark
  32996. }
  32997. }), Object.defineProperty(A.prototype, "readableBuffer", {
  32998. enumerable: !1,
  32999. get: function() {
  33000. return this._readableState && this._readableState.buffer
  33001. }
  33002. }), Object.defineProperty(A.prototype, "readableFlowing", {
  33003. enumerable: !1,
  33004. get: function() {
  33005. return this._readableState.flowing
  33006. },
  33007. set: function(e) {
  33008. this._readableState && (this._readableState.flowing = e)
  33009. }
  33010. }), A._fromList = N, Object.defineProperty(A.prototype, "readableLength", {
  33011. enumerable: !1,
  33012. get: function() {
  33013. return this._readableState.length
  33014. }
  33015. }), "function" == typeof Symbol && (A.from = function(e, t) {
  33016. return void 0 === f && (f = i(188)), f(A, e, t)
  33017. })
  33018. }).call(this, i(13), i(9))
  33019. }, function(e, t, i) {
  33020. e.exports = i(8).EventEmitter
  33021. }, function(e, t, i) {
  33022. "use strict";
  33023. (function(t) {
  33024. function i(e, t) {
  33025. n(e, t), r(e)
  33026. }
  33027. function r(e) {
  33028. e._writableState && !e._writableState.emitClose || e._readableState && !e._readableState.emitClose ||
  33029. e.emit("close")
  33030. }
  33031. function n(e, t) {
  33032. e.emit("error", t)
  33033. }
  33034. e.exports = {
  33035. destroy: function(e, a) {
  33036. var s = this,
  33037. o = this._readableState && this._readableState.destroyed,
  33038. u = this._writableState && this._writableState.destroyed;
  33039. return o || u ? (a ? a(e) : e && (this._writableState ? this._writableState.errorEmitted || (
  33040. this._writableState.errorEmitted = !0, t.nextTick(n, this, e)) : t.nextTick(n, this, e)),
  33041. this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState &&
  33042. (this._writableState.destroyed = !0), this._destroy(e || null, function(e) {
  33043. !a && e ? s._writableState ? s._writableState.errorEmitted ? t.nextTick(r, s) : (s
  33044. ._writableState.errorEmitted = !0, t.nextTick(i, s, e)) : t.nextTick(i, s, e) : a ?
  33045. (t.nextTick(r, s), a(e)) : t.nextTick(r, s)
  33046. }), this)
  33047. },
  33048. undestroy: function() {
  33049. this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1,
  33050. this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState &&
  33051. (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState
  33052. .ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1,
  33053. this._writableState.finished = !1, this._writableState.errorEmitted = !1)
  33054. },
  33055. errorOrDestroy: function(e, t) {
  33056. var i = e._readableState,
  33057. r = e._writableState;
  33058. i && i.autoDestroy || r && r.autoDestroy ? e.destroy(t) : e.emit("error", t)
  33059. }
  33060. }
  33061. }).call(this, i(9))
  33062. }, function(e, t, i) {
  33063. "use strict";
  33064. var r = i(28).codes.ERR_INVALID_OPT_VALUE;
  33065. e.exports = {
  33066. getHighWaterMark: function(e, t, i, n) {
  33067. var a = function(e, t, i) {
  33068. return null != e.highWaterMark ? e.highWaterMark : t ? e[i] : null
  33069. }(t, n, i);
  33070. if (null != a) {
  33071. if (!isFinite(a) || Math.floor(a) !== a || a < 0) throw new r(n ? i : "highWaterMark", a);
  33072. return Math.floor(a)
  33073. }
  33074. return e.objectMode ? 16 : 16384
  33075. }
  33076. }
  33077. }, function(e, t, i) {
  33078. "use strict";
  33079. (function(t, r) {
  33080. function n(e) {
  33081. var t = this;
  33082. this.next = null, this.entry = null, this.finish = function() {
  33083. ! function(e, t, i) {
  33084. var r = e.entry;
  33085. for (e.entry = null; r;) {
  33086. var n = r.callback;
  33087. t.pendingcb--, n(void 0), r = r.next
  33088. }
  33089. t.corkedRequestsFree.next = e
  33090. }(t, e)
  33091. }
  33092. }
  33093. var a;
  33094. e.exports = A, A.WritableState = S;
  33095. var s, o = {
  33096. deprecate: i(45)
  33097. },
  33098. u = i(103),
  33099. l = i(10).Buffer,
  33100. d = t.Uint8Array || function() {},
  33101. c = i(104),
  33102. h = i(105).getHighWaterMark,
  33103. f = i(28).codes,
  33104. p = f.ERR_INVALID_ARG_TYPE,
  33105. m = f.ERR_METHOD_NOT_IMPLEMENTED,
  33106. g = f.ERR_MULTIPLE_CALLBACK,
  33107. v = f.ERR_STREAM_CANNOT_PIPE,
  33108. y = f.ERR_STREAM_DESTROYED,
  33109. _ = f.ERR_STREAM_NULL_VALUES,
  33110. b = f.ERR_STREAM_WRITE_AFTER_END,
  33111. w = f.ERR_UNKNOWN_ENCODING,
  33112. E = c.errorOrDestroy;
  33113. function T() {}
  33114. function S(e, t, s) {
  33115. a = a || i(29), e = e || {}, "boolean" != typeof s && (s = t instanceof a), this.objectMode = !!e
  33116. .objectMode, s && (this.objectMode = this.objectMode || !!e.writableObjectMode), this
  33117. .highWaterMark = h(this, e, "writableHighWaterMark", s), this.finalCalled = !1, this.needDrain = !1,
  33118. this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
  33119. var o = !1 === e.decodeStrings;
  33120. this.decodeStrings = !o, this.defaultEncoding = e.defaultEncoding || "utf8", this.length = 0, this
  33121. .writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(
  33122. e) {
  33123. ! function(e, t) {
  33124. var i = e._writableState,
  33125. n = i.sync,
  33126. a = i.writecb;
  33127. if ("function" != typeof a) throw new g;
  33128. if (function(e) {
  33129. e.writing = !1, e.writecb = null, e.length -= e.writelen, e.writelen = 0
  33130. }(i), t) ! function(e, t, i, n, a) {
  33131. --t.pendingcb, i ? (r.nextTick(a, n), r.nextTick(D, e, t), e._writableState.errorEmitted = !
  33132. 0, E(e, n)) : (a(n), e._writableState.errorEmitted = !0, E(e, n), D(e, t))
  33133. }(e, i, n, t, a);
  33134. else {
  33135. var s = O(i) || e.destroyed;
  33136. s || i.corked || i.bufferProcessing || !i.bufferedRequest || M(e, i), n ? r.nextTick(R, e, i,
  33137. s, a) : R(e, i, s, a)
  33138. }
  33139. }(t, e)
  33140. }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest =
  33141. null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = !1 !== e
  33142. .emitClose, this.autoDestroy = !!e.autoDestroy, this.bufferedRequestCount = 0, this
  33143. .corkedRequestsFree = new n(this)
  33144. }
  33145. function A(e) {
  33146. var t = this instanceof(a = a || i(29));
  33147. if (!t && !s.call(A, this)) return new A(e);
  33148. this._writableState = new S(e, this, t), this.writable = !0, e && ("function" == typeof e.write && (
  33149. this._write = e.write), "function" == typeof e.writev && (this._writev = e.writev),
  33150. "function" == typeof e.destroy && (this._destroy = e.destroy), "function" == typeof e.final && (
  33151. this._final = e.final)), u.call(this)
  33152. }
  33153. function k(e, t, i, r, n, a, s) {
  33154. t.writelen = r, t.writecb = s, t.writing = !0, t.sync = !0, t.destroyed ? t.onwrite(new y("write")) :
  33155. i ? e._writev(n, t.onwrite) : e._write(n, a, t.onwrite), t.sync = !1
  33156. }
  33157. function R(e, t, i, r) {
  33158. i || function(e, t) {
  33159. 0 === t.length && t.needDrain && (t.needDrain = !1, e.emit("drain"))
  33160. }(e, t), t.pendingcb--, r(), D(e, t)
  33161. }
  33162. function M(e, t) {
  33163. t.bufferProcessing = !0;
  33164. var i = t.bufferedRequest;
  33165. if (e._writev && i && i.next) {
  33166. var r = t.bufferedRequestCount,
  33167. a = new Array(r),
  33168. s = t.corkedRequestsFree;
  33169. s.entry = i;
  33170. for (var o = 0, u = !0; i;) a[o] = i, i.isBuf || (u = !1), i = i.next, o += 1;
  33171. a.allBuffers = u, k(e, t, !0, t.length, a, "", s.finish), t.pendingcb++, t.lastBufferedRequest =
  33172. null, s.next ? (t.corkedRequestsFree = s.next, s.next = null) : t.corkedRequestsFree = new n(t), t
  33173. .bufferedRequestCount = 0
  33174. } else {
  33175. for (; i;) {
  33176. var l = i.chunk,
  33177. d = i.encoding,
  33178. c = i.callback;
  33179. if (k(e, t, !1, t.objectMode ? 1 : l.length, l, d, c), i = i.next, t.bufferedRequestCount--, t
  33180. .writing) break
  33181. }
  33182. null === i && (t.lastBufferedRequest = null)
  33183. }
  33184. t.bufferedRequest = i, t.bufferProcessing = !1
  33185. }
  33186. function O(e) {
  33187. return e.ending && 0 === e.length && null === e.bufferedRequest && !e.finished && !e.writing
  33188. }
  33189. function C(e, t) {
  33190. e._final(function(i) {
  33191. t.pendingcb--, i && E(e, i), t.prefinished = !0, e.emit("prefinish"), D(e, t)
  33192. })
  33193. }
  33194. function D(e, t) {
  33195. var i = O(t);
  33196. if (i && (function(e, t) {
  33197. t.prefinished || t.finalCalled || ("function" != typeof e._final || t.destroyed ? (t
  33198. .prefinished = !0, e.emit("prefinish")) : (t.pendingcb++, t.finalCalled = !0, r.nextTick(
  33199. C, e, t)))
  33200. }(e, t), 0 === t.pendingcb && (t.finished = !0, e.emit("finish"), t.autoDestroy))) {
  33201. var n = e._readableState;
  33202. (!n || n.autoDestroy && n.endEmitted) && e.destroy()
  33203. }
  33204. return i
  33205. }
  33206. i(5)(A, u), S.prototype.getBuffer = function() {
  33207. for (var e = this.bufferedRequest, t = []; e;) t.push(e), e = e.next;
  33208. return t
  33209. },
  33210. function() {
  33211. try {
  33212. Object.defineProperty(S.prototype, "buffer", {
  33213. get: o.deprecate(function() {
  33214. return this.getBuffer()
  33215. }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.",
  33216. "DEP0003")
  33217. })
  33218. } catch (e) {}
  33219. }(), "function" == typeof Symbol && Symbol.hasInstance && "function" == typeof Function.prototype[
  33220. Symbol.hasInstance] ? (s = Function.prototype[Symbol.hasInstance], Object.defineProperty(A, Symbol
  33221. .hasInstance, {
  33222. value: function(e) {
  33223. return !!s.call(this, e) || this === A && e && e._writableState instanceof S
  33224. }
  33225. })) : s = function(e) {
  33226. return e instanceof this
  33227. }, A.prototype.pipe = function() {
  33228. E(this, new v)
  33229. }, A.prototype.write = function(e, t, i) {
  33230. var n, a = this._writableState,
  33231. s = !1,
  33232. o = !a.objectMode && (n = e, l.isBuffer(n) || n instanceof d);
  33233. return o && !l.isBuffer(e) && (e = function(e) {
  33234. return l.from(e)
  33235. }(e)), "function" == typeof t && (i = t, t = null), o ? t = "buffer" : t || (t = a
  33236. .defaultEncoding), "function" != typeof i && (i = T), a.ending ? function(e, t) {
  33237. var i = new b;
  33238. E(e, i), r.nextTick(t, i)
  33239. }(this, i) : (o || function(e, t, i, n) {
  33240. var a;
  33241. return null === i ? a = new _ : "string" == typeof i || t.objectMode || (a = new p("chunk", [
  33242. "string", "Buffer"
  33243. ], i)), !a || (E(e, a), r.nextTick(n, a), !1)
  33244. }(this, a, e, i)) && (a.pendingcb++, s = function(e, t, i, r, n, a) {
  33245. if (!i) {
  33246. var s = function(e, t, i) {
  33247. return e.objectMode || !1 === e.decodeStrings || "string" != typeof t || (t = l.from(t,
  33248. i)), t
  33249. }(t, r, n);
  33250. r !== s && (i = !0, n = "buffer", r = s)
  33251. }
  33252. var o = t.objectMode ? 1 : r.length;
  33253. t.length += o;
  33254. var u = t.length < t.highWaterMark;
  33255. if (u || (t.needDrain = !0), t.writing || t.corked) {
  33256. var d = t.lastBufferedRequest;
  33257. t.lastBufferedRequest = {
  33258. chunk: r,
  33259. encoding: n,
  33260. isBuf: i,
  33261. callback: a,
  33262. next: null
  33263. }, d ? d.next = t.lastBufferedRequest : t.bufferedRequest = t.lastBufferedRequest, t
  33264. .bufferedRequestCount += 1
  33265. } else k(e, t, !1, o, r, n, a);
  33266. return u
  33267. }(this, a, o, e, t, i)), s
  33268. }, A.prototype.cork = function() {
  33269. this._writableState.corked++
  33270. }, A.prototype.uncork = function() {
  33271. var e = this._writableState;
  33272. e.corked && (e.corked--, e.writing || e.corked || e.bufferProcessing || !e.bufferedRequest || M(
  33273. this, e))
  33274. }, A.prototype.setDefaultEncoding = function(e) {
  33275. if ("string" == typeof e && (e = e.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary",
  33276. "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"
  33277. ].indexOf((e + "").toLowerCase()) > -1)) throw new w(e);
  33278. return this._writableState.defaultEncoding = e, this
  33279. }, Object.defineProperty(A.prototype, "writableBuffer", {
  33280. enumerable: !1,
  33281. get: function() {
  33282. return this._writableState && this._writableState.getBuffer()
  33283. }
  33284. }), Object.defineProperty(A.prototype, "writableHighWaterMark", {
  33285. enumerable: !1,
  33286. get: function() {
  33287. return this._writableState.highWaterMark
  33288. }
  33289. }), A.prototype._write = function(e, t, i) {
  33290. i(new m("_write()"))
  33291. }, A.prototype._writev = null, A.prototype.end = function(e, t, i) {
  33292. var n = this._writableState;
  33293. return "function" == typeof e ? (i = e, e = null, t = null) : "function" == typeof t && (i = t, t =
  33294. null), null != e && this.write(e, t), n.corked && (n.corked = 1, this.uncork()), n.ending ||
  33295. function(e, t, i) {
  33296. t.ending = !0, D(e, t), i && (t.finished ? r.nextTick(i) : e.once("finish", i)), t.ended = !0, e
  33297. .writable = !1
  33298. }(this, n, i), this
  33299. }, Object.defineProperty(A.prototype, "writableLength", {
  33300. enumerable: !1,
  33301. get: function() {
  33302. return this._writableState.length
  33303. }
  33304. }), Object.defineProperty(A.prototype, "destroyed", {
  33305. enumerable: !1,
  33306. get: function() {
  33307. return void 0 !== this._writableState && this._writableState.destroyed
  33308. },
  33309. set: function(e) {
  33310. this._writableState && (this._writableState.destroyed = e)
  33311. }
  33312. }), A.prototype.destroy = c.destroy, A.prototype._undestroy = c.undestroy, A.prototype._destroy =
  33313. function(e, t) {
  33314. t(e)
  33315. }
  33316. }).call(this, i(13), i(9))
  33317. }, function(e, t, i) {
  33318. "use strict";
  33319. e.exports = l;
  33320. var r = i(28).codes,
  33321. n = r.ERR_METHOD_NOT_IMPLEMENTED,
  33322. a = r.ERR_MULTIPLE_CALLBACK,
  33323. s = r.ERR_TRANSFORM_ALREADY_TRANSFORMING,
  33324. o = r.ERR_TRANSFORM_WITH_LENGTH_0,
  33325. u = i(29);
  33326. function l(e) {
  33327. if (!(this instanceof l)) return new l(e);
  33328. u.call(this, e), this._transformState = {
  33329. afterTransform: function(e, t) {
  33330. var i = this._transformState;
  33331. i.transforming = !1;
  33332. var r = i.writecb;
  33333. if (null === r) return this.emit("error", new a);
  33334. i.writechunk = null, i.writecb = null, null != t && this.push(t), r(e);
  33335. var n = this._readableState;
  33336. n.reading = !1, (n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
  33337. }.bind(this),
  33338. needTransform: !1,
  33339. transforming: !1,
  33340. writecb: null,
  33341. writechunk: null,
  33342. writeencoding: null
  33343. }, this._readableState.needReadable = !0, this._readableState.sync = !1, e && ("function" == typeof e
  33344. .transform && (this._transform = e.transform), "function" == typeof e.flush && (this._flush = e.flush)
  33345. ), this.on("prefinish", d)
  33346. }
  33347. function d() {
  33348. var e = this;
  33349. "function" != typeof this._flush || this._readableState.destroyed ? c(this, null, null) : this._flush(
  33350. function(t, i) {
  33351. c(e, t, i)
  33352. })
  33353. }
  33354. function c(e, t, i) {
  33355. if (t) return e.emit("error", t);
  33356. if (null != i && e.push(i), e._writableState.length) throw new o;
  33357. if (e._transformState.transforming) throw new s;
  33358. return e.push(null)
  33359. }
  33360. i(5)(l, u), l.prototype.push = function(e, t) {
  33361. return this._transformState.needTransform = !1, u.prototype.push.call(this, e, t)
  33362. }, l.prototype._transform = function(e, t, i) {
  33363. i(new n("_transform()"))
  33364. }, l.prototype._write = function(e, t, i) {
  33365. var r = this._transformState;
  33366. if (r.writecb = i, r.writechunk = e, r.writeencoding = t, !r.transforming) {
  33367. var n = this._readableState;
  33368. (r.needTransform || n.needReadable || n.length < n.highWaterMark) && this._read(n.highWaterMark)
  33369. }
  33370. }, l.prototype._read = function(e) {
  33371. var t = this._transformState;
  33372. null === t.writechunk || t.transforming ? t.needTransform = !0 : (t.transforming = !0, this._transform(t
  33373. .writechunk, t.writeencoding, t.afterTransform))
  33374. }, l.prototype._destroy = function(e, t) {
  33375. u.prototype._destroy.call(this, e, function(e) {
  33376. t(e)
  33377. })
  33378. }
  33379. }, function(e, t, i) {
  33380. "use strict";
  33381. var r = t;
  33382. function n(e) {
  33383. return 1 === e.length ? "0" + e : e
  33384. }
  33385. function a(e) {
  33386. for (var t = "", i = 0; i < e.length; i++) t += n(e[i].toString(16));
  33387. return t
  33388. }
  33389. r.toArray = function(e, t) {
  33390. if (Array.isArray(e)) return e.slice();
  33391. if (!e) return [];
  33392. var i = [];
  33393. if ("string" != typeof e) {
  33394. for (var r = 0; r < e.length; r++) i[r] = 0 | e[r];
  33395. return i
  33396. }
  33397. if ("hex" === t)
  33398. for ((e = e.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (e = "0" + e), r = 0; r < e.length; r +=
  33399. 2) i.push(parseInt(e[r] + e[r + 1], 16));
  33400. else
  33401. for (r = 0; r < e.length; r++) {
  33402. var n = e.charCodeAt(r),
  33403. a = n >> 8,
  33404. s = 255 & n;
  33405. a ? i.push(a, s) : i.push(s)
  33406. }
  33407. return i
  33408. }, r.zero2 = n, r.toHex = a, r.encode = function(e, t) {
  33409. return "hex" === t ? a(e) : e
  33410. }
  33411. }, function(e, t, i) {
  33412. "use strict";
  33413. var r = t;
  33414. r.base = i(41), r.short = i(195), r.mont = i(196), r.edwards = i(197)
  33415. }, function(e, t, i) {
  33416. "use strict";
  33417. var r = i(18).rotr32;
  33418. function n(e, t, i) {
  33419. return e & t ^ ~e & i
  33420. }
  33421. function a(e, t, i) {
  33422. return e & t ^ e & i ^ t & i
  33423. }
  33424. function s(e, t, i) {
  33425. return e ^ t ^ i
  33426. }
  33427. t.ft_1 = function(e, t, i, r) {
  33428. return 0 === e ? n(t, i, r) : 1 === e || 3 === e ? s(t, i, r) : 2 === e ? a(t, i, r) : void 0
  33429. }, t.ch32 = n, t.maj32 = a, t.p32 = s, t.s0_256 = function(e) {
  33430. return r(e, 2) ^ r(e, 13) ^ r(e, 22)
  33431. }, t.s1_256 = function(e) {
  33432. return r(e, 6) ^ r(e, 11) ^ r(e, 25)
  33433. }, t.g0_256 = function(e) {
  33434. return r(e, 7) ^ r(e, 18) ^ e >>> 3
  33435. }, t.g1_256 = function(e) {
  33436. return r(e, 17) ^ r(e, 19) ^ e >>> 10
  33437. }
  33438. }, function(e, t, i) {
  33439. "use strict";
  33440. var r = i(18),
  33441. n = i(34),
  33442. a = i(110),
  33443. s = i(14),
  33444. o = r.sum32,
  33445. u = r.sum32_4,
  33446. l = r.sum32_5,
  33447. d = a.ch32,
  33448. c = a.maj32,
  33449. h = a.s0_256,
  33450. f = a.s1_256,
  33451. p = a.g0_256,
  33452. m = a.g1_256,
  33453. g = n.BlockHash,
  33454. v = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221,
  33455. 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580,
  33456. 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882,
  33457. 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912,
  33458. 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411,
  33459. 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556,
  33460. 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452,
  33461. 2361852424, 2428436474, 2756734187, 3204031479, 3329325298
  33462. ];
  33463. function y() {
  33464. if (!(this instanceof y)) return new y;
  33465. g.call(this), this.h = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635,
  33466. 1541459225
  33467. ], this.k = v, this.W = new Array(64)
  33468. }
  33469. r.inherits(y, g), e.exports = y, y.blockSize = 512, y.outSize = 256, y.hmacStrength = 192, y.padLength = 64,
  33470. y.prototype._update = function(e, t) {
  33471. for (var i = this.W, r = 0; r < 16; r++) i[r] = e[t + r];
  33472. for (; r < i.length; r++) i[r] = u(m(i[r - 2]), i[r - 7], p(i[r - 15]), i[r - 16]);
  33473. var n = this.h[0],
  33474. a = this.h[1],
  33475. g = this.h[2],
  33476. v = this.h[3],
  33477. y = this.h[4],
  33478. _ = this.h[5],
  33479. b = this.h[6],
  33480. w = this.h[7];
  33481. for (s(this.k.length === i.length), r = 0; r < i.length; r++) {
  33482. var E = l(w, f(y), d(y, _, b), this.k[r], i[r]),
  33483. T = o(h(n), c(n, a, g));
  33484. w = b, b = _, _ = y, y = o(v, E), v = g, g = a, a = n, n = o(E, T)
  33485. }
  33486. this.h[0] = o(this.h[0], n), this.h[1] = o(this.h[1], a), this.h[2] = o(this.h[2], g), this.h[3] = o(
  33487. this.h[3], v), this.h[4] = o(this.h[4], y), this.h[5] = o(this.h[5], _), this.h[6] = o(this.h[6],
  33488. b), this.h[7] = o(this.h[7], w)
  33489. }, y.prototype._digest = function(e) {
  33490. return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big")
  33491. }
  33492. }, function(e, t, i) {
  33493. "use strict";
  33494. var r = i(18),
  33495. n = i(34),
  33496. a = i(14),
  33497. s = r.rotr64_hi,
  33498. o = r.rotr64_lo,
  33499. u = r.shr64_hi,
  33500. l = r.shr64_lo,
  33501. d = r.sum64,
  33502. c = r.sum64_hi,
  33503. h = r.sum64_lo,
  33504. f = r.sum64_4_hi,
  33505. p = r.sum64_4_lo,
  33506. m = r.sum64_5_hi,
  33507. g = r.sum64_5_lo,
  33508. v = n.BlockHash,
  33509. y = [1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548,
  33510. 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560,
  33511. 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994,
  33512. 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868,
  33513. 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983,
  33514. 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882,
  33515. 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891,
  33516. 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964,
  33517. 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390,
  33518. 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460,
  33519. 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344,
  33520. 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616,
  33521. 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403,
  33522. 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928,
  33523. 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249,
  33524. 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711,
  33525. 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356,
  33526. 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100,
  33527. 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468,
  33528. 1816402316, 1246189591
  33529. ];
  33530. function _() {
  33531. if (!(this instanceof _)) return new _;
  33532. v.call(this), this.h = [1779033703, 4089235720, 3144134277, 2227873595, 1013904242, 4271175723,
  33533. 2773480762, 1595750129, 1359893119, 2917565137, 2600822924, 725511199, 528734635, 4215389547,
  33534. 1541459225, 327033209
  33535. ], this.k = y, this.W = new Array(160)
  33536. }
  33537. function b(e, t, i, r, n) {
  33538. var a = e & i ^ ~e & n;
  33539. return a < 0 && (a += 4294967296), a
  33540. }
  33541. function w(e, t, i, r, n, a) {
  33542. var s = t & r ^ ~t & a;
  33543. return s < 0 && (s += 4294967296), s
  33544. }
  33545. function E(e, t, i, r, n) {
  33546. var a = e & i ^ e & n ^ i & n;
  33547. return a < 0 && (a += 4294967296), a
  33548. }
  33549. function T(e, t, i, r, n, a) {
  33550. var s = t & r ^ t & a ^ r & a;
  33551. return s < 0 && (s += 4294967296), s
  33552. }
  33553. function S(e, t) {
  33554. var i = s(e, t, 28) ^ s(t, e, 2) ^ s(t, e, 7);
  33555. return i < 0 && (i += 4294967296), i
  33556. }
  33557. function A(e, t) {
  33558. var i = o(e, t, 28) ^ o(t, e, 2) ^ o(t, e, 7);
  33559. return i < 0 && (i += 4294967296), i
  33560. }
  33561. function k(e, t) {
  33562. var i = s(e, t, 14) ^ s(e, t, 18) ^ s(t, e, 9);
  33563. return i < 0 && (i += 4294967296), i
  33564. }
  33565. function R(e, t) {
  33566. var i = o(e, t, 14) ^ o(e, t, 18) ^ o(t, e, 9);
  33567. return i < 0 && (i += 4294967296), i
  33568. }
  33569. function M(e, t) {
  33570. var i = s(e, t, 1) ^ s(e, t, 8) ^ u(e, t, 7);
  33571. return i < 0 && (i += 4294967296), i
  33572. }
  33573. function O(e, t) {
  33574. var i = o(e, t, 1) ^ o(e, t, 8) ^ l(e, t, 7);
  33575. return i < 0 && (i += 4294967296), i
  33576. }
  33577. function C(e, t) {
  33578. var i = s(e, t, 19) ^ s(t, e, 29) ^ u(e, t, 6);
  33579. return i < 0 && (i += 4294967296), i
  33580. }
  33581. function D(e, t) {
  33582. var i = o(e, t, 19) ^ o(t, e, 29) ^ l(e, t, 6);
  33583. return i < 0 && (i += 4294967296), i
  33584. }
  33585. r.inherits(_, v), e.exports = _, _.blockSize = 1024, _.outSize = 512, _.hmacStrength = 192, _.padLength =
  33586. 128, _.prototype._prepareBlock = function(e, t) {
  33587. for (var i = this.W, r = 0; r < 32; r++) i[r] = e[t + r];
  33588. for (; r < i.length; r += 2) {
  33589. var n = C(i[r - 4], i[r - 3]),
  33590. a = D(i[r - 4], i[r - 3]),
  33591. s = i[r - 14],
  33592. o = i[r - 13],
  33593. u = M(i[r - 30], i[r - 29]),
  33594. l = O(i[r - 30], i[r - 29]),
  33595. d = i[r - 32],
  33596. c = i[r - 31];
  33597. i[r] = f(n, a, s, o, u, l, d, c), i[r + 1] = p(n, a, s, o, u, l, d, c)
  33598. }
  33599. }, _.prototype._update = function(e, t) {
  33600. this._prepareBlock(e, t);
  33601. var i = this.W,
  33602. r = this.h[0],
  33603. n = this.h[1],
  33604. s = this.h[2],
  33605. o = this.h[3],
  33606. u = this.h[4],
  33607. l = this.h[5],
  33608. f = this.h[6],
  33609. p = this.h[7],
  33610. v = this.h[8],
  33611. y = this.h[9],
  33612. _ = this.h[10],
  33613. M = this.h[11],
  33614. O = this.h[12],
  33615. C = this.h[13],
  33616. D = this.h[14],
  33617. I = this.h[15];
  33618. a(this.k.length === i.length);
  33619. for (var L = 0; L < i.length; L += 2) {
  33620. var x = D,
  33621. P = I,
  33622. U = k(v, y),
  33623. N = R(v, y),
  33624. B = b(v, 0, _, 0, O),
  33625. F = w(0, y, 0, M, 0, C),
  33626. j = this.k[L],
  33627. H = this.k[L + 1],
  33628. G = i[L],
  33629. V = i[L + 1],
  33630. W = m(x, P, U, N, B, F, j, H, G, V),
  33631. q = g(x, P, U, N, B, F, j, H, G, V);
  33632. x = S(r, n), P = A(r, n), U = E(r, 0, s, 0, u), N = T(0, n, 0, o, 0, l);
  33633. var X = c(x, P, U, N),
  33634. z = h(x, P, U, N);
  33635. D = O, I = C, O = _, C = M, _ = v, M = y, v = c(f, p, W, q), y = h(p, p, W, q), f = u, p = l, u = s,
  33636. l = o, s = r, o = n, r = c(W, q, X, z), n = h(W, q, X, z)
  33637. }
  33638. d(this.h, 0, r, n), d(this.h, 2, s, o), d(this.h, 4, u, l), d(this.h, 6, f, p), d(this.h, 8, v, y), d(
  33639. this.h, 10, _, M), d(this.h, 12, O, C), d(this.h, 14, D, I)
  33640. }, _.prototype._digest = function(e) {
  33641. return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big")
  33642. }
  33643. }, function(e, t, i) {
  33644. (function(e) {
  33645. ! function(e, t) {
  33646. "use strict";
  33647. function r(e, t) {
  33648. if (!e) throw new Error(t || "Assertion failed")
  33649. }
  33650. function n(e, t) {
  33651. e.super_ = t;
  33652. var i = function() {};
  33653. i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e
  33654. }
  33655. function a(e, t, i) {
  33656. if (a.isBN(e)) return e;
  33657. this.negative = 0, this.words = null, this.length = 0, this.red = null, null !== e && ("le" !== t &&
  33658. "be" !== t || (i = t, t = 10), this._init(e || 0, t || 10, i || "be"))
  33659. }
  33660. var s;
  33661. "object" == typeof e ? e.exports = a : t.BN = a, a.BN = a, a.wordSize = 26;
  33662. try {
  33663. s = "undefined" != typeof window && void 0 !== window.Buffer ? window.Buffer : i(212).Buffer
  33664. } catch (e) {}
  33665. function o(e, t) {
  33666. var i = e.charCodeAt(t);
  33667. return i >= 48 && i <= 57 ? i - 48 : i >= 65 && i <= 70 ? i - 55 : i >= 97 && i <= 102 ? i - 87 :
  33668. void r(!1, "Invalid character in " + e)
  33669. }
  33670. function u(e, t, i) {
  33671. var r = o(e, i);
  33672. return i - 1 >= t && (r |= o(e, i - 1) << 4), r
  33673. }
  33674. function l(e, t, i, n) {
  33675. for (var a = 0, s = 0, o = Math.min(e.length, i), u = t; u < o; u++) {
  33676. var l = e.charCodeAt(u) - 48;
  33677. a *= n, s = l >= 49 ? l - 49 + 10 : l >= 17 ? l - 17 + 10 : l, r(l >= 0 && s < n,
  33678. "Invalid character"), a += s
  33679. }
  33680. return a
  33681. }
  33682. function d(e, t) {
  33683. e.words = t.words, e.length = t.length, e.negative = t.negative, e.red = t.red
  33684. }
  33685. if (a.isBN = function(e) {
  33686. return e instanceof a || null !== e && "object" == typeof e && e.constructor.wordSize === a
  33687. .wordSize && Array.isArray(e.words)
  33688. }, a.max = function(e, t) {
  33689. return e.cmp(t) > 0 ? e : t
  33690. }, a.min = function(e, t) {
  33691. return e.cmp(t) < 0 ? e : t
  33692. }, a.prototype._init = function(e, t, i) {
  33693. if ("number" == typeof e) return this._initNumber(e, t, i);
  33694. if ("object" == typeof e) return this._initArray(e, t, i);
  33695. "hex" === t && (t = 16), r(t === (0 | t) && t >= 2 && t <= 36);
  33696. var n = 0;
  33697. "-" === (e = e.toString().replace(/\s+/g, ""))[0] && (n++, this.negative = 1), n < e.length && (
  33698. 16 === t ? this._parseHex(e, n, i) : (this._parseBase(e, t, n), "le" === i && this._initArray(
  33699. this.toArray(), t, i)))
  33700. }, a.prototype._initNumber = function(e, t, i) {
  33701. e < 0 && (this.negative = 1, e = -e), e < 67108864 ? (this.words = [67108863 & e], this.length =
  33702. 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], this
  33703. .length = 2) : (r(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863,
  33704. 1
  33705. ], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i)
  33706. }, a.prototype._initArray = function(e, t, i) {
  33707. if (r("number" == typeof e.length), e.length <= 0) return this.words = [0], this.length = 1, this;
  33708. this.length = Math.ceil(e.length / 3), this.words = new Array(this.length);
  33709. for (var n = 0; n < this.length; n++) this.words[n] = 0;
  33710. var a, s, o = 0;
  33711. if ("be" === i)
  33712. for (n = e.length - 1, a = 0; n >= 0; n -= 3) s = e[n] | e[n - 1] << 8 | e[n - 2] << 16, this
  33713. .words[a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >=
  33714. 26 && (o -= 26, a++);
  33715. else if ("le" === i)
  33716. for (n = 0, a = 0; n < e.length; n += 3) s = e[n] | e[n + 1] << 8 | e[n + 2] << 16, this.words[
  33717. a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && (
  33718. o -= 26, a++);
  33719. return this._strip()
  33720. }, a.prototype._parseHex = function(e, t, i) {
  33721. this.length = Math.ceil((e.length - t) / 6), this.words = new Array(this.length);
  33722. for (var r = 0; r < this.length; r++) this.words[r] = 0;
  33723. var n, a = 0,
  33724. s = 0;
  33725. if ("be" === i)
  33726. for (r = e.length - 1; r >= t; r -= 2) n = u(e, t, r) << a, this.words[s] |= 67108863 & n, a >=
  33727. 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8;
  33728. else
  33729. for (r = (e.length - t) % 2 == 0 ? t + 1 : t; r < e.length; r += 2) n = u(e, t, r) << a, this
  33730. .words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8;
  33731. this._strip()
  33732. }, a.prototype._parseBase = function(e, t, i) {
  33733. this.words = [0], this.length = 1;
  33734. for (var r = 0, n = 1; n <= 67108863; n *= t) r++;
  33735. r--, n = n / t | 0;
  33736. for (var a = e.length - i, s = a % r, o = Math.min(a, a - s) + i, u = 0, d = i; d < o; d += r) u =
  33737. l(e, d, d + r, t), this.imuln(n), this.words[0] + u < 67108864 ? this.words[0] += u : this
  33738. ._iaddn(u);
  33739. if (0 !== s) {
  33740. var c = 1;
  33741. for (u = l(e, d, e.length, t), d = 0; d < s; d++) c *= t;
  33742. this.imuln(c), this.words[0] + u < 67108864 ? this.words[0] += u : this._iaddn(u)
  33743. }
  33744. this._strip()
  33745. }, a.prototype.copy = function(e) {
  33746. e.words = new Array(this.length);
  33747. for (var t = 0; t < this.length; t++) e.words[t] = this.words[t];
  33748. e.length = this.length, e.negative = this.negative, e.red = this.red
  33749. }, a.prototype._move = function(e) {
  33750. d(e, this)
  33751. }, a.prototype.clone = function() {
  33752. var e = new a(null);
  33753. return this.copy(e), e
  33754. }, a.prototype._expand = function(e) {
  33755. for (; this.length < e;) this.words[this.length++] = 0;
  33756. return this
  33757. }, a.prototype._strip = function() {
  33758. for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--;
  33759. return this._normSign()
  33760. }, a.prototype._normSign = function() {
  33761. return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this
  33762. }, "undefined" != typeof Symbol && "function" == typeof Symbol.for) try {
  33763. a.prototype[Symbol.for("nodejs.util.inspect.custom")] = c
  33764. } catch (e) {
  33765. a.prototype.inspect = c
  33766. } else a.prototype.inspect = c;
  33767. function c() {
  33768. return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">"
  33769. }
  33770. var h = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000",
  33771. "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000",
  33772. "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000",
  33773. "00000000000000000000", "000000000000000000000", "0000000000000000000000",
  33774. "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000"
  33775. ],
  33776. f = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  33777. 5, 5, 5, 5, 5, 5, 5
  33778. ],
  33779. p = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7,
  33780. 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6,
  33781. 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5,
  33782. 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  33783. ];
  33784. function m(e, t, i) {
  33785. i.negative = t.negative ^ e.negative;
  33786. var r = e.length + t.length | 0;
  33787. i.length = r, r = r - 1 | 0;
  33788. var n = 0 | e.words[0],
  33789. a = 0 | t.words[0],
  33790. s = n * a,
  33791. o = 67108863 & s,
  33792. u = s / 67108864 | 0;
  33793. i.words[0] = o;
  33794. for (var l = 1; l < r; l++) {
  33795. for (var d = u >>> 26, c = 67108863 & u, h = Math.min(l, t.length - 1), f = Math.max(0, l - e
  33796. .length + 1); f <= h; f++) {
  33797. var p = l - f | 0;
  33798. d += (s = (n = 0 | e.words[p]) * (a = 0 | t.words[f]) + c) / 67108864 | 0, c = 67108863 & s
  33799. }
  33800. i.words[l] = 0 | c, u = 0 | d
  33801. }
  33802. return 0 !== u ? i.words[l] = 0 | u : i.length--, i._strip()
  33803. }
  33804. a.prototype.toString = function(e, t) {
  33805. var i;
  33806. if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) {
  33807. i = "";
  33808. for (var n = 0, a = 0, s = 0; s < this.length; s++) {
  33809. var o = this.words[s],
  33810. u = (16777215 & (o << n | a)).toString(16);
  33811. a = o >>> 24 - n & 16777215, (n += 2) >= 26 && (n -= 26, s--), i = 0 !== a || s !== this
  33812. .length - 1 ? h[6 - u.length] + u + i : u + i
  33813. }
  33814. for (0 !== a && (i = a.toString(16) + i); i.length % t != 0;) i = "0" + i;
  33815. return 0 !== this.negative && (i = "-" + i), i
  33816. }
  33817. if (e === (0 | e) && e >= 2 && e <= 36) {
  33818. var l = f[e],
  33819. d = p[e];
  33820. i = "";
  33821. var c = this.clone();
  33822. for (c.negative = 0; !c.isZero();) {
  33823. var m = c.modrn(d).toString(e);
  33824. i = (c = c.idivn(d)).isZero() ? m + i : h[l - m.length] + m + i
  33825. }
  33826. for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i;
  33827. return 0 !== this.negative && (i = "-" + i), i
  33828. }
  33829. r(!1, "Base should be between 2 and 36")
  33830. }, a.prototype.toNumber = function() {
  33831. var e = this.words[0];
  33832. return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[
  33833. 2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(!1,
  33834. "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e
  33835. }, a.prototype.toJSON = function() {
  33836. return this.toString(16, 2)
  33837. }, s && (a.prototype.toBuffer = function(e, t) {
  33838. return this.toArrayLike(s, e, t)
  33839. }), a.prototype.toArray = function(e, t) {
  33840. return this.toArrayLike(Array, e, t)
  33841. }, a.prototype.toArrayLike = function(e, t, i) {
  33842. this._strip();
  33843. var n = this.byteLength(),
  33844. a = i || Math.max(1, n);
  33845. r(n <= a, "byte array longer than desired length"), r(a > 0, "Requested array length <= 0");
  33846. var s = function(e, t) {
  33847. return e.allocUnsafe ? e.allocUnsafe(t) : new e(t)
  33848. }(e, a);
  33849. return this["_toArrayLike" + ("le" === t ? "LE" : "BE")](s, n), s
  33850. }, a.prototype._toArrayLikeLE = function(e, t) {
  33851. for (var i = 0, r = 0, n = 0, a = 0; n < this.length; n++) {
  33852. var s = this.words[n] << a | r;
  33853. e[i++] = 255 & s, i < e.length && (e[i++] = s >> 8 & 255), i < e.length && (e[i++] = s >> 16 &
  33854. 255), 6 === a ? (i < e.length && (e[i++] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24,
  33855. a += 2)
  33856. }
  33857. if (i < e.length)
  33858. for (e[i++] = r; i < e.length;) e[i++] = 0
  33859. }, a.prototype._toArrayLikeBE = function(e, t) {
  33860. for (var i = e.length - 1, r = 0, n = 0, a = 0; n < this.length; n++) {
  33861. var s = this.words[n] << a | r;
  33862. e[i--] = 255 & s, i >= 0 && (e[i--] = s >> 8 & 255), i >= 0 && (e[i--] = s >> 16 & 255), 6 ===
  33863. a ? (i >= 0 && (e[i--] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24, a += 2)
  33864. }
  33865. if (i >= 0)
  33866. for (e[i--] = r; i >= 0;) e[i--] = 0
  33867. }, Math.clz32 ? a.prototype._countBits = function(e) {
  33868. return 32 - Math.clz32(e)
  33869. } : a.prototype._countBits = function(e) {
  33870. var t = e,
  33871. i = 0;
  33872. return t >= 4096 && (i += 13, t >>>= 13), t >= 64 && (i += 7, t >>>= 7), t >= 8 && (i += 4, t >>>=
  33873. 4), t >= 2 && (i += 2, t >>>= 2), i + t
  33874. }, a.prototype._zeroBits = function(e) {
  33875. if (0 === e) return 26;
  33876. var t = e,
  33877. i = 0;
  33878. return 0 == (8191 & t) && (i += 13, t >>>= 13), 0 == (127 & t) && (i += 7, t >>>= 7), 0 == (15 &
  33879. t) && (i += 4, t >>>= 4), 0 == (3 & t) && (i += 2, t >>>= 2), 0 == (1 & t) && i++, i
  33880. }, a.prototype.bitLength = function() {
  33881. var e = this.words[this.length - 1],
  33882. t = this._countBits(e);
  33883. return 26 * (this.length - 1) + t
  33884. }, a.prototype.zeroBits = function() {
  33885. if (this.isZero()) return 0;
  33886. for (var e = 0, t = 0; t < this.length; t++) {
  33887. var i = this._zeroBits(this.words[t]);
  33888. if (e += i, 26 !== i) break
  33889. }
  33890. return e
  33891. }, a.prototype.byteLength = function() {
  33892. return Math.ceil(this.bitLength() / 8)
  33893. }, a.prototype.toTwos = function(e) {
  33894. return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone()
  33895. }, a.prototype.fromTwos = function(e) {
  33896. return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone()
  33897. }, a.prototype.isNeg = function() {
  33898. return 0 !== this.negative
  33899. }, a.prototype.neg = function() {
  33900. return this.clone().ineg()
  33901. }, a.prototype.ineg = function() {
  33902. return this.isZero() || (this.negative ^= 1), this
  33903. }, a.prototype.iuor = function(e) {
  33904. for (; this.length < e.length;) this.words[this.length++] = 0;
  33905. for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t];
  33906. return this._strip()
  33907. }, a.prototype.ior = function(e) {
  33908. return r(0 == (this.negative | e.negative)), this.iuor(e)
  33909. }, a.prototype.or = function(e) {
  33910. return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this)
  33911. }, a.prototype.uor = function(e) {
  33912. return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this)
  33913. }, a.prototype.iuand = function(e) {
  33914. var t;
  33915. t = this.length > e.length ? e : this;
  33916. for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i];
  33917. return this.length = t.length, this._strip()
  33918. }, a.prototype.iand = function(e) {
  33919. return r(0 == (this.negative | e.negative)), this.iuand(e)
  33920. }, a.prototype.and = function(e) {
  33921. return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this)
  33922. }, a.prototype.uand = function(e) {
  33923. return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this)
  33924. }, a.prototype.iuxor = function(e) {
  33925. var t, i;
  33926. this.length > e.length ? (t = this, i = e) : (t = e, i = this);
  33927. for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r];
  33928. if (this !== t)
  33929. for (; r < t.length; r++) this.words[r] = t.words[r];
  33930. return this.length = t.length, this._strip()
  33931. }, a.prototype.ixor = function(e) {
  33932. return r(0 == (this.negative | e.negative)), this.iuxor(e)
  33933. }, a.prototype.xor = function(e) {
  33934. return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this)
  33935. }, a.prototype.uxor = function(e) {
  33936. return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this)
  33937. }, a.prototype.inotn = function(e) {
  33938. r("number" == typeof e && e >= 0);
  33939. var t = 0 | Math.ceil(e / 26),
  33940. i = e % 26;
  33941. this._expand(t), i > 0 && t--;
  33942. for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n];
  33943. return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), this._strip()
  33944. }, a.prototype.notn = function(e) {
  33945. return this.clone().inotn(e)
  33946. }, a.prototype.setn = function(e, t) {
  33947. r("number" == typeof e && e >= 0);
  33948. var i = e / 26 | 0,
  33949. n = e % 26;
  33950. return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 <<
  33951. n), this._strip()
  33952. }, a.prototype.iadd = function(e) {
  33953. var t, i, r;
  33954. if (0 !== this.negative && 0 === e.negative) return this.negative = 0, t = this.isub(e), this
  33955. .negative ^= 1, this._normSign();
  33956. if (0 === this.negative && 0 !== e.negative) return e.negative = 0, t = this.isub(e), e.negative =
  33957. 1, t._normSign();
  33958. this.length > e.length ? (i = this, r = e) : (i = e, r = this);
  33959. for (var n = 0, a = 0; a < r.length; a++) t = (0 | i.words[a]) + (0 | r.words[a]) + n, this.words[
  33960. a] = 67108863 & t, n = t >>> 26;
  33961. for (; 0 !== n && a < i.length; a++) t = (0 | i.words[a]) + n, this.words[a] = 67108863 & t, n =
  33962. t >>> 26;
  33963. if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++;
  33964. else if (i !== this)
  33965. for (; a < i.length; a++) this.words[a] = i.words[a];
  33966. return this
  33967. }, a.prototype.add = function(e) {
  33968. var t;
  33969. return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, t = this.sub(e), e.negative ^=
  33970. 1, t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, t = e.sub(this), this
  33971. .negative = 1, t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this)
  33972. }, a.prototype.isub = function(e) {
  33973. if (0 !== e.negative) {
  33974. e.negative = 0;
  33975. var t = this.iadd(e);
  33976. return e.negative = 1, t._normSign()
  33977. }
  33978. if (0 !== this.negative) return this.negative = 0, this.iadd(e), this.negative = 1, this
  33979. ._normSign();
  33980. var i, r, n = this.cmp(e);
  33981. if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this;
  33982. n > 0 ? (i = this, r = e) : (i = e, r = this);
  33983. for (var a = 0, s = 0; s < r.length; s++) a = (t = (0 | i.words[s]) - (0 | r.words[s]) + a) >> 26,
  33984. this.words[s] = 67108863 & t;
  33985. for (; 0 !== a && s < i.length; s++) a = (t = (0 | i.words[s]) + a) >> 26, this.words[s] =
  33986. 67108863 & t;
  33987. if (0 === a && s < i.length && i !== this)
  33988. for (; s < i.length; s++) this.words[s] = i.words[s];
  33989. return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this._strip()
  33990. }, a.prototype.sub = function(e) {
  33991. return this.clone().isub(e)
  33992. };
  33993. var g = function(e, t, i) {
  33994. var r, n, a, s = e.words,
  33995. o = t.words,
  33996. u = i.words,
  33997. l = 0,
  33998. d = 0 | s[0],
  33999. c = 8191 & d,
  34000. h = d >>> 13,
  34001. f = 0 | s[1],
  34002. p = 8191 & f,
  34003. m = f >>> 13,
  34004. g = 0 | s[2],
  34005. v = 8191 & g,
  34006. y = g >>> 13,
  34007. _ = 0 | s[3],
  34008. b = 8191 & _,
  34009. w = _ >>> 13,
  34010. E = 0 | s[4],
  34011. T = 8191 & E,
  34012. S = E >>> 13,
  34013. A = 0 | s[5],
  34014. k = 8191 & A,
  34015. R = A >>> 13,
  34016. M = 0 | s[6],
  34017. O = 8191 & M,
  34018. C = M >>> 13,
  34019. D = 0 | s[7],
  34020. I = 8191 & D,
  34021. L = D >>> 13,
  34022. x = 0 | s[8],
  34023. P = 8191 & x,
  34024. U = x >>> 13,
  34025. N = 0 | s[9],
  34026. B = 8191 & N,
  34027. F = N >>> 13,
  34028. j = 0 | o[0],
  34029. H = 8191 & j,
  34030. G = j >>> 13,
  34031. V = 0 | o[1],
  34032. W = 8191 & V,
  34033. q = V >>> 13,
  34034. X = 0 | o[2],
  34035. z = 8191 & X,
  34036. K = X >>> 13,
  34037. Y = 0 | o[3],
  34038. Q = 8191 & Y,
  34039. J = Y >>> 13,
  34040. Z = 0 | o[4],
  34041. $ = 8191 & Z,
  34042. ee = Z >>> 13,
  34043. te = 0 | o[5],
  34044. ie = 8191 & te,
  34045. re = te >>> 13,
  34046. ne = 0 | o[6],
  34047. ae = 8191 & ne,
  34048. se = ne >>> 13,
  34049. oe = 0 | o[7],
  34050. ue = 8191 & oe,
  34051. le = oe >>> 13,
  34052. de = 0 | o[8],
  34053. ce = 8191 & de,
  34054. he = de >>> 13,
  34055. fe = 0 | o[9],
  34056. pe = 8191 & fe,
  34057. me = fe >>> 13;
  34058. i.negative = e.negative ^ t.negative, i.length = 19;
  34059. var ge = (l + (r = Math.imul(c, H)) | 0) + ((8191 & (n = (n = Math.imul(c, G)) + Math.imul(h, H) |
  34060. 0)) << 13) | 0;
  34061. l = ((a = Math.imul(h, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p,
  34062. H), n = (n = Math.imul(p, G)) + Math.imul(m, H) | 0, a = Math.imul(m, G);
  34063. var ve = (l + (r = r + Math.imul(c, W) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, q) | 0) +
  34064. Math.imul(h, W) | 0)) << 13) | 0;
  34065. l = ((a = a + Math.imul(h, q) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math
  34066. .imul(v, H), n = (n = Math.imul(v, G)) + Math.imul(y, H) | 0, a = Math.imul(y, G), r = r + Math
  34067. .imul(p, W) | 0, n = (n = n + Math.imul(p, q) | 0) + Math.imul(m, W) | 0, a = a + Math.imul(m,
  34068. q) | 0;
  34069. var ye = (l + (r = r + Math.imul(c, z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, K) | 0) +
  34070. Math.imul(h, z) | 0)) << 13) | 0;
  34071. l = ((a = a + Math.imul(h, K) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math
  34072. .imul(b, H), n = (n = Math.imul(b, G)) + Math.imul(w, H) | 0, a = Math.imul(w, G), r = r + Math
  34073. .imul(v, W) | 0, n = (n = n + Math.imul(v, q) | 0) + Math.imul(y, W) | 0, a = a + Math.imul(y,
  34074. q) | 0, r = r + Math.imul(p, z) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, z) | 0,
  34075. a = a + Math.imul(m, K) | 0;
  34076. var _e = (l + (r = r + Math.imul(c, Q) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, J) | 0) +
  34077. Math.imul(h, Q) | 0)) << 13) | 0;
  34078. l = ((a = a + Math.imul(h, J) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math
  34079. .imul(T, H), n = (n = Math.imul(T, G)) + Math.imul(S, H) | 0, a = Math.imul(S, G), r = r + Math
  34080. .imul(b, W) | 0, n = (n = n + Math.imul(b, q) | 0) + Math.imul(w, W) | 0, a = a + Math.imul(w,
  34081. q) | 0, r = r + Math.imul(v, z) | 0, n = (n = n + Math.imul(v, K) | 0) + Math.imul(y, z) | 0,
  34082. a = a + Math.imul(y, K) | 0, r = r + Math.imul(p, Q) | 0, n = (n = n + Math.imul(p, J) | 0) +
  34083. Math.imul(m, Q) | 0, a = a + Math.imul(m, J) | 0;
  34084. var be = (l + (r = r + Math.imul(c, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, ee) | 0) +
  34085. Math.imul(h, $) | 0)) << 13) | 0;
  34086. l = ((a = a + Math.imul(h, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math
  34087. .imul(k, H), n = (n = Math.imul(k, G)) + Math.imul(R, H) | 0, a = Math.imul(R, G), r = r + Math
  34088. .imul(T, W) | 0, n = (n = n + Math.imul(T, q) | 0) + Math.imul(S, W) | 0, a = a + Math.imul(S,
  34089. q) | 0, r = r + Math.imul(b, z) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(w, z) | 0,
  34090. a = a + Math.imul(w, K) | 0, r = r + Math.imul(v, Q) | 0, n = (n = n + Math.imul(v, J) | 0) +
  34091. Math.imul(y, Q) | 0, a = a + Math.imul(y, J) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math
  34092. .imul(p, ee) | 0) + Math.imul(m, $) | 0, a = a + Math.imul(m, ee) | 0;
  34093. var we = (l + (r = r + Math.imul(c, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, re) | 0) +
  34094. Math.imul(h, ie) | 0)) << 13) | 0;
  34095. l = ((a = a + Math.imul(h, re) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math
  34096. .imul(O, H), n = (n = Math.imul(O, G)) + Math.imul(C, H) | 0, a = Math.imul(C, G), r = r + Math
  34097. .imul(k, W) | 0, n = (n = n + Math.imul(k, q) | 0) + Math.imul(R, W) | 0, a = a + Math.imul(R,
  34098. q) | 0, r = r + Math.imul(T, z) | 0, n = (n = n + Math.imul(T, K) | 0) + Math.imul(S, z) | 0,
  34099. a = a + Math.imul(S, K) | 0, r = r + Math.imul(b, Q) | 0, n = (n = n + Math.imul(b, J) | 0) +
  34100. Math.imul(w, Q) | 0, a = a + Math.imul(w, J) | 0, r = r + Math.imul(v, $) | 0, n = (n = n + Math
  34101. .imul(v, ee) | 0) + Math.imul(y, $) | 0, a = a + Math.imul(y, ee) | 0, r = r + Math.imul(p,
  34102. ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, a = a + Math.imul(m, re) |
  34103. 0;
  34104. var Ee = (l + (r = r + Math.imul(c, ae) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, se) | 0) +
  34105. Math.imul(h, ae) | 0)) << 13) | 0;
  34106. l = ((a = a + Math.imul(h, se) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math
  34107. .imul(I, H), n = (n = Math.imul(I, G)) + Math.imul(L, H) | 0, a = Math.imul(L, G), r = r + Math
  34108. .imul(O, W) | 0, n = (n = n + Math.imul(O, q) | 0) + Math.imul(C, W) | 0, a = a + Math.imul(C,
  34109. q) | 0, r = r + Math.imul(k, z) | 0, n = (n = n + Math.imul(k, K) | 0) + Math.imul(R, z) | 0,
  34110. a = a + Math.imul(R, K) | 0, r = r + Math.imul(T, Q) | 0, n = (n = n + Math.imul(T, J) | 0) +
  34111. Math.imul(S, Q) | 0, a = a + Math.imul(S, J) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math
  34112. .imul(b, ee) | 0) + Math.imul(w, $) | 0, a = a + Math.imul(w, ee) | 0, r = r + Math.imul(v,
  34113. ie) | 0, n = (n = n + Math.imul(v, re) | 0) + Math.imul(y, ie) | 0, a = a + Math.imul(y, re) |
  34114. 0, r = r + Math.imul(p, ae) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, ae) | 0, a =
  34115. a + Math.imul(m, se) | 0;
  34116. var Te = (l + (r = r + Math.imul(c, ue) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, le) | 0) +
  34117. Math.imul(h, ue) | 0)) << 13) | 0;
  34118. l = ((a = a + Math.imul(h, le) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math
  34119. .imul(P, H), n = (n = Math.imul(P, G)) + Math.imul(U, H) | 0, a = Math.imul(U, G), r = r + Math
  34120. .imul(I, W) | 0, n = (n = n + Math.imul(I, q) | 0) + Math.imul(L, W) | 0, a = a + Math.imul(L,
  34121. q) | 0, r = r + Math.imul(O, z) | 0, n = (n = n + Math.imul(O, K) | 0) + Math.imul(C, z) | 0,
  34122. a = a + Math.imul(C, K) | 0, r = r + Math.imul(k, Q) | 0, n = (n = n + Math.imul(k, J) | 0) +
  34123. Math.imul(R, Q) | 0, a = a + Math.imul(R, J) | 0, r = r + Math.imul(T, $) | 0, n = (n = n + Math
  34124. .imul(T, ee) | 0) + Math.imul(S, $) | 0, a = a + Math.imul(S, ee) | 0, r = r + Math.imul(b,
  34125. ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(w, ie) | 0, a = a + Math.imul(w, re) |
  34126. 0, r = r + Math.imul(v, ae) | 0, n = (n = n + Math.imul(v, se) | 0) + Math.imul(y, ae) | 0, a =
  34127. a + Math.imul(y, se) | 0, r = r + Math.imul(p, ue) | 0, n = (n = n + Math.imul(p, le) | 0) +
  34128. Math.imul(m, ue) | 0, a = a + Math.imul(m, le) | 0;
  34129. var Se = (l + (r = r + Math.imul(c, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, he) | 0) +
  34130. Math.imul(h, ce) | 0)) << 13) | 0;
  34131. l = ((a = a + Math.imul(h, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math
  34132. .imul(B, H), n = (n = Math.imul(B, G)) + Math.imul(F, H) | 0, a = Math.imul(F, G), r = r + Math
  34133. .imul(P, W) | 0, n = (n = n + Math.imul(P, q) | 0) + Math.imul(U, W) | 0, a = a + Math.imul(U,
  34134. q) | 0, r = r + Math.imul(I, z) | 0, n = (n = n + Math.imul(I, K) | 0) + Math.imul(L, z) | 0,
  34135. a = a + Math.imul(L, K) | 0, r = r + Math.imul(O, Q) | 0, n = (n = n + Math.imul(O, J) | 0) +
  34136. Math.imul(C, Q) | 0, a = a + Math.imul(C, J) | 0, r = r + Math.imul(k, $) | 0, n = (n = n + Math
  34137. .imul(k, ee) | 0) + Math.imul(R, $) | 0, a = a + Math.imul(R, ee) | 0, r = r + Math.imul(T,
  34138. ie) | 0, n = (n = n + Math.imul(T, re) | 0) + Math.imul(S, ie) | 0, a = a + Math.imul(S, re) |
  34139. 0, r = r + Math.imul(b, ae) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(w, ae) | 0, a =
  34140. a + Math.imul(w, se) | 0, r = r + Math.imul(v, ue) | 0, n = (n = n + Math.imul(v, le) | 0) +
  34141. Math.imul(y, ue) | 0, a = a + Math.imul(y, le) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n +
  34142. Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, a = a + Math.imul(m, he) | 0;
  34143. var Ae = (l + (r = r + Math.imul(c, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, me) | 0) +
  34144. Math.imul(h, pe) | 0)) << 13) | 0;
  34145. l = ((a = a + Math.imul(h, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math
  34146. .imul(B, W), n = (n = Math.imul(B, q)) + Math.imul(F, W) | 0, a = Math.imul(F, q), r = r + Math
  34147. .imul(P, z) | 0, n = (n = n + Math.imul(P, K) | 0) + Math.imul(U, z) | 0, a = a + Math.imul(U,
  34148. K) | 0, r = r + Math.imul(I, Q) | 0, n = (n = n + Math.imul(I, J) | 0) + Math.imul(L, Q) | 0,
  34149. a = a + Math.imul(L, J) | 0, r = r + Math.imul(O, $) | 0, n = (n = n + Math.imul(O, ee) | 0) +
  34150. Math.imul(C, $) | 0, a = a + Math.imul(C, ee) | 0, r = r + Math.imul(k, ie) | 0, n = (n = n +
  34151. Math.imul(k, re) | 0) + Math.imul(R, ie) | 0, a = a + Math.imul(R, re) | 0, r = r + Math.imul(
  34152. T, ae) | 0, n = (n = n + Math.imul(T, se) | 0) + Math.imul(S, ae) | 0, a = a + Math.imul(S,
  34153. se) | 0, r = r + Math.imul(b, ue) | 0, n = (n = n + Math.imul(b, le) | 0) + Math.imul(w, ue) |
  34154. 0, a = a + Math.imul(w, le) | 0, r = r + Math.imul(v, ce) | 0, n = (n = n + Math.imul(v, he) |
  34155. 0) + Math.imul(y, ce) | 0, a = a + Math.imul(y, he) | 0;
  34156. var ke = (l + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) +
  34157. Math.imul(m, pe) | 0)) << 13) | 0;
  34158. l = ((a = a + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (ke >>> 26) | 0, ke &= 67108863, r = Math
  34159. .imul(B, z), n = (n = Math.imul(B, K)) + Math.imul(F, z) | 0, a = Math.imul(F, K), r = r + Math
  34160. .imul(P, Q) | 0, n = (n = n + Math.imul(P, J) | 0) + Math.imul(U, Q) | 0, a = a + Math.imul(U,
  34161. J) | 0, r = r + Math.imul(I, $) | 0, n = (n = n + Math.imul(I, ee) | 0) + Math.imul(L, $) | 0,
  34162. a = a + Math.imul(L, ee) | 0, r = r + Math.imul(O, ie) | 0, n = (n = n + Math.imul(O, re) | 0) +
  34163. Math.imul(C, ie) | 0, a = a + Math.imul(C, re) | 0, r = r + Math.imul(k, ae) | 0, n = (n = n +
  34164. Math.imul(k, se) | 0) + Math.imul(R, ae) | 0, a = a + Math.imul(R, se) | 0, r = r + Math.imul(
  34165. T, ue) | 0, n = (n = n + Math.imul(T, le) | 0) + Math.imul(S, ue) | 0, a = a + Math.imul(S,
  34166. le) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(w, ce) |
  34167. 0, a = a + Math.imul(w, he) | 0;
  34168. var Re = (l + (r = r + Math.imul(v, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(v, me) | 0) +
  34169. Math.imul(y, pe) | 0)) << 13) | 0;
  34170. l = ((a = a + Math.imul(y, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math
  34171. .imul(B, Q), n = (n = Math.imul(B, J)) + Math.imul(F, Q) | 0, a = Math.imul(F, J), r = r + Math
  34172. .imul(P, $) | 0, n = (n = n + Math.imul(P, ee) | 0) + Math.imul(U, $) | 0, a = a + Math.imul(U,
  34173. ee) | 0, r = r + Math.imul(I, ie) | 0, n = (n = n + Math.imul(I, re) | 0) + Math.imul(L, ie) |
  34174. 0, a = a + Math.imul(L, re) | 0, r = r + Math.imul(O, ae) | 0, n = (n = n + Math.imul(O, se) |
  34175. 0) + Math.imul(C, ae) | 0, a = a + Math.imul(C, se) | 0, r = r + Math.imul(k, ue) | 0, n = (
  34176. n = n + Math.imul(k, le) | 0) + Math.imul(R, ue) | 0, a = a + Math.imul(R, le) | 0, r = r +
  34177. Math.imul(T, ce) | 0, n = (n = n + Math.imul(T, he) | 0) + Math.imul(S, ce) | 0, a = a + Math
  34178. .imul(S, he) | 0;
  34179. var Me = (l + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) +
  34180. Math.imul(w, pe) | 0)) << 13) | 0;
  34181. l = ((a = a + Math.imul(w, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math
  34182. .imul(B, $), n = (n = Math.imul(B, ee)) + Math.imul(F, $) | 0, a = Math.imul(F, ee), r = r +
  34183. Math.imul(P, ie) | 0, n = (n = n + Math.imul(P, re) | 0) + Math.imul(U, ie) | 0, a = a + Math
  34184. .imul(U, re) | 0, r = r + Math.imul(I, ae) | 0, n = (n = n + Math.imul(I, se) | 0) + Math.imul(
  34185. L, ae) | 0, a = a + Math.imul(L, se) | 0, r = r + Math.imul(O, ue) | 0, n = (n = n + Math
  34186. .imul(O, le) | 0) + Math.imul(C, ue) | 0, a = a + Math.imul(C, le) | 0, r = r + Math.imul(k,
  34187. ce) | 0, n = (n = n + Math.imul(k, he) | 0) + Math.imul(R, ce) | 0, a = a + Math.imul(R, he) |
  34188. 0;
  34189. var Oe = (l + (r = r + Math.imul(T, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(T, me) | 0) +
  34190. Math.imul(S, pe) | 0)) << 13) | 0;
  34191. l = ((a = a + Math.imul(S, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863, r = Math
  34192. .imul(B, ie), n = (n = Math.imul(B, re)) + Math.imul(F, ie) | 0, a = Math.imul(F, re), r = r +
  34193. Math.imul(P, ae) | 0, n = (n = n + Math.imul(P, se) | 0) + Math.imul(U, ae) | 0, a = a + Math
  34194. .imul(U, se) | 0, r = r + Math.imul(I, ue) | 0, n = (n = n + Math.imul(I, le) | 0) + Math.imul(
  34195. L, ue) | 0, a = a + Math.imul(L, le) | 0, r = r + Math.imul(O, ce) | 0, n = (n = n + Math
  34196. .imul(O, he) | 0) + Math.imul(C, ce) | 0, a = a + Math.imul(C, he) | 0;
  34197. var Ce = (l + (r = r + Math.imul(k, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(k, me) | 0) +
  34198. Math.imul(R, pe) | 0)) << 13) | 0;
  34199. l = ((a = a + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math
  34200. .imul(B, ae), n = (n = Math.imul(B, se)) + Math.imul(F, ae) | 0, a = Math.imul(F, se), r = r +
  34201. Math.imul(P, ue) | 0, n = (n = n + Math.imul(P, le) | 0) + Math.imul(U, ue) | 0, a = a + Math
  34202. .imul(U, le) | 0, r = r + Math.imul(I, ce) | 0, n = (n = n + Math.imul(I, he) | 0) + Math.imul(
  34203. L, ce) | 0, a = a + Math.imul(L, he) | 0;
  34204. var De = (l + (r = r + Math.imul(O, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(O, me) | 0) +
  34205. Math.imul(C, pe) | 0)) << 13) | 0;
  34206. l = ((a = a + Math.imul(C, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math
  34207. .imul(B, ue), n = (n = Math.imul(B, le)) + Math.imul(F, ue) | 0, a = Math.imul(F, le), r = r +
  34208. Math.imul(P, ce) | 0, n = (n = n + Math.imul(P, he) | 0) + Math.imul(U, ce) | 0, a = a + Math
  34209. .imul(U, he) | 0;
  34210. var Ie = (l + (r = r + Math.imul(I, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(I, me) | 0) +
  34211. Math.imul(L, pe) | 0)) << 13) | 0;
  34212. l = ((a = a + Math.imul(L, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math
  34213. .imul(B, ce), n = (n = Math.imul(B, he)) + Math.imul(F, ce) | 0, a = Math.imul(F, he);
  34214. var Le = (l + (r = r + Math.imul(P, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(P, me) | 0) +
  34215. Math.imul(U, pe) | 0)) << 13) | 0;
  34216. l = ((a = a + Math.imul(U, me) | 0) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863;
  34217. var xe = (l + (r = Math.imul(B, pe)) | 0) + ((8191 & (n = (n = Math.imul(B, me)) + Math.imul(F,
  34218. pe) | 0)) << 13) | 0;
  34219. return l = ((a = Math.imul(F, me)) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, u[0] = ge,
  34220. u[1] = ve, u[2] = ye, u[3] = _e, u[4] = be, u[5] = we, u[6] = Ee, u[7] = Te, u[8] = Se, u[9] =
  34221. Ae, u[10] = ke, u[11] = Re, u[12] = Me, u[13] = Oe, u[14] = Ce, u[15] = De, u[16] = Ie, u[17] =
  34222. Le, u[18] = xe, 0 !== l && (u[19] = l, i.length++), i
  34223. };
  34224. function v(e, t, i) {
  34225. i.negative = t.negative ^ e.negative, i.length = e.length + t.length;
  34226. for (var r = 0, n = 0, a = 0; a < i.length - 1; a++) {
  34227. var s = n;
  34228. n = 0;
  34229. for (var o = 67108863 & r, u = Math.min(a, t.length - 1), l = Math.max(0, a - e.length + 1); l <=
  34230. u; l++) {
  34231. var d = a - l,
  34232. c = (0 | e.words[d]) * (0 | t.words[l]),
  34233. h = 67108863 & c;
  34234. o = 67108863 & (h = h + o | 0), n += (s = (s = s + (c / 67108864 | 0) | 0) + (h >>> 26) | 0) >>>
  34235. 26, s &= 67108863
  34236. }
  34237. i.words[a] = o, r = s, s = n
  34238. }
  34239. return 0 !== r ? i.words[a] = r : i.length--, i._strip()
  34240. }
  34241. function y(e, t, i) {
  34242. return v(e, t, i)
  34243. }
  34244. function _(e, t) {
  34245. this.x = e, this.y = t
  34246. }
  34247. Math.imul || (g = m), a.prototype.mulTo = function(e, t) {
  34248. var i = this.length + e.length;
  34249. return 10 === this.length && 10 === e.length ? g(this, e, t) : i < 63 ? m(this, e, t) : i < 1024 ?
  34250. v(this, e, t) : y(this, e, t)
  34251. }, _.prototype.makeRBT = function(e) {
  34252. for (var t = new Array(e), i = a.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this
  34253. .revBin(r, i, e);
  34254. return t
  34255. }, _.prototype.revBin = function(e, t, i) {
  34256. if (0 === e || e === i - 1) return e;
  34257. for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1;
  34258. return r
  34259. }, _.prototype.permute = function(e, t, i, r, n, a) {
  34260. for (var s = 0; s < a; s++) r[s] = t[e[s]], n[s] = i[e[s]]
  34261. }, _.prototype.transform = function(e, t, i, r, n, a) {
  34262. this.permute(a, e, t, i, r, n);
  34263. for (var s = 1; s < n; s <<= 1)
  34264. for (var o = s << 1, u = Math.cos(2 * Math.PI / o), l = Math.sin(2 * Math.PI / o), d = 0; d <
  34265. n; d += o)
  34266. for (var c = u, h = l, f = 0; f < s; f++) {
  34267. var p = i[d + f],
  34268. m = r[d + f],
  34269. g = i[d + f + s],
  34270. v = r[d + f + s],
  34271. y = c * g - h * v;
  34272. v = c * v + h * g, g = y, i[d + f] = p + g, r[d + f] = m + v, i[d + f + s] = p - g, r[d +
  34273. f + s] = m - v, f !== o && (y = u * c - l * h, h = u * h + l * c, c = y)
  34274. }
  34275. }, _.prototype.guessLen13b = function(e, t) {
  34276. var i = 1 | Math.max(t, e),
  34277. r = 1 & i,
  34278. n = 0;
  34279. for (i = i / 2 | 0; i; i >>>= 1) n++;
  34280. return 1 << n + 1 + r
  34281. }, _.prototype.conjugate = function(e, t, i) {
  34282. if (!(i <= 1))
  34283. for (var r = 0; r < i / 2; r++) {
  34284. var n = e[r];
  34285. e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n
  34286. }
  34287. }, _.prototype.normalize13b = function(e, t) {
  34288. for (var i = 0, r = 0; r < t / 2; r++) {
  34289. var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i;
  34290. e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0
  34291. }
  34292. return e
  34293. }, _.prototype.convert13b = function(e, t, i, n) {
  34294. for (var a = 0, s = 0; s < t; s++) a += 0 | e[s], i[2 * s] = 8191 & a, a >>>= 13, i[2 * s + 1] =
  34295. 8191 & a, a >>>= 13;
  34296. for (s = 2 * t; s < n; ++s) i[s] = 0;
  34297. r(0 === a), r(0 == (-8192 & a))
  34298. }, _.prototype.stub = function(e) {
  34299. for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0;
  34300. return t
  34301. }, _.prototype.mulp = function(e, t, i) {
  34302. var r = 2 * this.guessLen13b(e.length, t.length),
  34303. n = this.makeRBT(r),
  34304. a = this.stub(r),
  34305. s = new Array(r),
  34306. o = new Array(r),
  34307. u = new Array(r),
  34308. l = new Array(r),
  34309. d = new Array(r),
  34310. c = new Array(r),
  34311. h = i.words;
  34312. h.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, l, r),
  34313. this.transform(s, a, o, u, r, n), this.transform(l, a, d, c, r, n);
  34314. for (var f = 0; f < r; f++) {
  34315. var p = o[f] * d[f] - u[f] * c[f];
  34316. u[f] = o[f] * c[f] + u[f] * d[f], o[f] = p
  34317. }
  34318. return this.conjugate(o, u, r), this.transform(o, u, h, a, r, n), this.conjugate(h, a, r), this
  34319. .normalize13b(h, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i
  34320. ._strip()
  34321. }, a.prototype.mul = function(e) {
  34322. var t = new a(null);
  34323. return t.words = new Array(this.length + e.length), this.mulTo(e, t)
  34324. }, a.prototype.mulf = function(e) {
  34325. var t = new a(null);
  34326. return t.words = new Array(this.length + e.length), y(this, e, t)
  34327. }, a.prototype.imul = function(e) {
  34328. return this.clone().mulTo(e, this)
  34329. }, a.prototype.imuln = function(e) {
  34330. var t = e < 0;
  34331. t && (e = -e), r("number" == typeof e), r(e < 67108864);
  34332. for (var i = 0, n = 0; n < this.length; n++) {
  34333. var a = (0 | this.words[n]) * e,
  34334. s = (67108863 & a) + (67108863 & i);
  34335. i >>= 26, i += a / 67108864 | 0, i += s >>> 26, this.words[n] = 67108863 & s
  34336. }
  34337. return 0 !== i && (this.words[n] = i, this.length++), t ? this.ineg() : this
  34338. }, a.prototype.muln = function(e) {
  34339. return this.clone().imuln(e)
  34340. }, a.prototype.sqr = function() {
  34341. return this.mul(this)
  34342. }, a.prototype.isqr = function() {
  34343. return this.imul(this.clone())
  34344. }, a.prototype.pow = function(e) {
  34345. var t = function(e) {
  34346. for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) {
  34347. var r = i / 26 | 0,
  34348. n = i % 26;
  34349. t[i] = e.words[r] >>> n & 1
  34350. }
  34351. return t
  34352. }(e);
  34353. if (0 === t.length) return new a(1);
  34354. for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr());
  34355. if (++r < t.length)
  34356. for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n));
  34357. return i
  34358. }, a.prototype.iushln = function(e) {
  34359. r("number" == typeof e && e >= 0);
  34360. var t, i = e % 26,
  34361. n = (e - i) / 26,
  34362. a = 67108863 >>> 26 - i << 26 - i;
  34363. if (0 !== i) {
  34364. var s = 0;
  34365. for (t = 0; t < this.length; t++) {
  34366. var o = this.words[t] & a,
  34367. u = (0 | this.words[t]) - o << i;
  34368. this.words[t] = u | s, s = o >>> 26 - i
  34369. }
  34370. s && (this.words[t] = s, this.length++)
  34371. }
  34372. if (0 !== n) {
  34373. for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t];
  34374. for (t = 0; t < n; t++) this.words[t] = 0;
  34375. this.length += n
  34376. }
  34377. return this._strip()
  34378. }, a.prototype.ishln = function(e) {
  34379. return r(0 === this.negative), this.iushln(e)
  34380. }, a.prototype.iushrn = function(e, t, i) {
  34381. var n;
  34382. r("number" == typeof e && e >= 0), n = t ? (t - t % 26) / 26 : 0;
  34383. var a = e % 26,
  34384. s = Math.min((e - a) / 26, this.length),
  34385. o = 67108863 ^ 67108863 >>> a << a,
  34386. u = i;
  34387. if (n -= s, n = Math.max(0, n), u) {
  34388. for (var l = 0; l < s; l++) u.words[l] = this.words[l];
  34389. u.length = s
  34390. }
  34391. if (0 === s);
  34392. else if (this.length > s)
  34393. for (this.length -= s, l = 0; l < this.length; l++) this.words[l] = this.words[l + s];
  34394. else this.words[0] = 0, this.length = 1;
  34395. var d = 0;
  34396. for (l = this.length - 1; l >= 0 && (0 !== d || l >= n); l--) {
  34397. var c = 0 | this.words[l];
  34398. this.words[l] = d << 26 - a | c >>> a, d = c & o
  34399. }
  34400. return u && 0 !== d && (u.words[u.length++] = d), 0 === this.length && (this.words[0] = 0, this
  34401. .length = 1), this._strip()
  34402. }, a.prototype.ishrn = function(e, t, i) {
  34403. return r(0 === this.negative), this.iushrn(e, t, i)
  34404. }, a.prototype.shln = function(e) {
  34405. return this.clone().ishln(e)
  34406. }, a.prototype.ushln = function(e) {
  34407. return this.clone().iushln(e)
  34408. }, a.prototype.shrn = function(e) {
  34409. return this.clone().ishrn(e)
  34410. }, a.prototype.ushrn = function(e) {
  34411. return this.clone().iushrn(e)
  34412. }, a.prototype.testn = function(e) {
  34413. r("number" == typeof e && e >= 0);
  34414. var t = e % 26,
  34415. i = (e - t) / 26,
  34416. n = 1 << t;
  34417. return !(this.length <= i || !(this.words[i] & n))
  34418. }, a.prototype.imaskn = function(e) {
  34419. r("number" == typeof e && e >= 0);
  34420. var t = e % 26,
  34421. i = (e - t) / 26;
  34422. if (r(0 === this.negative, "imaskn works only with positive numbers"), this.length <= i)
  34423. return this;
  34424. if (0 !== t && i++, this.length = Math.min(i, this.length), 0 !== t) {
  34425. var n = 67108863 ^ 67108863 >>> t << t;
  34426. this.words[this.length - 1] &= n
  34427. }
  34428. return this._strip()
  34429. }, a.prototype.maskn = function(e) {
  34430. return this.clone().imaskn(e)
  34431. }, a.prototype.iaddn = function(e) {
  34432. return r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ?
  34433. 1 === this.length && (0 | this.words[0]) <= e ? (this.words[0] = e - (0 | this.words[0]), this
  34434. .negative = 0, this) : (this.negative = 0, this.isubn(e), this.negative = 1, this) : this
  34435. ._iaddn(e)
  34436. }, a.prototype._iaddn = function(e) {
  34437. this.words[0] += e;
  34438. for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) this.words[t] -= 67108864,
  34439. t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++;
  34440. return this.length = Math.max(this.length, t + 1), this
  34441. }, a.prototype.isubn = function(e) {
  34442. if (r("number" == typeof e), r(e < 67108864), e < 0) return this.iaddn(-e);
  34443. if (0 !== this.negative) return this.negative = 0, this.iaddn(e), this.negative = 1, this;
  34444. if (this.words[0] -= e, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0],
  34445. this.negative = 1;
  34446. else
  34447. for (var t = 0; t < this.length && this.words[t] < 0; t++) this.words[t] += 67108864, this
  34448. .words[t + 1] -= 1;
  34449. return this._strip()
  34450. }, a.prototype.addn = function(e) {
  34451. return this.clone().iaddn(e)
  34452. }, a.prototype.subn = function(e) {
  34453. return this.clone().isubn(e)
  34454. }, a.prototype.iabs = function() {
  34455. return this.negative = 0, this
  34456. }, a.prototype.abs = function() {
  34457. return this.clone().iabs()
  34458. }, a.prototype._ishlnsubmul = function(e, t, i) {
  34459. var n, a, s = e.length + i;
  34460. this._expand(s);
  34461. var o = 0;
  34462. for (n = 0; n < e.length; n++) {
  34463. a = (0 | this.words[n + i]) + o;
  34464. var u = (0 | e.words[n]) * t;
  34465. o = ((a -= 67108863 & u) >> 26) - (u / 67108864 | 0), this.words[n + i] = 67108863 & a
  34466. }
  34467. for (; n < this.length - i; n++) o = (a = (0 | this.words[n + i]) + o) >> 26, this.words[n + i] =
  34468. 67108863 & a;
  34469. if (0 === o) return this._strip();
  34470. for (r(-1 === o), o = 0, n = 0; n < this.length; n++) o = (a = -(0 | this.words[n]) + o) >> 26,
  34471. this.words[n] = 67108863 & a;
  34472. return this.negative = 1, this._strip()
  34473. }, a.prototype._wordDiv = function(e, t) {
  34474. var i = (this.length, e.length),
  34475. r = this.clone(),
  34476. n = e,
  34477. s = 0 | n.words[n.length - 1];
  34478. 0 != (i = 26 - this._countBits(s)) && (n = n.ushln(i), r.iushln(i), s = 0 | n.words[n.length -
  34479. 1]);
  34480. var o, u = r.length - n.length;
  34481. if ("mod" !== t) {
  34482. (o = new a(null)).length = u + 1, o.words = new Array(o.length);
  34483. for (var l = 0; l < o.length; l++) o.words[l] = 0
  34484. }
  34485. var d = r.clone()._ishlnsubmul(n, 1, u);
  34486. 0 === d.negative && (r = d, o && (o.words[u] = 1));
  34487. for (var c = u - 1; c >= 0; c--) {
  34488. var h = 67108864 * (0 | r.words[n.length + c]) + (0 | r.words[n.length + c - 1]);
  34489. for (h = Math.min(h / s | 0, 67108863), r._ishlnsubmul(n, h, c); 0 !== r.negative;) h--, r
  34490. .negative = 0, r._ishlnsubmul(n, 1, c), r.isZero() || (r.negative ^= 1);
  34491. o && (o.words[c] = h)
  34492. }
  34493. return o && o._strip(), r._strip(), "div" !== t && 0 !== i && r.iushrn(i), {
  34494. div: o || null,
  34495. mod: r
  34496. }
  34497. }, a.prototype.divmod = function(e, t, i) {
  34498. return r(!e.isZero()), this.isZero() ? {
  34499. div: new a(0),
  34500. mod: new a(0)
  34501. } : 0 !== this.negative && 0 === e.negative ? (o = this.neg().divmod(e, t), "mod" !== t && (n =
  34502. o.div.neg()), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.iadd(e)), {
  34503. div: n,
  34504. mod: s
  34505. }) : 0 === this.negative && 0 !== e.negative ? (o = this.divmod(e.neg(), t), "mod" !== t && (n =
  34506. o.div.neg()), {
  34507. div: n,
  34508. mod: o.mod
  34509. }) : 0 != (this.negative & e.negative) ? (o = this.neg().divmod(e.neg(), t), "div" !== t && (s =
  34510. o.mod.neg(), i && 0 !== s.negative && s.isub(e)), {
  34511. div: o.div,
  34512. mod: s
  34513. }) : e.length > this.length || this.cmp(e) < 0 ? {
  34514. div: new a(0),
  34515. mod: this
  34516. } : 1 === e.length ? "div" === t ? {
  34517. div: this.divn(e.words[0]),
  34518. mod: null
  34519. } : "mod" === t ? {
  34520. div: null,
  34521. mod: new a(this.modrn(e.words[0]))
  34522. } : {
  34523. div: this.divn(e.words[0]),
  34524. mod: new a(this.modrn(e.words[0]))
  34525. } : this._wordDiv(e, t);
  34526. var n, s, o
  34527. }, a.prototype.div = function(e) {
  34528. return this.divmod(e, "div", !1).div
  34529. }, a.prototype.mod = function(e) {
  34530. return this.divmod(e, "mod", !1).mod
  34531. }, a.prototype.umod = function(e) {
  34532. return this.divmod(e, "mod", !0).mod
  34533. }, a.prototype.divRound = function(e) {
  34534. var t = this.divmod(e);
  34535. if (t.mod.isZero()) return t.div;
  34536. var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod,
  34537. r = e.ushrn(1),
  34538. n = e.andln(1),
  34539. a = i.cmp(r);
  34540. return a < 0 || 1 === n && 0 === a ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn(
  34541. 1)
  34542. }, a.prototype.modrn = function(e) {
  34543. var t = e < 0;
  34544. t && (e = -e), r(e <= 67108863);
  34545. for (var i = (1 << 26) % e, n = 0, a = this.length - 1; a >= 0; a--) n = (i * n + (0 | this.words[
  34546. a])) % e;
  34547. return t ? -n : n
  34548. }, a.prototype.modn = function(e) {
  34549. return this.modrn(e)
  34550. }, a.prototype.idivn = function(e) {
  34551. var t = e < 0;
  34552. t && (e = -e), r(e <= 67108863);
  34553. for (var i = 0, n = this.length - 1; n >= 0; n--) {
  34554. var a = (0 | this.words[n]) + 67108864 * i;
  34555. this.words[n] = a / e | 0, i = a % e
  34556. }
  34557. return this._strip(), t ? this.ineg() : this
  34558. }, a.prototype.divn = function(e) {
  34559. return this.clone().idivn(e)
  34560. }, a.prototype.egcd = function(e) {
  34561. r(0 === e.negative), r(!e.isZero());
  34562. var t = this,
  34563. i = e.clone();
  34564. t = 0 !== t.negative ? t.umod(e) : t.clone();
  34565. for (var n = new a(1), s = new a(0), o = new a(0), u = new a(1), l = 0; t.isEven() && i.isEven();)
  34566. t.iushrn(1), i.iushrn(1), ++l;
  34567. for (var d = i.clone(), c = t.clone(); !t.isZero();) {
  34568. for (var h = 0, f = 1; 0 == (t.words[0] & f) && h < 26; ++h, f <<= 1);
  34569. if (h > 0)
  34570. for (t.iushrn(h); h-- > 0;)(n.isOdd() || s.isOdd()) && (n.iadd(d), s.isub(c)), n.iushrn(1), s
  34571. .iushrn(1);
  34572. for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1);
  34573. if (p > 0)
  34574. for (i.iushrn(p); p-- > 0;)(o.isOdd() || u.isOdd()) && (o.iadd(d), u.isub(c)), o.iushrn(1), u
  34575. .iushrn(1);
  34576. t.cmp(i) >= 0 ? (t.isub(i), n.isub(o), s.isub(u)) : (i.isub(t), o.isub(n), u.isub(s))
  34577. }
  34578. return {
  34579. a: o,
  34580. b: u,
  34581. gcd: i.iushln(l)
  34582. }
  34583. }, a.prototype._invmp = function(e) {
  34584. r(0 === e.negative), r(!e.isZero());
  34585. var t = this,
  34586. i = e.clone();
  34587. t = 0 !== t.negative ? t.umod(e) : t.clone();
  34588. for (var n, s = new a(1), o = new a(0), u = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) {
  34589. for (var l = 0, d = 1; 0 == (t.words[0] & d) && l < 26; ++l, d <<= 1);
  34590. if (l > 0)
  34591. for (t.iushrn(l); l-- > 0;) s.isOdd() && s.iadd(u), s.iushrn(1);
  34592. for (var c = 0, h = 1; 0 == (i.words[0] & h) && c < 26; ++c, h <<= 1);
  34593. if (c > 0)
  34594. for (i.iushrn(c); c-- > 0;) o.isOdd() && o.iadd(u), o.iushrn(1);
  34595. t.cmp(i) >= 0 ? (t.isub(i), s.isub(o)) : (i.isub(t), o.isub(s))
  34596. }
  34597. return (n = 0 === t.cmpn(1) ? s : o).cmpn(0) < 0 && n.iadd(e), n
  34598. }, a.prototype.gcd = function(e) {
  34599. if (this.isZero()) return e.abs();
  34600. if (e.isZero()) return this.abs();
  34601. var t = this.clone(),
  34602. i = e.clone();
  34603. t.negative = 0, i.negative = 0;
  34604. for (var r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1);
  34605. for (;;) {
  34606. for (; t.isEven();) t.iushrn(1);
  34607. for (; i.isEven();) i.iushrn(1);
  34608. var n = t.cmp(i);
  34609. if (n < 0) {
  34610. var a = t;
  34611. t = i, i = a
  34612. } else if (0 === n || 0 === i.cmpn(1)) break;
  34613. t.isub(i)
  34614. }
  34615. return i.iushln(r)
  34616. }, a.prototype.invm = function(e) {
  34617. return this.egcd(e).a.umod(e)
  34618. }, a.prototype.isEven = function() {
  34619. return 0 == (1 & this.words[0])
  34620. }, a.prototype.isOdd = function() {
  34621. return 1 == (1 & this.words[0])
  34622. }, a.prototype.andln = function(e) {
  34623. return this.words[0] & e
  34624. }, a.prototype.bincn = function(e) {
  34625. r("number" == typeof e);
  34626. var t = e % 26,
  34627. i = (e - t) / 26,
  34628. n = 1 << t;
  34629. if (this.length <= i) return this._expand(i + 1), this.words[i] |= n, this;
  34630. for (var a = n, s = i; 0 !== a && s < this.length; s++) {
  34631. var o = 0 | this.words[s];
  34632. a = (o += a) >>> 26, o &= 67108863, this.words[s] = o
  34633. }
  34634. return 0 !== a && (this.words[s] = a, this.length++), this
  34635. }, a.prototype.isZero = function() {
  34636. return 1 === this.length && 0 === this.words[0]
  34637. }, a.prototype.cmpn = function(e) {
  34638. var t, i = e < 0;
  34639. if (0 !== this.negative && !i) return -1;
  34640. if (0 === this.negative && i) return 1;
  34641. if (this._strip(), this.length > 1) t = 1;
  34642. else {
  34643. i && (e = -e), r(e <= 67108863, "Number is too big");
  34644. var n = 0 | this.words[0];
  34645. t = n === e ? 0 : n < e ? -1 : 1
  34646. }
  34647. return 0 !== this.negative ? 0 | -t : t
  34648. }, a.prototype.cmp = function(e) {
  34649. if (0 !== this.negative && 0 === e.negative) return -1;
  34650. if (0 === this.negative && 0 !== e.negative) return 1;
  34651. var t = this.ucmp(e);
  34652. return 0 !== this.negative ? 0 | -t : t
  34653. }, a.prototype.ucmp = function(e) {
  34654. if (this.length > e.length) return 1;
  34655. if (this.length < e.length) return -1;
  34656. for (var t = 0, i = this.length - 1; i >= 0; i--) {
  34657. var r = 0 | this.words[i],
  34658. n = 0 | e.words[i];
  34659. if (r !== n) {
  34660. r < n ? t = -1 : r > n && (t = 1);
  34661. break
  34662. }
  34663. }
  34664. return t
  34665. }, a.prototype.gtn = function(e) {
  34666. return 1 === this.cmpn(e)
  34667. }, a.prototype.gt = function(e) {
  34668. return 1 === this.cmp(e)
  34669. }, a.prototype.gten = function(e) {
  34670. return this.cmpn(e) >= 0
  34671. }, a.prototype.gte = function(e) {
  34672. return this.cmp(e) >= 0
  34673. }, a.prototype.ltn = function(e) {
  34674. return -1 === this.cmpn(e)
  34675. }, a.prototype.lt = function(e) {
  34676. return -1 === this.cmp(e)
  34677. }, a.prototype.lten = function(e) {
  34678. return this.cmpn(e) <= 0
  34679. }, a.prototype.lte = function(e) {
  34680. return this.cmp(e) <= 0
  34681. }, a.prototype.eqn = function(e) {
  34682. return 0 === this.cmpn(e)
  34683. }, a.prototype.eq = function(e) {
  34684. return 0 === this.cmp(e)
  34685. }, a.red = function(e) {
  34686. return new k(e)
  34687. }, a.prototype.toRed = function(e) {
  34688. return r(!this.red, "Already a number in reduction context"), r(0 === this.negative,
  34689. "red works only with positives"), e.convertTo(this)._forceRed(e)
  34690. }, a.prototype.fromRed = function() {
  34691. return r(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(
  34692. this)
  34693. }, a.prototype._forceRed = function(e) {
  34694. return this.red = e, this
  34695. }, a.prototype.forceRed = function(e) {
  34696. return r(!this.red, "Already a number in reduction context"), this._forceRed(e)
  34697. }, a.prototype.redAdd = function(e) {
  34698. return r(this.red, "redAdd works only with red numbers"), this.red.add(this, e)
  34699. }, a.prototype.redIAdd = function(e) {
  34700. return r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e)
  34701. }, a.prototype.redSub = function(e) {
  34702. return r(this.red, "redSub works only with red numbers"), this.red.sub(this, e)
  34703. }, a.prototype.redISub = function(e) {
  34704. return r(this.red, "redISub works only with red numbers"), this.red.isub(this, e)
  34705. }, a.prototype.redShl = function(e) {
  34706. return r(this.red, "redShl works only with red numbers"), this.red.shl(this, e)
  34707. }, a.prototype.redMul = function(e) {
  34708. return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red
  34709. .mul(this, e)
  34710. }, a.prototype.redIMul = function(e) {
  34711. return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red
  34712. .imul(this, e)
  34713. }, a.prototype.redSqr = function() {
  34714. return r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(
  34715. this)
  34716. }, a.prototype.redISqr = function() {
  34717. return r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(
  34718. this)
  34719. }, a.prototype.redSqrt = function() {
  34720. return r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(
  34721. this)
  34722. }, a.prototype.redInvm = function() {
  34723. return r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(
  34724. this)
  34725. }, a.prototype.redNeg = function() {
  34726. return r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(
  34727. this)
  34728. }, a.prototype.redPow = function(e) {
  34729. return r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e)
  34730. };
  34731. var b = {
  34732. k256: null,
  34733. p224: null,
  34734. p192: null,
  34735. p25519: null
  34736. };
  34737. function w(e, t) {
  34738. this.name = e, this.p = new a(t, 16), this.n = this.p.bitLength(), this.k = new a(1).iushln(this.n)
  34739. .isub(this.p), this.tmp = this._tmp()
  34740. }
  34741. function E() {
  34742. w.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")
  34743. }
  34744. function T() {
  34745. w.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")
  34746. }
  34747. function S() {
  34748. w.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")
  34749. }
  34750. function A() {
  34751. w.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")
  34752. }
  34753. function k(e) {
  34754. if ("string" == typeof e) {
  34755. var t = a._prime(e);
  34756. this.m = t.p, this.prime = t
  34757. } else r(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null
  34758. }
  34759. function R(e) {
  34760. k.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this
  34761. .shift % 26), this.r = new a(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this
  34762. .rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv =
  34763. this.minv.umod(this.r), this.minv = this.r.sub(this.minv)
  34764. }
  34765. w.prototype._tmp = function() {
  34766. var e = new a(null);
  34767. return e.words = new Array(Math.ceil(this.n / 13)), e
  34768. }, w.prototype.ireduce = function(e) {
  34769. var t, i = e;
  34770. do {
  34771. this.split(i, this.tmp), t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength()
  34772. } while (t > this.n);
  34773. var r = t < this.n ? -1 : i.ucmp(this.p);
  34774. return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 0 ? i.isub(this.p) : void 0 !== i.strip ? i
  34775. .strip() : i._strip(), i
  34776. }, w.prototype.split = function(e, t) {
  34777. e.iushrn(this.n, 0, t)
  34778. }, w.prototype.imulK = function(e) {
  34779. return e.imul(this.k)
  34780. }, n(E, w), E.prototype.split = function(e, t) {
  34781. for (var i = Math.min(e.length, 9), r = 0; r < i; r++) t.words[r] = e.words[r];
  34782. if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1);
  34783. var n = e.words[9];
  34784. for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) {
  34785. var a = 0 | e.words[r];
  34786. e.words[r - 10] = (4194303 & a) << 4 | n >>> 22, n = a
  34787. }
  34788. n >>>= 22, e.words[r - 10] = n, 0 === n && e.length > 10 ? e.length -= 10 : e.length -= 9
  34789. }, E.prototype.imulK = function(e) {
  34790. e.words[e.length] = 0, e.words[e.length + 1] = 0, e.length += 2;
  34791. for (var t = 0, i = 0; i < e.length; i++) {
  34792. var r = 0 | e.words[i];
  34793. t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (t / 67108864 | 0)
  34794. }
  34795. return 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e
  34796. }, n(T, w), n(S, w), n(A, w), A.prototype.imulK = function(e) {
  34797. for (var t = 0, i = 0; i < e.length; i++) {
  34798. var r = 19 * (0 | e.words[i]) + t,
  34799. n = 67108863 & r;
  34800. r >>>= 26, e.words[i] = n, t = r
  34801. }
  34802. return 0 !== t && (e.words[e.length++] = t), e
  34803. }, a._prime = function(e) {
  34804. if (b[e]) return b[e];
  34805. var t;
  34806. if ("k256" === e) t = new E;
  34807. else if ("p224" === e) t = new T;
  34808. else if ("p192" === e) t = new S;
  34809. else {
  34810. if ("p25519" !== e) throw new Error("Unknown prime " + e);
  34811. t = new A
  34812. }
  34813. return b[e] = t, t
  34814. }, k.prototype._verify1 = function(e) {
  34815. r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers")
  34816. }, k.prototype._verify2 = function(e, t) {
  34817. r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red,
  34818. "red works only with red numbers")
  34819. }, k.prototype.imod = function(e) {
  34820. return this.prime ? this.prime.ireduce(e)._forceRed(this) : (d(e, e.umod(this.m)._forceRed(this)),
  34821. e)
  34822. }, k.prototype.neg = function(e) {
  34823. return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this)
  34824. }, k.prototype.add = function(e, t) {
  34825. this._verify2(e, t);
  34826. var i = e.add(t);
  34827. return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this)
  34828. }, k.prototype.iadd = function(e, t) {
  34829. this._verify2(e, t);
  34830. var i = e.iadd(t);
  34831. return i.cmp(this.m) >= 0 && i.isub(this.m), i
  34832. }, k.prototype.sub = function(e, t) {
  34833. this._verify2(e, t);
  34834. var i = e.sub(t);
  34835. return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this)
  34836. }, k.prototype.isub = function(e, t) {
  34837. this._verify2(e, t);
  34838. var i = e.isub(t);
  34839. return i.cmpn(0) < 0 && i.iadd(this.m), i
  34840. }, k.prototype.shl = function(e, t) {
  34841. return this._verify1(e), this.imod(e.ushln(t))
  34842. }, k.prototype.imul = function(e, t) {
  34843. return this._verify2(e, t), this.imod(e.imul(t))
  34844. }, k.prototype.mul = function(e, t) {
  34845. return this._verify2(e, t), this.imod(e.mul(t))
  34846. }, k.prototype.isqr = function(e) {
  34847. return this.imul(e, e.clone())
  34848. }, k.prototype.sqr = function(e) {
  34849. return this.mul(e, e)
  34850. }, k.prototype.sqrt = function(e) {
  34851. if (e.isZero()) return e.clone();
  34852. var t = this.m.andln(3);
  34853. if (r(t % 2 == 1), 3 === t) {
  34854. var i = this.m.add(new a(1)).iushrn(2);
  34855. return this.pow(e, i)
  34856. }
  34857. for (var n = this.m.subn(1), s = 0; !n.isZero() && 0 === n.andln(1);) s++, n.iushrn(1);
  34858. r(!n.isZero());
  34859. var o = new a(1).toRed(this),
  34860. u = o.redNeg(),
  34861. l = this.m.subn(1).iushrn(1),
  34862. d = this.m.bitLength();
  34863. for (d = new a(2 * d * d).toRed(this); 0 !== this.pow(d, l).cmp(u);) d.redIAdd(u);
  34864. for (var c = this.pow(d, n), h = this.pow(e, n.addn(1).iushrn(1)), f = this.pow(e, n), p =
  34865. s; 0 !== f.cmp(o);) {
  34866. for (var m = f, g = 0; 0 !== m.cmp(o); g++) m = m.redSqr();
  34867. r(g < p);
  34868. var v = this.pow(c, new a(1).iushln(p - g - 1));
  34869. h = h.redMul(v), c = v.redSqr(), f = f.redMul(c), p = g
  34870. }
  34871. return h
  34872. }, k.prototype.invm = function(e) {
  34873. var t = e._invmp(this.m);
  34874. return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t)
  34875. }, k.prototype.pow = function(e, t) {
  34876. if (t.isZero()) return new a(1).toRed(this);
  34877. if (0 === t.cmpn(1)) return e.clone();
  34878. var i = new Array(16);
  34879. i[0] = new a(1).toRed(this), i[1] = e;
  34880. for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e);
  34881. var n = i[0],
  34882. s = 0,
  34883. o = 0,
  34884. u = t.bitLength() % 26;
  34885. for (0 === u && (u = 26), r = t.length - 1; r >= 0; r--) {
  34886. for (var l = t.words[r], d = u - 1; d >= 0; d--) {
  34887. var c = l >> d & 1;
  34888. n !== i[0] && (n = this.sqr(n)), 0 !== c || 0 !== s ? (s <<= 1, s |= c, (4 == ++o || 0 ===
  34889. r && 0 === d) && (n = this.mul(n, i[s]), o = 0, s = 0)) : o = 0
  34890. }
  34891. u = 26
  34892. }
  34893. return n
  34894. }, k.prototype.convertTo = function(e) {
  34895. var t = e.umod(this.m);
  34896. return t === e ? t.clone() : t
  34897. }, k.prototype.convertFrom = function(e) {
  34898. var t = e.clone();
  34899. return t.red = null, t
  34900. }, a.mont = function(e) {
  34901. return new R(e)
  34902. }, n(R, k), R.prototype.convertTo = function(e) {
  34903. return this.imod(e.ushln(this.shift))
  34904. }, R.prototype.convertFrom = function(e) {
  34905. var t = this.imod(e.mul(this.rinv));
  34906. return t.red = null, t
  34907. }, R.prototype.imul = function(e, t) {
  34908. if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e;
  34909. var i = e.imul(t),
  34910. r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
  34911. n = i.isub(r).iushrn(this.shift),
  34912. a = n;
  34913. return n.cmp(this.m) >= 0 ? a = n.isub(this.m) : n.cmpn(0) < 0 && (a = n.iadd(this.m)), a
  34914. ._forceRed(this)
  34915. }, R.prototype.mul = function(e, t) {
  34916. if (e.isZero() || t.isZero()) return new a(0)._forceRed(this);
  34917. var i = e.mul(t),
  34918. r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
  34919. n = i.isub(r).iushrn(this.shift),
  34920. s = n;
  34921. return n.cmp(this.m) >= 0 ? s = n.isub(this.m) : n.cmpn(0) < 0 && (s = n.iadd(this.m)), s
  34922. ._forceRed(this)
  34923. }, R.prototype.invm = function(e) {
  34924. return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)
  34925. }
  34926. }(e, this)
  34927. }).call(this, i(55)(e))
  34928. }, function(e, t, i) {
  34929. "use strict";
  34930. var r = t;
  34931. r.bignum = i(11), r.define = i(214).define, r.base = i(217), r.constants = i(218), r.decoders = i(117), r
  34932. .encoders = i(115)
  34933. }, function(e, t, i) {
  34934. "use strict";
  34935. var r = t;
  34936. r.der = i(116), r.pem = i(215)
  34937. }, function(e, t, i) {
  34938. "use strict";
  34939. var r = i(5),
  34940. n = i(62).Buffer,
  34941. a = i(63),
  34942. s = i(65);
  34943. function o(e) {
  34944. this.enc = "der", this.name = e.name, this.entity = e, this.tree = new u, this.tree._init(e.body)
  34945. }
  34946. function u(e) {
  34947. a.call(this, "der", e)
  34948. }
  34949. function l(e) {
  34950. return e < 10 ? "0" + e : e
  34951. }
  34952. e.exports = o, o.prototype.encode = function(e, t) {
  34953. return this.tree._encode(e, t).join()
  34954. }, r(u, a), u.prototype._encodeComposite = function(e, t, i, r) {
  34955. var a = function(e, t, i, r) {
  34956. var n;
  34957. if ("seqof" === e ? e = "seq" : "setof" === e && (e = "set"), s.tagByName.hasOwnProperty(e)) n = s
  34958. .tagByName[e];
  34959. else {
  34960. if ("number" != typeof e || (0 | e) !== e) return r.error("Unknown tag: " + e);
  34961. n = e
  34962. }
  34963. return n >= 31 ? r.error("Multi-octet tag encoding unsupported") : (t || (n |= 32), n | s
  34964. .tagClassByName[i || "universal"] << 6)
  34965. }(e, t, i, this.reporter);
  34966. if (r.length < 128) {
  34967. var o = n.alloc(2);
  34968. return o[0] = a, o[1] = r.length, this._createEncoderBuffer([o, r])
  34969. }
  34970. for (var u = 1, l = r.length; l >= 256; l >>= 8) u++;
  34971. var d = n.alloc(2 + u);
  34972. d[0] = a, d[1] = 128 | u;
  34973. for (var c = 1 + u, h = r.length; h > 0; c--, h >>= 8) d[c] = 255 & h;
  34974. return this._createEncoderBuffer([d, r])
  34975. }, u.prototype._encodeStr = function(e, t) {
  34976. if ("bitstr" === t) return this._createEncoderBuffer([0 | e.unused, e.data]);
  34977. if ("bmpstr" === t) {
  34978. for (var i = n.alloc(2 * e.length), r = 0; r < e.length; r++) i.writeUInt16BE(e.charCodeAt(r), 2 * r);
  34979. return this._createEncoderBuffer(i)
  34980. }
  34981. return "numstr" === t ? this._isNumstr(e) ? this._createEncoderBuffer(e) : this.reporter.error(
  34982. "Encoding of string type: numstr supports only digits and space") : "printstr" === t ? this
  34983. ._isPrintstr(e) ? this._createEncoderBuffer(e) : this.reporter.error(
  34984. "Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"
  34985. ) : /str$/.test(t) || "objDesc" === t ? this._createEncoderBuffer(e) : this.reporter.error(
  34986. "Encoding of string type: " + t + " unsupported")
  34987. }, u.prototype._encodeObjid = function(e, t, i) {
  34988. if ("string" == typeof e) {
  34989. if (!t) return this.reporter.error("string objid given, but no values map found");
  34990. if (!t.hasOwnProperty(e)) return this.reporter.error("objid not found in values map");
  34991. e = t[e].split(/[\s.]+/g);
  34992. for (var r = 0; r < e.length; r++) e[r] |= 0
  34993. } else if (Array.isArray(e)) {
  34994. e = e.slice();
  34995. for (var a = 0; a < e.length; a++) e[a] |= 0
  34996. }
  34997. if (!Array.isArray(e)) return this.reporter.error("objid() should be either array or string, got: " +
  34998. JSON.stringify(e));
  34999. if (!i) {
  35000. if (e[1] >= 40) return this.reporter.error("Second objid identifier OOB");
  35001. e.splice(0, 2, 40 * e[0] + e[1])
  35002. }
  35003. for (var s = 0, o = 0; o < e.length; o++) {
  35004. var u = e[o];
  35005. for (s++; u >= 128; u >>= 7) s++
  35006. }
  35007. for (var l = n.alloc(s), d = l.length - 1, c = e.length - 1; c >= 0; c--) {
  35008. var h = e[c];
  35009. for (l[d--] = 127 & h;
  35010. (h >>= 7) > 0;) l[d--] = 128 | 127 & h
  35011. }
  35012. return this._createEncoderBuffer(l)
  35013. }, u.prototype._encodeTime = function(e, t) {
  35014. var i, r = new Date(e);
  35015. return "gentime" === t ? i = [l(r.getUTCFullYear()), l(r.getUTCMonth() + 1), l(r.getUTCDate()), l(r
  35016. .getUTCHours()), l(r.getUTCMinutes()), l(r.getUTCSeconds()), "Z"].join("") : "utctime" === t ? i = [
  35017. l(r.getUTCFullYear() % 100), l(r.getUTCMonth() + 1), l(r.getUTCDate()), l(r.getUTCHours()), l(r
  35018. .getUTCMinutes()), l(r.getUTCSeconds()), "Z"
  35019. ].join("") : this.reporter.error("Encoding " + t + " time is not supported yet"), this._encodeStr(i,
  35020. "octstr")
  35021. }, u.prototype._encodeNull = function() {
  35022. return this._createEncoderBuffer("")
  35023. }, u.prototype._encodeInt = function(e, t) {
  35024. if ("string" == typeof e) {
  35025. if (!t) return this.reporter.error("String int or enum given, but no values map");
  35026. if (!t.hasOwnProperty(e)) return this.reporter.error("Values map doesn't contain: " + JSON.stringify(
  35027. e));
  35028. e = t[e]
  35029. }
  35030. if ("number" != typeof e && !n.isBuffer(e)) {
  35031. var i = e.toArray();
  35032. !e.sign && 128 & i[0] && i.unshift(0), e = n.from(i)
  35033. }
  35034. if (n.isBuffer(e)) {
  35035. var r = e.length;
  35036. 0 === e.length && r++;
  35037. var a = n.alloc(r);
  35038. return e.copy(a), 0 === e.length && (a[0] = 0), this._createEncoderBuffer(a)
  35039. }
  35040. if (e < 128) return this._createEncoderBuffer(e);
  35041. if (e < 256) return this._createEncoderBuffer([0, e]);
  35042. for (var s = 1, o = e; o >= 256; o >>= 8) s++;
  35043. for (var u = new Array(s), l = u.length - 1; l >= 0; l--) u[l] = 255 & e, e >>= 8;
  35044. return 128 & u[0] && u.unshift(0), this._createEncoderBuffer(n.from(u))
  35045. }, u.prototype._encodeBool = function(e) {
  35046. return this._createEncoderBuffer(e ? 255 : 0)
  35047. }, u.prototype._use = function(e, t) {
  35048. return "function" == typeof e && (e = e(t)), e._getEncoder("der").tree
  35049. }, u.prototype._skipDefault = function(e, t, i) {
  35050. var r, n = this._baseState;
  35051. if (null === n.default) return !1;
  35052. var a = e.join();
  35053. if (void 0 === n.defaultBuffer && (n.defaultBuffer = this._encodeValue(n.default, t, i).join()), a
  35054. .length !== n.defaultBuffer.length) return !1;
  35055. for (r = 0; r < a.length; r++)
  35056. if (a[r] !== n.defaultBuffer[r]) return !1;
  35057. return !0
  35058. }
  35059. }, function(e, t, i) {
  35060. "use strict";
  35061. var r = t;
  35062. r.der = i(118), r.pem = i(216)
  35063. }, function(e, t, i) {
  35064. "use strict";
  35065. var r = i(5),
  35066. n = i(11),
  35067. a = i(35).DecoderBuffer,
  35068. s = i(63),
  35069. o = i(65);
  35070. function u(e) {
  35071. this.enc = "der", this.name = e.name, this.entity = e, this.tree = new l, this.tree._init(e.body)
  35072. }
  35073. function l(e) {
  35074. s.call(this, "der", e)
  35075. }
  35076. function d(e, t) {
  35077. var i = e.readUInt8(t);
  35078. if (e.isError(i)) return i;
  35079. var r = o.tagClass[i >> 6],
  35080. n = 0 == (32 & i);
  35081. if (31 == (31 & i)) {
  35082. var a = i;
  35083. for (i = 0; 128 == (128 & a);) {
  35084. if (a = e.readUInt8(t), e.isError(a)) return a;
  35085. i <<= 7, i |= 127 & a
  35086. }
  35087. } else i &= 31;
  35088. return {
  35089. cls: r,
  35090. primitive: n,
  35091. tag: i,
  35092. tagStr: o.tag[i]
  35093. }
  35094. }
  35095. function c(e, t, i) {
  35096. var r = e.readUInt8(i);
  35097. if (e.isError(r)) return r;
  35098. if (!t && 128 === r) return null;
  35099. if (0 == (128 & r)) return r;
  35100. var n = 127 & r;
  35101. if (n > 4) return e.error("length octect is too long");
  35102. r = 0;
  35103. for (var a = 0; a < n; a++) {
  35104. r <<= 8;
  35105. var s = e.readUInt8(i);
  35106. if (e.isError(s)) return s;
  35107. r |= s
  35108. }
  35109. return r
  35110. }
  35111. e.exports = u, u.prototype.decode = function(e, t) {
  35112. return a.isDecoderBuffer(e) || (e = new a(e, t)), this.tree._decode(e, t)
  35113. }, r(l, s), l.prototype._peekTag = function(e, t, i) {
  35114. if (e.isEmpty()) return !1;
  35115. var r = e.save(),
  35116. n = d(e, 'Failed to peek tag: "' + t + '"');
  35117. return e.isError(n) ? n : (e.restore(r), n.tag === t || n.tagStr === t || n.tagStr + "of" === t || i)
  35118. }, l.prototype._decodeTag = function(e, t, i) {
  35119. var r = d(e, 'Failed to decode tag of "' + t + '"');
  35120. if (e.isError(r)) return r;
  35121. var n = c(e, r.primitive, 'Failed to get length of "' + t + '"');
  35122. if (e.isError(n)) return n;
  35123. if (!i && r.tag !== t && r.tagStr !== t && r.tagStr + "of" !== t) return e.error(
  35124. 'Failed to match tag: "' + t + '"');
  35125. if (r.primitive || null !== n) return e.skip(n, 'Failed to match body of: "' + t + '"');
  35126. var a = e.save(),
  35127. s = this._skipUntilEnd(e, 'Failed to skip indefinite length body: "' + this.tag + '"');
  35128. return e.isError(s) ? s : (n = e.offset - a.offset, e.restore(a), e.skip(n,
  35129. 'Failed to match body of: "' + t + '"'))
  35130. }, l.prototype._skipUntilEnd = function(e, t) {
  35131. for (;;) {
  35132. var i = d(e, t);
  35133. if (e.isError(i)) return i;
  35134. var r = c(e, i.primitive, t);
  35135. if (e.isError(r)) return r;
  35136. var n;
  35137. if (n = i.primitive || null !== r ? e.skip(r) : this._skipUntilEnd(e, t), e.isError(n)) return n;
  35138. if ("end" === i.tagStr) break
  35139. }
  35140. }, l.prototype._decodeList = function(e, t, i, r) {
  35141. for (var n = []; !e.isEmpty();) {
  35142. var a = this._peekTag(e, "end");
  35143. if (e.isError(a)) return a;
  35144. var s = i.decode(e, "der", r);
  35145. if (e.isError(s) && a) break;
  35146. n.push(s)
  35147. }
  35148. return n
  35149. }, l.prototype._decodeStr = function(e, t) {
  35150. if ("bitstr" === t) {
  35151. var i = e.readUInt8();
  35152. return e.isError(i) ? i : {
  35153. unused: i,
  35154. data: e.raw()
  35155. }
  35156. }
  35157. if ("bmpstr" === t) {
  35158. var r = e.raw();
  35159. if (r.length % 2 == 1) return e.error("Decoding of string type: bmpstr length mismatch");
  35160. for (var n = "", a = 0; a < r.length / 2; a++) n += String.fromCharCode(r.readUInt16BE(2 * a));
  35161. return n
  35162. }
  35163. if ("numstr" === t) {
  35164. var s = e.raw().toString("ascii");
  35165. return this._isNumstr(s) ? s : e.error("Decoding of string type: numstr unsupported characters")
  35166. }
  35167. if ("octstr" === t) return e.raw();
  35168. if ("objDesc" === t) return e.raw();
  35169. if ("printstr" === t) {
  35170. var o = e.raw().toString("ascii");
  35171. return this._isPrintstr(o) ? o : e.error("Decoding of string type: printstr unsupported characters")
  35172. }
  35173. return /str$/.test(t) ? e.raw().toString() : e.error("Decoding of string type: " + t + " unsupported")
  35174. }, l.prototype._decodeObjid = function(e, t, i) {
  35175. for (var r, n = [], a = 0, s = 0; !e.isEmpty();) a <<= 7, a |= 127 & (s = e.readUInt8()), 0 == (128 &
  35176. s) && (n.push(a), a = 0);
  35177. 128 & s && n.push(a);
  35178. var o = n[0] / 40 | 0,
  35179. u = n[0] % 40;
  35180. if (r = i ? n : [o, u].concat(n.slice(1)), t) {
  35181. var l = t[r.join(" ")];
  35182. void 0 === l && (l = t[r.join(".")]), void 0 !== l && (r = l)
  35183. }
  35184. return r
  35185. }, l.prototype._decodeTime = function(e, t) {
  35186. var i, r, n, a, s, o, u = e.raw().toString();
  35187. if ("gentime" === t) i = 0 | u.slice(0, 4), r = 0 | u.slice(4, 6), n = 0 | u.slice(6, 8), a = 0 | u
  35188. .slice(8, 10), s = 0 | u.slice(10, 12), o = 0 | u.slice(12, 14);
  35189. else {
  35190. if ("utctime" !== t) return e.error("Decoding " + t + " time is not supported yet");
  35191. i = 0 | u.slice(0, 2), r = 0 | u.slice(2, 4), n = 0 | u.slice(4, 6), a = 0 | u.slice(6, 8), s = 0 | u
  35192. .slice(8, 10), o = 0 | u.slice(10, 12), i = i < 70 ? 2e3 + i : 1900 + i
  35193. }
  35194. return Date.UTC(i, r - 1, n, a, s, o, 0)
  35195. }, l.prototype._decodeNull = function() {
  35196. return null
  35197. }, l.prototype._decodeBool = function(e) {
  35198. var t = e.readUInt8();
  35199. return e.isError(t) ? t : 0 !== t
  35200. }, l.prototype._decodeInt = function(e, t) {
  35201. var i = e.raw(),
  35202. r = new n(i);
  35203. return t && (r = t[r.toString(10)] || r), r
  35204. }, l.prototype._use = function(e, t) {
  35205. return "function" == typeof e && (e = e(t)), e._getDecoder("der").tree
  35206. }
  35207. }, function(e) {
  35208. e.exports = JSON.parse(
  35209. '{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}'
  35210. )
  35211. }, function(e, t, i) {
  35212. var r = i(31),
  35213. n = i(6).Buffer;
  35214. function a(e) {
  35215. var t = n.allocUnsafe(4);
  35216. return t.writeUInt32BE(e, 0), t
  35217. }
  35218. e.exports = function(e, t) {
  35219. for (var i, s = n.alloc(0), o = 0; s.length < t;) i = a(o++), s = n.concat([s, r("sha1").update(e)
  35220. .update(i).digest()
  35221. ]);
  35222. return s.slice(0, t)
  35223. }
  35224. }, function(e, t) {
  35225. e.exports = function(e, t) {
  35226. for (var i = e.length, r = -1; ++r < i;) e[r] ^= t[r];
  35227. return e
  35228. }
  35229. }, function(e, t, i) {
  35230. var r = i(11),
  35231. n = i(6).Buffer;
  35232. e.exports = function(e, t) {
  35233. return n.from(e.toRed(r.mont(t.modulus)).redPow(new r(t.publicExponent)).fromRed().toArray())
  35234. }
  35235. }, function(e, t, i) {
  35236. "use strict";
  35237. (function(t) {
  35238. var r, n = (r = i(127)) && "object" == typeof r && "default" in r ? r.default : r;
  35239. e.exports = function(e) {
  35240. for (var i, r = (i = e, n.atob ? n.atob(i) : t.from(i, "base64").toString("binary")), a =
  35241. new Uint8Array(r.length), s = 0; s < r.length; s++) a[s] = r.charCodeAt(s);
  35242. return a
  35243. }
  35244. }).call(this, i(10).Buffer)
  35245. }, function(e, t, i) {
  35246. (function(t, i) {
  35247. var r;
  35248. r = function() {
  35249. "use strict";
  35250. function e(e) {
  35251. return "function" == typeof e
  35252. }
  35253. var r = Array.isArray ? Array.isArray : function(e) {
  35254. return "[object Array]" === Object.prototype.toString.call(e)
  35255. },
  35256. n = 0,
  35257. a = void 0,
  35258. s = void 0,
  35259. o = function(e, t) {
  35260. p[n] = e, p[n + 1] = t, 2 === (n += 2) && (s ? s(m) : v())
  35261. },
  35262. u = "undefined" != typeof window ? window : void 0,
  35263. l = u || {},
  35264. d = l.MutationObserver || l.WebKitMutationObserver,
  35265. c = "undefined" == typeof self && void 0 !== t && "[object process]" === {}.toString.call(t),
  35266. h = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts &&
  35267. "undefined" != typeof MessageChannel;
  35268. function f() {
  35269. var e = setTimeout;
  35270. return function() {
  35271. return e(m, 1)
  35272. }
  35273. }
  35274. var p = new Array(1e3);
  35275. function m() {
  35276. for (var e = 0; e < n; e += 2)(0, p[e])(p[e + 1]), p[e] = void 0, p[e + 1] = void 0;
  35277. n = 0
  35278. }
  35279. var g, v = void 0;
  35280. function y(e, t) {
  35281. var i = this,
  35282. r = new this.constructor(w);
  35283. void 0 === r[b] && D(r);
  35284. var n = i._state;
  35285. if (n) {
  35286. var a = arguments[n - 1];
  35287. o(function() {
  35288. return O(n, r, a, i._result)
  35289. })
  35290. } else R(i, r, e, t);
  35291. return r
  35292. }
  35293. function _(e) {
  35294. if (e && "object" == typeof e && e.constructor === this) return e;
  35295. var t = new this(w);
  35296. return T(t, e), t
  35297. }
  35298. c ? v = function() {
  35299. return t.nextTick(m)
  35300. } : d ? v = function() {
  35301. var e = 0,
  35302. t = new d(m),
  35303. i = document.createTextNode("");
  35304. return t.observe(i, {
  35305. characterData: !0
  35306. }),
  35307. function() {
  35308. i.data = e = ++e % 2
  35309. }
  35310. }() : h ? ((g = new MessageChannel).port1.onmessage = m, v = function() {
  35311. return g.port2.postMessage(0)
  35312. }) : v = void 0 === u ? function() {
  35313. try {
  35314. var e = Function("return this")().require("vertx");
  35315. return void 0 !== (a = e.runOnLoop || e.runOnContext) ? function() {
  35316. a(m)
  35317. } : f()
  35318. } catch (e) {
  35319. return f()
  35320. }
  35321. }() : f();
  35322. var b = Math.random().toString(36).substring(2);
  35323. function w() {}
  35324. function E(t, i, r) {
  35325. i.constructor === t.constructor && r === y && i.constructor.resolve === _ ? function(e, t) {
  35326. 1 === t._state ? A(e, t._result) : 2 === t._state ? k(e, t._result) : R(t, void 0, function(
  35327. t) {
  35328. return T(e, t)
  35329. }, function(t) {
  35330. return k(e, t)
  35331. })
  35332. }(t, i) : void 0 === r ? A(t, i) : e(r) ? function(e, t, i) {
  35333. o(function(e) {
  35334. var r = !1,
  35335. n = function(e, t, i, r) {
  35336. try {
  35337. e.call(t, i, r)
  35338. } catch (e) {
  35339. return e
  35340. }
  35341. }(i, t, function(i) {
  35342. r || (r = !0, t !== i ? T(e, i) : A(e, i))
  35343. }, function(t) {
  35344. r || (r = !0, k(e, t))
  35345. }, e._label);
  35346. !r && n && (r = !0, k(e, n))
  35347. }, e)
  35348. }(t, i, r) : A(t, i)
  35349. }
  35350. function T(e, t) {
  35351. if (e === t) k(e, new TypeError("You cannot resolve a promise with itself"));
  35352. else if (n = typeof(r = t), null === r || "object" !== n && "function" !== n) A(e, t);
  35353. else {
  35354. var i = void 0;
  35355. try {
  35356. i = t.then
  35357. } catch (t) {
  35358. return void k(e, t)
  35359. }
  35360. E(e, t, i)
  35361. }
  35362. var r, n
  35363. }
  35364. function S(e) {
  35365. e._onerror && e._onerror(e._result), M(e)
  35366. }
  35367. function A(e, t) {
  35368. void 0 === e._state && (e._result = t, e._state = 1, 0 !== e._subscribers.length && o(M, e))
  35369. }
  35370. function k(e, t) {
  35371. void 0 === e._state && (e._state = 2, e._result = t, o(S, e))
  35372. }
  35373. function R(e, t, i, r) {
  35374. var n = e._subscribers,
  35375. a = n.length;
  35376. e._onerror = null, n[a] = t, n[a + 1] = i, n[a + 2] = r, 0 === a && e._state && o(M, e)
  35377. }
  35378. function M(e) {
  35379. var t = e._subscribers,
  35380. i = e._state;
  35381. if (0 !== t.length) {
  35382. for (var r = void 0, n = void 0, a = e._result, s = 0; s < t.length; s += 3) r = t[s], n = t[s +
  35383. i], r ? O(i, r, n, a) : n(a);
  35384. e._subscribers.length = 0
  35385. }
  35386. }
  35387. function O(t, i, r, n) {
  35388. var a = e(r),
  35389. s = void 0,
  35390. o = void 0,
  35391. u = !0;
  35392. if (a) {
  35393. try {
  35394. s = r(n)
  35395. } catch (e) {
  35396. u = !1, o = e
  35397. }
  35398. if (i === s) return void k(i, new TypeError(
  35399. "A promises callback cannot return that same promise."))
  35400. } else s = n;
  35401. void 0 !== i._state || (a && u ? T(i, s) : !1 === u ? k(i, o) : 1 === t ? A(i, s) : 2 === t && k(
  35402. i, s))
  35403. }
  35404. var C = 0;
  35405. function D(e) {
  35406. e[b] = C++, e._state = void 0, e._result = void 0, e._subscribers = []
  35407. }
  35408. var I = function() {
  35409. function e(e, t) {
  35410. this._instanceConstructor = e, this.promise = new e(w), this.promise[b] || D(this.promise), r(
  35411. t) ? (this.length = t.length, this._remaining = t.length, this._result = new Array(this
  35412. .length), 0 === this.length ? A(this.promise, this._result) : (this.length = this
  35413. .length || 0, this._enumerate(t), 0 === this._remaining && A(this.promise, this._result)
  35414. )) : k(this.promise, new Error("Array Methods must be provided an Array"))
  35415. }
  35416. return e.prototype._enumerate = function(e) {
  35417. for (var t = 0; void 0 === this._state && t < e.length; t++) this._eachEntry(e[t], t)
  35418. }, e.prototype._eachEntry = function(e, t) {
  35419. var i = this._instanceConstructor,
  35420. r = i.resolve;
  35421. if (r === _) {
  35422. var n = void 0,
  35423. a = void 0,
  35424. s = !1;
  35425. try {
  35426. n = e.then
  35427. } catch (e) {
  35428. s = !0, a = e
  35429. }
  35430. if (n === y && void 0 !== e._state) this._settledAt(e._state, t, e._result);
  35431. else if ("function" != typeof n) this._remaining--, this._result[t] = e;
  35432. else if (i === L) {
  35433. var o = new i(w);
  35434. s ? k(o, a) : E(o, e, n), this._willSettleAt(o, t)
  35435. } else this._willSettleAt(new i(function(t) {
  35436. return t(e)
  35437. }), t)
  35438. } else this._willSettleAt(r(e), t)
  35439. }, e.prototype._settledAt = function(e, t, i) {
  35440. var r = this.promise;
  35441. void 0 === r._state && (this._remaining--, 2 === e ? k(r, i) : this._result[t] = i), 0 ===
  35442. this._remaining && A(r, this._result)
  35443. }, e.prototype._willSettleAt = function(e, t) {
  35444. var i = this;
  35445. R(e, void 0, function(e) {
  35446. return i._settledAt(1, t, e)
  35447. }, function(e) {
  35448. return i._settledAt(2, t, e)
  35449. })
  35450. }, e
  35451. }(),
  35452. L = function() {
  35453. function t(e) {
  35454. this[b] = C++, this._result = this._state = void 0, this._subscribers = [], w !== e && (
  35455. "function" != typeof e && function() {
  35456. throw new TypeError(
  35457. "You must pass a resolver function as the first argument to the promise constructor"
  35458. )
  35459. }(), this instanceof t ? function(e, t) {
  35460. try {
  35461. t(function(t) {
  35462. T(e, t)
  35463. }, function(t) {
  35464. k(e, t)
  35465. })
  35466. } catch (t) {
  35467. k(e, t)
  35468. }
  35469. }(this, e) : function() {
  35470. throw new TypeError(
  35471. "Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."
  35472. )
  35473. }())
  35474. }
  35475. return t.prototype.catch = function(e) {
  35476. return this.then(null, e)
  35477. }, t.prototype.finally = function(t) {
  35478. var i = this.constructor;
  35479. return e(t) ? this.then(function(e) {
  35480. return i.resolve(t()).then(function() {
  35481. return e
  35482. })
  35483. }, function(e) {
  35484. return i.resolve(t()).then(function() {
  35485. throw e
  35486. })
  35487. }) : this.then(t, t)
  35488. }, t
  35489. }();
  35490. return L.prototype.then = y, L.all = function(e) {
  35491. return new I(this, e).promise
  35492. }, L.race = function(e) {
  35493. var t = this;
  35494. return r(e) ? new t(function(i, r) {
  35495. for (var n = e.length, a = 0; a < n; a++) t.resolve(e[a]).then(i, r)
  35496. }) : new t(function(e, t) {
  35497. return t(new TypeError("You must pass an array to race."))
  35498. })
  35499. }, L.resolve = _, L.reject = function(e) {
  35500. var t = new this(w);
  35501. return k(t, e), t
  35502. }, L._setScheduler = function(e) {
  35503. s = e
  35504. }, L._setAsap = function(e) {
  35505. o = e
  35506. }, L._asap = o, L.polyfill = function() {
  35507. var e = void 0;
  35508. if (void 0 !== i) e = i;
  35509. else if ("undefined" != typeof self) e = self;
  35510. else try {
  35511. e = Function("return this")()
  35512. } catch (e) {
  35513. throw new Error("polyfill failed because global object is unavailable in this environment")
  35514. }
  35515. var t = e.Promise;
  35516. if (t) {
  35517. var r = null;
  35518. try {
  35519. r = Object.prototype.toString.call(t.resolve())
  35520. } catch (e) {}
  35521. if ("[object Promise]" === r && !t.cast) return
  35522. }
  35523. e.Promise = L
  35524. }, L.Promise = L, L
  35525. }, e.exports = r()
  35526. }).call(this, i(9), i(13))
  35527. }, function(e, t, i) {
  35528. "use strict";
  35529. t.byteLength = function(e) {
  35530. var t = l(e),
  35531. i = t[0],
  35532. r = t[1];
  35533. return 3 * (i + r) / 4 - r
  35534. }, t.toByteArray = function(e) {
  35535. var t, i, r = l(e),
  35536. s = r[0],
  35537. o = r[1],
  35538. u = new a(3 * (s + o) / 4 - o),
  35539. d = 0,
  35540. c = o > 0 ? s - 4 : s;
  35541. for (i = 0; i < c; i += 4) t = n[e.charCodeAt(i)] << 18 | n[e.charCodeAt(i + 1)] << 12 | n[e.charCodeAt(
  35542. i + 2)] << 6 | n[e.charCodeAt(i + 3)], u[d++] = t >> 16 & 255, u[d++] = t >> 8 & 255, u[d++] = 255 &
  35543. t;
  35544. return 2 === o && (t = n[e.charCodeAt(i)] << 2 | n[e.charCodeAt(i + 1)] >> 4, u[d++] = 255 & t), 1 ===
  35545. o && (t = n[e.charCodeAt(i)] << 10 | n[e.charCodeAt(i + 1)] << 4 | n[e.charCodeAt(i + 2)] >> 2, u[
  35546. d++] = t >> 8 & 255, u[d++] = 255 & t), u
  35547. }, t.fromByteArray = function(e) {
  35548. for (var t, i = e.length, n = i % 3, a = [], s = 0, o = i - n; s < o; s += 16383) a.push(d(e, s, s +
  35549. 16383 > o ? o : s + 16383));
  35550. return 1 === n ? (t = e[i - 1], a.push(r[t >> 2] + r[t << 4 & 63] + "==")) : 2 === n && (t = (e[i -
  35551. 2] << 8) + e[i - 1], a.push(r[t >> 10] + r[t >> 4 & 63] + r[t << 2 & 63] + "=")), a.join("")
  35552. };
  35553. for (var r = [], n = [], a = "undefined" != typeof Uint8Array ? Uint8Array : Array, s =
  35554. "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = 0, u = s.length; o < u; ++o) r[
  35555. o] = s[o], n[s.charCodeAt(o)] = o;
  35556. function l(e) {
  35557. var t = e.length;
  35558. if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4");
  35559. var i = e.indexOf("=");
  35560. return -1 === i && (i = t), [i, i === t ? 0 : 4 - i % 4]
  35561. }
  35562. function d(e, t, i) {
  35563. for (var n, a, s = [], o = t; o < i; o += 3) n = (e[o] << 16 & 16711680) + (e[o + 1] << 8 & 65280) + (
  35564. 255 & e[o + 2]), s.push(r[(a = n) >> 18 & 63] + r[a >> 12 & 63] + r[a >> 6 & 63] + r[63 & a]);
  35565. return s.join("")
  35566. }
  35567. n["-".charCodeAt(0)] = 62, n["_".charCodeAt(0)] = 63
  35568. }, function(e, t) {
  35569. t.read = function(e, t, i, r, n) {
  35570. var a, s, o = 8 * n - r - 1,
  35571. u = (1 << o) - 1,
  35572. l = u >> 1,
  35573. d = -7,
  35574. c = i ? n - 1 : 0,
  35575. h = i ? -1 : 1,
  35576. f = e[t + c];
  35577. for (c += h, a = f & (1 << -d) - 1, f >>= -d, d += o; d > 0; a = 256 * a + e[t + c], c += h, d -= 8);
  35578. for (s = a & (1 << -d) - 1, a >>= -d, d += r; d > 0; s = 256 * s + e[t + c], c += h, d -= 8);
  35579. if (0 === a) a = 1 - l;
  35580. else {
  35581. if (a === u) return s ? NaN : 1 / 0 * (f ? -1 : 1);
  35582. s += Math.pow(2, r), a -= l
  35583. }
  35584. return (f ? -1 : 1) * s * Math.pow(2, a - r)
  35585. }, t.write = function(e, t, i, r, n, a) {
  35586. var s, o, u, l = 8 * a - n - 1,
  35587. d = (1 << l) - 1,
  35588. c = d >> 1,
  35589. h = 23 === n ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
  35590. f = r ? 0 : a - 1,
  35591. p = r ? 1 : -1,
  35592. m = t < 0 || 0 === t && 1 / t < 0 ? 1 : 0;
  35593. for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (o = isNaN(t) ? 1 : 0, s = d) : (s = Math.floor(Math
  35594. .log(t) / Math.LN2), t * (u = Math.pow(2, -s)) < 1 && (s--, u *= 2), (t += s + c >= 1 ? h / u :
  35595. h * Math.pow(2, 1 - c)) * u >= 2 && (s++, u /= 2), s + c >= d ? (o = 0, s = d) : s + c >= 1 ? (o =
  35596. (t * u - 1) * Math.pow(2, n), s += c) : (o = t * Math.pow(2, c - 1) * Math.pow(2, n), s = 0)); n >=
  35597. 8; e[i + f] = 255 & o, f += p, o /= 256, n -= 8);
  35598. for (s = s << n | o, l += n; l > 0; e[i + f] = 255 & s, f += p, s /= 256, l -= 8);
  35599. e[i + f - p] |= 128 * m
  35600. }
  35601. }, function(e, t, i) {
  35602. (function(t) {
  35603. var i;
  35604. i = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {}, e
  35605. .exports = i
  35606. }).call(this, i(13))
  35607. }, function(e, t, i) {
  35608. var r = i(129),
  35609. n = i(130);
  35610. "string" == typeof(n = n.__esModule ? n.default : n) && (n = [
  35611. [e.i, n, ""]
  35612. ]);
  35613. r(n, {
  35614. insert: "head",
  35615. singleton: !1
  35616. }), e.exports = n.locals || {}
  35617. }, function(e, t, i) {
  35618. "use strict";
  35619. var r, n = function() {
  35620. var e = {};
  35621. return function(t) {
  35622. if (void 0 === e[t]) {
  35623. var i = document.querySelector(t);
  35624. if (window.HTMLIFrameElement && i instanceof window.HTMLIFrameElement) try {
  35625. i = i.contentDocument.head
  35626. } catch (e) {
  35627. i = null
  35628. }
  35629. e[t] = i
  35630. }
  35631. return e[t]
  35632. }
  35633. }(),
  35634. a = [];
  35635. function s(e) {
  35636. for (var t = -1, i = 0; i < a.length; i++)
  35637. if (a[i].identifier === e) {
  35638. t = i;
  35639. break
  35640. } return t
  35641. }
  35642. function o(e, t) {
  35643. for (var i = {}, r = [], n = 0; n < e.length; n++) {
  35644. var o = e[n],
  35645. u = t.base ? o[0] + t.base : o[0],
  35646. l = i[u] || 0,
  35647. d = "".concat(u, " ").concat(l);
  35648. i[u] = l + 1;
  35649. var c = s(d),
  35650. h = {
  35651. css: o[1],
  35652. media: o[2],
  35653. sourceMap: o[3]
  35654. }; - 1 !== c ? (a[c].references++, a[c].updater(h)) : a.push({
  35655. identifier: d,
  35656. updater: p(h, t),
  35657. references: 1
  35658. }), r.push(d)
  35659. }
  35660. return r
  35661. }
  35662. function u(e) {
  35663. var t = document.createElement("style"),
  35664. r = e.attributes || {};
  35665. if (void 0 === r.nonce) {
  35666. var a = i.nc;
  35667. a && (r.nonce = a)
  35668. }
  35669. if (Object.keys(r).forEach(function(e) {
  35670. t.setAttribute(e, r[e])
  35671. }), "function" == typeof e.insert) e.insert(t);
  35672. else {
  35673. var s = n(e.insert || "head");
  35674. if (!s) throw new Error(
  35675. "Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."
  35676. );
  35677. s.appendChild(t)
  35678. }
  35679. return t
  35680. }
  35681. var l, d = (l = [], function(e, t) {
  35682. return l[e] = t, l.filter(Boolean).join("\n")
  35683. });
  35684. function c(e, t, i, r) {
  35685. var n = i ? "" : r.media ? "@media ".concat(r.media, " {").concat(r.css, "}") : r.css;
  35686. if (e.styleSheet) e.styleSheet.cssText = d(t, n);
  35687. else {
  35688. var a = document.createTextNode(n),
  35689. s = e.childNodes;
  35690. s[t] && e.removeChild(s[t]), s.length ? e.insertBefore(a, s[t]) : e.appendChild(a)
  35691. }
  35692. }
  35693. var h = null,
  35694. f = 0;
  35695. function p(e, t) {
  35696. var i, r, n;
  35697. if (t.singleton) {
  35698. var a = f++;
  35699. i = h || (h = u(t)), r = c.bind(null, i, a, !1), n = c.bind(null, i, a, !0)
  35700. } else i = u(t), r = function(e, t, i) {
  35701. var r = i.css,
  35702. n = i.media,
  35703. a = i.sourceMap;
  35704. if (n ? e.setAttribute("media", n) : e.removeAttribute("media"), a && "undefined" != typeof btoa && (
  35705. r += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(
  35706. encodeURIComponent(JSON.stringify(a)))), " */")), e.styleSheet) e.styleSheet.cssText = r;
  35707. else {
  35708. for (; e.firstChild;) e.removeChild(e.firstChild);
  35709. e.appendChild(document.createTextNode(r))
  35710. }
  35711. }.bind(null, i, t), n = function() {
  35712. ! function(e) {
  35713. if (null === e.parentNode) return !1;
  35714. e.parentNode.removeChild(e)
  35715. }(i)
  35716. };
  35717. return r(e),
  35718. function(t) {
  35719. if (t) {
  35720. if (t.css === e.css && t.media === e.media && t.sourceMap === e.sourceMap) return;
  35721. r(e = t)
  35722. } else n()
  35723. }
  35724. }
  35725. e.exports = function(e, t) {
  35726. (t = t || {}).singleton || "boolean" == typeof t.singleton || (t.singleton = (void 0 === r && (r =
  35727. Boolean(window && document && document.all && !window.atob)), r));
  35728. var i = o(e = e || [], t);
  35729. return function(e) {
  35730. if (e = e || [], "[object Array]" === Object.prototype.toString.call(e)) {
  35731. for (var r = 0; r < i.length; r++) {
  35732. var n = s(i[r]);
  35733. a[n].references--
  35734. }
  35735. for (var u = o(e, t), l = 0; l < i.length; l++) {
  35736. var d = s(i[l]);
  35737. 0 === a[d].references && (a[d].updater(), a.splice(d, 1))
  35738. }
  35739. i = u
  35740. }
  35741. }
  35742. }
  35743. }, function(e, t, i) {
  35744. var r = i(131),
  35745. n = i(132),
  35746. a = i(133),
  35747. s = i(134),
  35748. o = i(135);
  35749. t = r(!1);
  35750. var u = n(a),
  35751. l = n(s),
  35752. d = n(o);
  35753. t.push([e.i, '@font-face {\n font-family: "iconfontep"; /* Project id 3440216 */\n src: url(' + u +
  35754. ") format('woff2'),\n url(" + l + ") format('woff'),\n url(" + d +
  35755. ') format(\'truetype\');\n}\n\n.iconfontep {\n font-family: "iconfontep" !important;\n font-size: 16px;\n font-style: normal;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.icon-xiangji:before {\n content: "\\e62e";\n}\n\n.icon-luxiang2:before {\n content: "\\e777";\n}\n\n.icon-xiangji1:before {\n content: "\\e6e5";\n}\n\n.icon-luxiang:before {\n content: "\\e62c";\n}\n\n.icon-snapshot:before {\n content: "\\e9f2";\n}\n\n.icon-shengyin1:before {\n content: "\\e8c0";\n}\n\n.icon-xiaoping:before {\n content: "\\e8bf";\n}\n\n.icon-jingyin:before {\n content: "\\e8bb";\n}\n\n.icon-quanping1:before {\n content: "\\e8ba";\n}\n\n.icon-bofang:before {\n content: "\\e8ad";\n}\n\n.icon-zanting:before {\n content: "\\e8ab";\n}\n\n',
  35756. ""
  35757. ]), e.exports = t
  35758. }, function(e, t, i) {
  35759. "use strict";
  35760. e.exports = function(e) {
  35761. var t = [];
  35762. return t.toString = function() {
  35763. return this.map(function(t) {
  35764. var i = function(e, t) {
  35765. var i, r, n, a = e[1] || "",
  35766. s = e[3];
  35767. if (!s) return a;
  35768. if (t && "function" == typeof btoa) {
  35769. var o = (i = s, r = btoa(unescape(encodeURIComponent(JSON.stringify(i)))), n =
  35770. "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(r), "/*# "
  35771. .concat(n, " */")),
  35772. u = s.sources.map(function(e) {
  35773. return "/*# sourceURL=".concat(s.sourceRoot || "").concat(e, " */")
  35774. });
  35775. return [a].concat(u).concat([o]).join("\n")
  35776. }
  35777. return [a].join("\n")
  35778. }(t, e);
  35779. return t[2] ? "@media ".concat(t[2], " {").concat(i, "}") : i
  35780. }).join("")
  35781. }, t.i = function(e, i, r) {
  35782. "string" == typeof e && (e = [
  35783. [null, e, ""]
  35784. ]);
  35785. var n = {};
  35786. if (r)
  35787. for (var a = 0; a < this.length; a++) {
  35788. var s = this[a][0];
  35789. null != s && (n[s] = !0)
  35790. }
  35791. for (var o = 0; o < e.length; o++) {
  35792. var u = [].concat(e[o]);
  35793. r && n[u[0]] || (i && (u[2] ? u[2] = "".concat(i, " and ").concat(u[2]) : u[2] = i), t.push(u))
  35794. }
  35795. }, t
  35796. }
  35797. }, function(e, t, i) {
  35798. "use strict";
  35799. e.exports = function(e, t) {
  35800. return t || (t = {}), "string" != typeof(e = e && e.__esModule ? e.default : e) ? e : (/^['"].*['"]$/
  35801. .test(e) && (e = e.slice(1, -1)), t.hash && (e += t.hash), /["'() \t\n]/.test(e) || t.needQuotes ?
  35802. '"'.concat(e.replace(/"/g, '\\"').replace(/\n/g, "\\n"), '"') : e)
  35803. }
  35804. }, function(e, t, i) {
  35805. "use strict";
  35806. i.r(t), t.default =
  35807. "data:font/woff2;base64,d09GMgABAAAAAAlMAAsAAAAAEOAAAAj+AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACEPAqSaI80ATYCJAMwCxoABCAFhGcHgRwbUA4RFazfI/viwDz9UwQQaoWtoxI6Bg55+g1tP7RnvwfPf/u1+2bmi2LWVJvZ6XgjtG1I/hWTrIlQaRs6YhbiDuGmXdA1ghR8XlGgbrB5NUDFqClVKpPk35N/p0yNwUwMmAq8awBQ1G5/7pVjClADbnNLFNuMi1B8cvb1rw/9KFeSLg37Do6lfi0D5GNrm8tH3Vf2KinaBvxAi0ywjYdRNuANSAbAM7FNLsykdcwCM31tXAUBfFrJhDE8bQ4O4pSpvwuUwkLMFEhjJdXabALuXIxpqRBcns3d0gBZB2xQC4wrALDmn1++QayMAygsDcR+Rpp0DSD9WuX7KeJ/AtA3wFKO14GWVoAFaKDxyqRy2K4+AMwYGj3br0tmMQ8gH8H8u82b6rXm9as3Fq/Tu9V72HvC99P/f1N9yHu8azFTyJdqKfIz/5snaBQBPh4uDjYWiA2IHSJnmxU8ZaoWYjxHAyECzis0Q8O7pRkKPpxCAnC2QogPziEI8cA5DCEuOMchxAHnBJphw+dPlG+Gfk3JxQAGAFqT5AGI4gkAJnRbBLgx2OGaEcodh6GBApbfFB6G+SkBT4i5hKoQCSrjYrAfF06FWApxRAjKF3O5/rGECclHikEoCgkEFj3CErARownFYQafCeO0y0XcuUO53aTHo6cObCG2HkTo2+S1UdseMQ6Rp67BPOrKCcBITl5F+PT10xCkH9vrdEJM0lFKHGmAYwkc3wQeBWUGyNjl72LNEeoYeXyUDpfoEfqgQiJhEVuCxALqkFLKJreHyhDjMvNVMj1uXQ8bWEI2TG2UGi5hszt3CJeL9nhIt7uePkocjNPcQO30uy6nLuwgdl6kL+8md13CKRsEkYsWjY2JxYR1MmWzyZYdRugxwgpT68VWU68utsYqlLp2K2tuP4xg9MGtQHxesAmhJWNyn4CRiBfDEEKFSN2zFCQJETd6KXsNbGDtxwkFkIsQOvigXsIkpVbxnTviQ4UvhQJJB1x7XZLtyPHng6nFACRWI0zZ2JSyctRtkAV38AKXvsBjXAUiDSgVb3S5Sh8I6dKDy2lJqX2CoW2N2rIl4WMS1O0pw+gkPAg2UdIK52T98M3ry5dG2KSY645l48rxy/YHu+54P/j6fdtWhXo8kMfgxm2kc7/kaNUG6dZ9UtvSZTIPaaYObbvEMx5GEOOmvZsBK7HvkRpgIwICjbbDwCeaRiCZjFZAMAODhkeG75eWDI8RdqrNBQixfnfAOnembY+dMF6+Eydw/enpvt1uw8Y98sUrqtYv37o3NLQaIh37gnAc/sJEAMxTEP3YficEGY8nhssPLuKD80HlIljDNay+XkQjjfn6SjDwQ+jD28lthwav3EPdIG4mbDi8HSJvmVPmuvpkeBSm7ICTbH62WTkhLunA8gHH/s9eeIIQASeyFs4o8zeCFVeQuOJCQFS+RpNfrYiOXx3fXlMmbTSoDI3SAKDjg56nt/8Q+KpSkgOUnwdmBH6uDPgvYCZXreMTPMWEi4XYv08Rq5iquc+94+z6vmmPVcKFKKWWhSdo5ZFB3XHklMpEdcVh6Xg9h2OQvXjbTMg1KfFdHFZXXDjfY0bx+JZZc9DjIHIq4gQSXprY8enCaf1abT+tHXDwERADiP75dbgmX63Or1AX5KsqA8HcKkWkvQgjxusStInaBB0w/+pZkZGzSkEEvyyeJ1I4SX0r/ZYqfYL9kSY2jbItbCZL8e7nLSwOu9nIaogI2lkiZVsQC5u/gk5Yf1Q1HKFCTqyYkK4KUpeVsPqVAwoknKfK4W0dTZj22BtaHWRUrHTKvfIltAKbG3YiWSB6uCRKzm+U0zvkAAoHYwzqmRIAUTWA3eV/LDTyq/29giJ+FvI9yqXrBjPW1nOZU3LKomeHnO1jo0/RJGEL37uWbeHkis+IujnNcDOnm/sSzuU0X+3Csg8EY1tgC+hSSerOipll03ukfdIXumK8sGhqV4A5yje7fGZpq6pT9Y3UlFuTndiQ1GKpMdbOD0LpHxsEa4cPKsJCtdrQQkV0/ML4tta30B2HdVl66oe0GSVhxnDmicPaC3FNA7KAasmlyfjA8eZ/xlkT7L6mOGta06YoCB0kstfsUkRHTM6iaCvZHWJSd+3qYnYnVySWrvrcF37Z9NWr2I5huoNXj9Zte7ux6b281I2ZfOVFh/KI0nFRWeLbhcR+KLGKNufdx3lKwCB982KfTpsX33f9xmDej/EjFy/N0w43Xh/5QP480NFflPBl+ZWAJQFXEtaVXQlcEhjcoU3FeRPmzqkfh8Z1vvrKfCU8f79Jk1iWXMkw16mKp00rDXlLV569zkIWhirb1/S44D2c9cVtivDvk/aIqRw4P/2qJVB5b5nymHLZXSX+9d77JQ7RanDkzWhI8DzHiHt0i2N+cPl8+5aR8OH/7TcgZATs/OLT9Gn6o3zqPnV/zVxvrDl2EFoOeaOy6Z/lKyh7rJ2KtfejoGWh+rm46TP7qCK0Ee8LaZrTWGi2L2VQdiXwn8nGJY8lck3zQ/2YN4PuH4DQ6DST5suo/8lc7zgzKcCuys1sxN7My4zCnuooMxO7tp8qgZMcZBZ2ax8yi70nMjGzR5lLscz5MKKGn/6ri/yNzrpz/XVCU2bVguO6cFEItcAIklPJHNJsLRCaur7RlMH4kHOAORXgy2EwVtTn8vgc3Dw2dWzMzUtrFA5loOtyysEgp77GIqAdbOT01Pg0oNs+IA8z0IjxA1DN26gRstlco4g5Ao2c82CQ46mxKOQN2Mj5t8ZnCsL2FlCtGXMQh+osjD+Ihskrnvpsry6sCaXK8XRSImzQN13Rd3Hk5BDrlHcYVD144QXO0+O5lBiy8OyMNpNq3retr1unMbxUB3GotqEF469lNEx+aM2/vqsLa0JhIp9KKSGZsge9RsdAXtjE6vJKkss7DJSUHjQIwRJzz1ulS9LNINcvNjujjWmAM++1NJTnspvzc5ePm81n1604SAgp0WLEElscccUT/9e+iURwhyJSmOM2rbF02Bak/WY6x7YQ5jKx7kyoo/CL1LencY4UNnMk1+61Ik2C+npkj5XGP5IuRVUFAA=="
  35808. }, function(e, t, i) {
  35809. "use strict";
  35810. i.r(t), t.default =
  35811. "data:font/woff;base64,d09GRgABAAAAAAu8AAsAAAAAEOAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAARAAAAGA8QUzCY21hcAAAAYgAAACxAAACPClWH55nbHlmAAACPAAABzUAAAloxhXGamhlYWQAAAl0AAAALwAAADYgyzh9aGhlYQAACaQAAAAcAAAAJAfeA41obXR4AAAJwAAAAA8AAAAwMAAAAGxvY2EAAAnQAAAAGgAAABoQiA60bWF4cAAACewAAAAfAAAAIAEjAONuYW1lAAAKDAAAAUAAAAJnEKM8sHBvc3QAAAtMAAAAbQAAAJwZ7sqZeJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGFhYJzAwMrAwNTJdIaBgaEfQjO+ZjBi5ACKMrAyM2AFAWmuKQwHnum8/MTc8L+BgYH5DgOQZGBEUcQEAINZDYF4nOWRSw6CQBBEa+TjBxcuDPEQhOPJRTyBKxPCBWABl2FotlwAq6ddaPQG9uRN0pVM96QKQAIgIgWJAfeAg9adqgt6hEPQY1zZn3GiEvvCl36cKqmlkU6GeVlX4ENtpTf1qxynvJ8cl7DdcfIGGfftscMWqf7OpT8m/Fsdw317dZk6bWhmvjQ0Lz8amulUGfQUUhv6VhpDc5XWoOOQzqD3kN5gCpDBYB6YFwPJE/6/RgEAAAB4nH0WbWwU1/HNe3e7e7f3wd7H7u2aO3O7vl2bs+/wfewajD/4ONwEYhtsAhiHJES0SlWgNBhSA5JTfkVYalO1UqUKJSL9SEkqVSWtquAkppUqkaShREqqplIqVVXlorYiSP3HrTvvjlIURb3bN2/2zbx5M/PmY0mA4I8tM0JEEidrSTchoFWVvFL1gnnRQsQSKzlIxcAsQW0YNDMGqRxUK27Npm9vWb67sDwKD/n/Gr1I37t4vTxRLk8c4qCsOio+Zn8/IwvNBbqwMLPg1+A96x4dwYzq9Dpqf2MDV6GtxypdJSapEJeMoB62EId6rQRWHg9NK/zYfGUYhkDLwTDUlZrNUgISbURdJKnppFP3CqiuYNo1l32yxowfMjdZzd9Ym0yc6RDOh+Jmp6L4XXrzz3pXl07zetdvT55sekYB7HqhQM+HILxpwBw08fFpex7YFAYlp8D3lJyf0C1Lh79w6B8c+2RsQwF31Qtc/SAhqx8GCCuSTtJHNpExMolWVDpptaJ2UiWF5qCyZUBtR6DquSNUE2NgOdzJfP3zHI32ogcKFTXVsoleXKcGSldVUwDo1KW7CxkrwJGrpWhWkqL1YDqyzB5dlpOC960dc43G3CIHO0oTpdLELAeQ6CgU3EKBFbPi7FpVFJuXtS4UYYj0UY7M6hKFvU/LUWh+SNeHQ0cXGnMXTjUapy7MNfaWJg5O9pXGHxsvFbmv6jYhMtp8g73NPBIhOnHIAGmQPeQp8k3yC/IO+Qjtb5vTNo09aJRo2kOclIM4pAQP+bxhDCy01DIFUQj+n42fYU22Y2CYx0cO0qLrudWKpmoqBo0oWP1Vswy2o22o9acEMAVcVZHTrTu1Fl8n3ogj4FUgLwryarYVbOnmDgI/o4h7slxFi19Bew2CfTt7e3ce4KA3V83lqpsruVzlS0GJhsIioKiAyFjEVoOSFIwboQD8sPf+hr4c593Md80EJIpsaUGShFiHFBjzM45rFDOwklmvw/hQak0yFmY0FMlAJBPYV6f15p24riZgZY0aiEdE3TktAwvO7IpKwUg8oMV9LShlk8cFURSOi3Hx/SjHoqgF3O7duZ+fjgASqG81m0WQOysFWSAs0FBQDErdQTmYSEmyFIsIb30+//QDLM18uQv26eW1Rq8e68mHouE1obj//UxEEWnJUDFu4Y85xf9JPJ6Ij8prIslhBk+JAaD9jhBQIgOK/rIkbE0VpLCUDm8VpOOI4IO5hGP1RfYRO0JUkiXrSY0Mke1knOzjdcHBP167KKj8kvG2Pbdec/Km6OWA3c8gDAVW0ZggOkgPJjlv3naT+YonliBoOknX01BGgXF5eVVgPyvNznzt5F+ndpvWhl0Pf/nYPw8/4Q3s98935RePvPxGd2Oy0d0C341EllLChc3T+/27S9GUKPl/t9R1cK7FBxP3qRBoUUGzVOode/gLmrZj757jJ24dPNDXp23bcuTp048/Gb2jzPt/674nubsB58F/Y5396UM966/5V3UM38ff9V/lXC8A7LhHgEab0K6bqzfZCiuTDOklW8k29E8rO7QcTfGILoGLb3XXsUWblxVMJzTadvi6W+OuaiXhIHhujhfZGJTBoq8noqLsJCZPb9lyejLhqJHk4eOBjd5L8awTL1er5VhRDoliaHvzmtHX0dFnTN1SuvSOQuzWFL0RthMJOdz93KWfX3quOyx3dYmlK8e+Onvg2+GetVS2j379qB0LxAOqJg7+yL9tFI0lHFcizEg3v5I0AvKVe/1g9dfsTTaMVVUmCtEI8appbExgpa10PlmtV+v5ZB0bVH3bzWf8Jdj+zO9h2535d/yl+XnYvngdGrR+41Tz3etn4Ys3/KU5lCmgzEvsDptCiQYpkTrZjBFFgoBZXdGAl1hQ0ylRcx0XYwIrjodBI+LCcKsPtYJOTcawYo0A4ytxamFhyvLSNAiaynsT+87dH0cNM8pmooblf9yg4xpArRzvzk4c9jayvjHb2fLs7oSD+SMrsuokkrf1gjLxvmWUDHym/xGzO3bjZtOIoiDLoEcHp2PRR2obh47ZMmR7flWeeezE4amxjecbMz/4RrccSSTs5k6xYMnhMB14PdVB5aFnjV7jLUzJX8qBjuRLLV9ewxo98oAvueMsxr3YA2nuWIZeVaw3z0Dh8pkzl/0/0ZlX5udfAXN+xf/4LPzhtXPnXoOeJjkLNomivJ+y59keQglDr4okjHJjre+HLOlBv7qEJJUQVHF4ODQWAud++ebNHCtqSuUOq9fs/+IUO/2LtNy8Waal5gdP0Grzd5TSDc0PXtCLlaLeAnTRcV0H66PXfNX2PDtTNEAvGvTfTQ1OwlwbjjczcAJOX2y/Tej39uLsr7iP1Cnovbrj+oveLhdwd7WoE7SErC6zJ9koWtGJOWS12wQWe5d/aOQ/8w7OdDqXS3MAn95H2Whn+u5KurMzzTIc/g//D3HDy8cAAAB4nGNgZGBgAOI5bJ1a8fw2Xxm4WRhA4N7VX3YI+v98FgbmVCCXg4EJJAoALh4K8AB4nGNgZGBgbvjfwBDDwgACQJKRARXwAABHEgJ1eJxjYWBgYCEBAwAFEAAxAAAAAAAARACmASACTALgA0wDdgPyBBoEhAS0AAB4nGNgZGBg4GG4zsDLAAJMQMwFhAwM/8F8BgAfuAIHAHichZE9bsJAEIWfwZAElChKpDRpVikoEsn8lEipUKCnoAez5ke211ovSNQ5TY6QE+QI6Whzikh52EMDRbza2W/evpkdyQDusIeH8rvnLtnDJbOSK7jAo3CV+pOwT34WrqGJnnCd+qtwAy94E26yY8YOnn/FrIV3YQ+3+BCu4AafwlXqX8I++Vu4hgf8CNep/wo3MPGuhZtoeeHA6qnTczXbqVVo0sik7niO9WITT+2pPNE2X5lUdYPOURrpVNtjm3y76DkXqciaRA15q+PYqMyatQ5dsHQu67fbkehBaBIMYKExhWOcQ2GGHeMKIQxSREV0Z/mY7gU2iFlp/3VP6LbIqR9yhS4CdM5cI7rSwnk6TY4tX+tRdXQrbsuahDSUWs1JYrLiDzzcramE1AMsi6oMfbS5ohN/UMyQ/AHYk29XeJxti0sOgzAQQ8dQmAToYdIbBYmGQdWEKiBRTs932beyn2zK6KKi/zTIkOOBAiUYBhYVajR4Ei/iNQxiPvOZXuYWjm9jkvox9XGyqe80/ETdsYmjaOBBTmO/s9dDuLKN7/3Eq9dp70Qb9Y0jUwAAAA=="
  35812. }, function(e, t, i) {
  35813. "use strict";
  35814. i.r(t), t.default =
  35815. "data:font/ttf;base64,AAEAAAALAIAAAwAwR1NVQiCLJXoAAAE4AAAAVE9TLzI8QUzCAAABjAAAAGBjbWFwKVYfngAAAhwAAAI8Z2x5ZsYVxmoAAAR0AAAJaGhlYWQgyzh9AAAA4AAAADZoaGVhB94DjQAAALwAAAAkaG10eDAAAAAAAAHsAAAAMGxvY2EQiA60AAAEWAAAABptYXhwASMA4wAAARgAAAAgbmFtZRCjPLAAAA3cAAACZ3Bvc3QZ7sqZAAAQRAAAAJwAAQAAA4D/gABcBAAAAAAABAAAAQAAAAAAAAAAAAAAAAAAAAwAAQAAAAEAAJwGiSpfDzz1AAsEAAAAAADe1fo+AAAAAN7V+j4AAP+fBAADZQAAAAgAAgAAAAAAAAABAAAADADXAA0AAAAAAAIAAAAKAAoAAAD/AAAAAAAAAAEAAAAKADAAPgACREZMVAAObGF0bgAaAAQAAAAAAAAAAQAAAAQAAAAAAAAAAQAAAAFsaWdhAAgAAAABAAAAAQAEAAQAAAABAAgAAQAGAAAAAQAAAAQEAAGQAAUAAAKJAswAAACPAokCzAAAAesAMgEIAAACAAUDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFBmRWQAwOYs6fIDgP+AAAAD3ACAAAAAAQAAAAAAAAAAAAAAAAACBAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAAAAAABQAAAAMAAAAsAAAABAAAAagAAQAAAAAAogADAAEAAAAsAAMACgAAAagABAB2AAAAFAAQAAMABOYs5i7m5ed36Kvorei76MDp8v//AADmLOYu5uXnd+ir6K3ouui/6fL//wAAAAAAAAAAAAAAAAAAAAAAAAABABQAFAAUABQAFAAUABQAFgAYAAAABAABAAMAAgALAAoACQAIAAcABgAFAAABBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAACUAAAAAAAAAAsAAOYsAADmLAAAAAQAAOYuAADmLgAAAAEAAOblAADm5QAAAAMAAOd3AADndwAAAAIAAOirAADoqwAAAAsAAOitAADorQAAAAoAAOi6AADougAAAAkAAOi7AADouwAAAAgAAOi/AADovwAAAAcAAOjAAADowAAAAAYAAOnyAADp8gAAAAUAAAAAAEQApgEgAkwC4ANMA3YD8gQaBIQEtAAAAAQAAAAAA8ADAAAHAA8AHAAoAAABFzMRIREzNwUhByMRIREjBzIeARQOASIuATQ+ARciDgEUHgEzMjY0JgK/QcD8gMBAAUn+7kCdAsydyS9PLy9PXk8vL08vFicWFicWIjExAwCA/YACgIBagP40AcwjL09eTy8vT15PL1oWJywnFjFFMAAAAAAEAAAAAAP/Av8AIgAyADYAPwAAASYGDwE1NC4BIyEiDgEVERQeATMhMj4BPQEXHgE+ATURNCYDFAYjISImNRE0NjMhMhYVEyc1NyUyHgEGIiY0NgPeECIPXiI6I/3DIzoiIjojAj0jOiJeDyIfERH+JBn93xkkJBkCIRkkxnR0/TcaJQEmNSUlAoMJAQo6OCI7IiI7Iv4CIjsiIjsiODoKAREeEQGYER7+EhkjIxkB4hkjIxn+W0feRzAlNSUlNSUAAAAABQAA/9UEAAMrAB8ALQA6AEcAUAAAATIfAjMyFh8CERQGDwEhIiYvARE0Nj8BMzc2PwIXBw4BIycRIREjIiYvAQcyHgEUDgEiLgE0PgEXIg4BFB4BMj4BNC4BJTIWFAYiJjQ2Ap0gFgQuuxYiBgEBHxkI/IAYIwQBHxkIuy4NHQgIDTUFFQzAA1bACxMGN5BGdUVFdYx1RUV1Ri5PLi5PXE8uLk8BEhslJTYlJQMrHQdcHBYHB/2qFyQEAR8aBwJWFyQEAVwZCAIBVWkLDQH91QIqCgltgEV1i3ZFRXaLdUVVLk9bUC0uTl1OLismNSUlNSYAAAsAAP/PA78DNwAMABkAJwA4AEUAUgBjAI8AtQDKANYAAAEiLgE0PgEyHgEUDgEDIg4BFB4BMj4BNC4BByImPQE0PgEeAQ8BFAY3Ii4BNz4BMzIWFAYjIgYHBgUiLgE0PgEyHgEUDgEDIg4BFB4BMj4BNC4BByIuATc+ATMyFhQGIyIGBwYTISImNRE0PgEzITIeARUHNjc2MzIXFhcWFREUBwYjMTMiLwEmJxcwNDEUBgEiBhURFBYzITI2NSc0NjMyFxYfARE0JwYHDgEHBiMiJjU3NCYjBSImPQE0NjsBMhYUBisBIgYdARQGNyMiJjQ2OwEyFhQGAQUtSywsS1lLLCxLLB4zHh4zPDIeHjJnBQgCCQoHAQEHBgQHAwMMJhYFCAgFDxoJBAGlLEssLEtZSywsSy0eMh4eMjwzHh4zWgQIAgMMJhUGCAgGDhsIBEf+GCc2GisYAegYKhkBTj0UEBMOCgMCCQwYAQwYBFc1AjX98g8ZFhIB6BAWBA8MBxkndwsBAwVaTA0IBQwPBBcP/hcFCB0TbwYHBwZvBw8Hzg0GBwcGDQUICAHwLEtYSywsS1hLLAESHjM8Mx0dMzwzHnwIBQMECgYCCQUHBQgoBQsFEhQICwgODAa+LEtYSywsS1hLLAESHjM8Mx0dMzwzHlQFCwUSFAgLCA4MBv0hLyQBVxkvHBosGQ4pIQkNChAJD/6bGAwRBwIuGhYBJTIB2R4R/qkPDxIPQAsQDBM+AwFjBwQBAjEnBgQRDDgRGaMIBkIUJQgKCBUKQgYIbwgKCAgKCAAAAAgAAP+fA9YDZQAWAB0AKgA0AD0ARABOAFcAAAEmJyYnJgYHBgcGFhcWFxY2NzY3NjU0JyEiBzceAQMUDgEiLgE0PgEyHgEDMhcDBgcnNjc2BRMWFxYXISY2EyEyNwcuAQUiJxM2NxcGBwYlAyYnJichFgYDsC5cWnJ05FNRIiMwTEpqbu1iYDc4WP6DJCGMZaO6KEVQRSgoRVBFKJUMDLwUBos8VFj+/LwNFAcI/ukjFiABfSQhjGWjAU8MDLwUBos8VFgBBLwNFAcIARcjFgI3bkpIFxdGVVJvcepbWS0tF0NBZWl3X2EN8hF6/uYoRSgoRVBFKChFAYMB/rogJvFJKSrB/rsZFAcGX8v+qw3yEXqRAQFGICbxSSkqwQFFGRQHBl/LAAAABAAA/9ED6AMvABgALABCAEMAAAEuATc+ARceAhQOAQcGLgE2Nz4BNTYnJgcmND4BFx4BFAYHBiYnLgE2NzY0ASIuAT0BND4BOwE3Nh4BFREUDgEvASMCtBINBwsnElB3QUF3UBInFgwTYm8EOTegDx0nDy8zMy8OKwsJBwcJRP3BGi0bGy0aU+oRJBkbJQ7qUwLPCiYSEgsKKIGisqKBKAoLJCQHLrNucFxZkgopHAILJm15bSYOBA8EFhcHO6b+8BorGrwaKxqzDAMaFf1sExoEC7MAAAAABAAA/8IDvQM+AAUACwARABcAADczFTMRIQEjFSMVIRMzNTM1IRM1IxEhNUPRc/68AURz0AFD8nrK/rx6egFEjMkBRQI1z3b9y8l8AWbP/rx1AAAABgAA/6ID8gNTAAsAGgAuADUAPABOAAAFASY0NjIXARYUBiIBFhUUBxc2JzYmJyYOARQ3FhcWBxQHFz4BNTQuAScmBgcGFhMOAR4BPwEDNTQuAQ8CIyIOAR0BFB4BOwEXFj4BPQEDlPynDRoiDQNaDRoj/tpFAk4XAQE0Lw8oHU9iNzkDLUcmJ0F4URInCwgOCxELFicSE/AZJRFPziMaLhoaLhpU7A4mG1EDWg0iGg38pw0jGgJtO1QODU00OT1uJgsBHSm4L1pdcWJTRzmDRVqkgigLDBISJv1LByUjCwoKAji0FBsCCz14GiwavhosGbYLBBsToAAEAAD/wQO/Az8ABQALABEAFwAANyMRITUjAzM1MzUpARUzFTMRAyMVIREjvXsBJap7e6r+2wJaqHp6qAEieuj+2nwB16x9fawBKf0AfAEmAA0AAP+tA4kDUgACAAMABgAHAAoACwAOAA8AHAAdACkANQA2AAATEQkBMxEJATcRCQEXAwkBJxQeATI+ATQuASIOARUBIgYUFhcWPgE1NCYBIgYUFhcWPgIuASOfAi/90S8CLv3SYAIz/c0CAgIw/dKRGSsyKxkZKzIrGQKMJzY2JxorGDf9qyY3NyYYKxoBGSsaAvX9FwF0AXX9FwF0AXVO/RgBcQF3nf0XAXQBdU8ZKxkZKzIrGRkrGf7oNk01AgEZLBknNv6MN0w2AQEZKzMrGQAAAgAA/8ADYQNAAA8AHwAAASMiBhURFBY7ATI2NRE0JiEjIgYVERQWOwEyNjURNCYBJ1QVHh4VVBUeHgHxVBUeHhVUFR4eA0AfFfzoFR8fFQMYFR8fFfzoFR8fFQMYFR8AAAASAN4AAQAAAAAAAAATAAAAAQAAAAAAAQAIABMAAQAAAAAAAgAHABsAAQAAAAAAAwAIACIAAQAAAAAABAAIACoAAQAAAAAABQALADIAAQAAAAAABgAIAD0AAQAAAAAACgArAEUAAQAAAAAACwATAHAAAwABBAkAAAAmAIMAAwABBAkAAQAQAKkAAwABBAkAAgAOALkAAwABBAkAAwAQAMcAAwABBAkABAAQANcAAwABBAkABQAWAOcAAwABBAkABgAQAP0AAwABBAkACgBWAQ0AAwABBAkACwAmAWNDcmVhdGVkIGJ5IGljb25mb250aWNvbmZvbnRSZWd1bGFyaWNvbmZvbnRpY29uZm9udFZlcnNpb24gMS4waWNvbmZvbnRHZW5lcmF0ZWQgYnkgc3ZnMnR0ZiBmcm9tIEZvbnRlbGxvIHByb2plY3QuaHR0cDovL2ZvbnRlbGxvLmNvbQBDAHIAZQBhAHQAZQBkACAAYgB5ACAAaQBjAG8AbgBmAG8AbgB0AGkAYwBvAG4AZgBvAG4AdABSAGUAZwB1AGwAYQByAGkAYwBvAG4AZgBvAG4AdABpAGMAbwBuAGYAbwBuAHQAVgBlAHIAcwBpAG8AbgAgADEALgAwAGkAYwBvAG4AZgBvAG4AdABHAGUAbgBlAHIAYQB0AGUAZAAgAGIAeQAgAHMAdgBnADIAdAB0AGYAIABmAHIAbwBtACAARgBvAG4AdABlAGwAbABvACAAcAByAG8AagBlAGMAdAAuAGgAdAB0AHAAOgAvAC8AZgBvAG4AdABlAGwAbABvAC4AYwBvAG0AAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQAHeGlhbmdqaQhsdXhpYW5nMgh4aWFuZ2ppMQdsdXhpYW5nCHNuYXBzaG90CXNoZW5neWluMQh4aWFvcGluZwdqaW5neWluCXF1YW5waW5nMQZib2ZhbmcHemFudGluZwAA"
  35816. }, function(e, t, i) {
  35817. (t = e.exports = i(73)).Stream = t, t.Readable = t, t.Writable = i(77), t.Duplex = i(26), t.Transform = i(
  35818. 78), t.PassThrough = i(142), t.finished = i(46), t.pipeline = i(143)
  35819. }, function(e, t) {}, function(e, t, i) {
  35820. "use strict";
  35821. function r(e, t) {
  35822. var i = Object.keys(e);
  35823. if (Object.getOwnPropertySymbols) {
  35824. var r = Object.getOwnPropertySymbols(e);
  35825. t && (r = r.filter(function(t) {
  35826. return Object.getOwnPropertyDescriptor(e, t).enumerable
  35827. })), i.push.apply(i, r)
  35828. }
  35829. return i
  35830. }
  35831. function n(e, t, i) {
  35832. return t in e ? Object.defineProperty(e, t, {
  35833. value: i,
  35834. enumerable: !0,
  35835. configurable: !0,
  35836. writable: !0
  35837. }) : e[t] = i, e
  35838. }
  35839. function a(e, t) {
  35840. for (var i = 0; i < t.length; i++) {
  35841. var r = t[i];
  35842. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  35843. .defineProperty(e, r.key, r)
  35844. }
  35845. }
  35846. var s = i(10).Buffer,
  35847. o = i(139).inspect,
  35848. u = o && o.custom || "inspect";
  35849. e.exports = function() {
  35850. function e() {
  35851. ! function(e, t) {
  35852. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  35853. }(this, e), this.head = null, this.tail = null, this.length = 0
  35854. }
  35855. var t, i;
  35856. return t = e, (i = [{
  35857. key: "push",
  35858. value: function(e) {
  35859. var t = {
  35860. data: e,
  35861. next: null
  35862. };
  35863. this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length
  35864. }
  35865. }, {
  35866. key: "unshift",
  35867. value: function(e) {
  35868. var t = {
  35869. data: e,
  35870. next: this.head
  35871. };
  35872. 0 === this.length && (this.tail = t), this.head = t, ++this.length
  35873. }
  35874. }, {
  35875. key: "shift",
  35876. value: function() {
  35877. if (0 !== this.length) {
  35878. var e = this.head.data;
  35879. return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --
  35880. this.length, e
  35881. }
  35882. }
  35883. }, {
  35884. key: "clear",
  35885. value: function() {
  35886. this.head = this.tail = null, this.length = 0
  35887. }
  35888. }, {
  35889. key: "join",
  35890. value: function(e) {
  35891. if (0 === this.length) return "";
  35892. for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data;
  35893. return i
  35894. }
  35895. }, {
  35896. key: "concat",
  35897. value: function(e) {
  35898. if (0 === this.length) return s.alloc(0);
  35899. for (var t, i, r, n = s.allocUnsafe(e >>> 0), a = this.head, o = 0; a;) t = a.data, i = n,
  35900. r = o, s.prototype.copy.call(t, i, r), o += a.data.length, a = a.next;
  35901. return n
  35902. }
  35903. }, {
  35904. key: "consume",
  35905. value: function(e, t) {
  35906. var i;
  35907. return e < this.head.data.length ? (i = this.head.data.slice(0, e), this.head.data = this
  35908. .head.data.slice(e)) : i = e === this.head.data.length ? this.shift() : t ? this
  35909. ._getString(e) : this._getBuffer(e), i
  35910. }
  35911. }, {
  35912. key: "first",
  35913. value: function() {
  35914. return this.head.data
  35915. }
  35916. }, {
  35917. key: "_getString",
  35918. value: function(e) {
  35919. var t = this.head,
  35920. i = 1,
  35921. r = t.data;
  35922. for (e -= r.length; t = t.next;) {
  35923. var n = t.data,
  35924. a = e > n.length ? n.length : e;
  35925. if (a === n.length ? r += n : r += n.slice(0, e), 0 == (e -= a)) {
  35926. a === n.length ? (++i, t.next ? this.head = t.next : this.head = this.tail = null) : (
  35927. this.head = t, t.data = n.slice(a));
  35928. break
  35929. }++i
  35930. }
  35931. return this.length -= i, r
  35932. }
  35933. }, {
  35934. key: "_getBuffer",
  35935. value: function(e) {
  35936. var t = s.allocUnsafe(e),
  35937. i = this.head,
  35938. r = 1;
  35939. for (i.data.copy(t), e -= i.data.length; i = i.next;) {
  35940. var n = i.data,
  35941. a = e > n.length ? n.length : e;
  35942. if (n.copy(t, t.length - e, 0, a), 0 == (e -= a)) {
  35943. a === n.length ? (++r, i.next ? this.head = i.next : this.head = this.tail = null) : (
  35944. this.head = i, i.data = n.slice(a));
  35945. break
  35946. }++r
  35947. }
  35948. return this.length -= r, t
  35949. }
  35950. }, {
  35951. key: u,
  35952. value: function(e, t) {
  35953. return o(this, function(e) {
  35954. for (var t = 1; t < arguments.length; t++) {
  35955. var i = null != arguments[t] ? arguments[t] : {};
  35956. t % 2 ? r(Object(i), !0).forEach(function(t) {
  35957. n(e, t, i[t])
  35958. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object
  35959. .getOwnPropertyDescriptors(i)) : r(Object(i)).forEach(function(t) {
  35960. Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t))
  35961. })
  35962. }
  35963. return e
  35964. }({}, t, {
  35965. depth: 0,
  35966. customInspect: !1
  35967. }))
  35968. }
  35969. }]) && a(t.prototype, i), e
  35970. }()
  35971. }, function(e, t) {}, function(e, t, i) {
  35972. "use strict";
  35973. (function(t) {
  35974. var r;
  35975. function n(e, t, i) {
  35976. return t in e ? Object.defineProperty(e, t, {
  35977. value: i,
  35978. enumerable: !0,
  35979. configurable: !0,
  35980. writable: !0
  35981. }) : e[t] = i, e
  35982. }
  35983. var a = i(46),
  35984. s = Symbol("lastResolve"),
  35985. o = Symbol("lastReject"),
  35986. u = Symbol("error"),
  35987. l = Symbol("ended"),
  35988. d = Symbol("lastPromise"),
  35989. c = Symbol("handlePromise"),
  35990. h = Symbol("stream");
  35991. function f(e, t) {
  35992. return {
  35993. value: e,
  35994. done: t
  35995. }
  35996. }
  35997. function p(e) {
  35998. var t = e[s];
  35999. if (null !== t) {
  36000. var i = e[h].read();
  36001. null !== i && (e[d] = null, e[s] = null, e[o] = null, t(f(i, !1)))
  36002. }
  36003. }
  36004. function m(e) {
  36005. t.nextTick(p, e)
  36006. }
  36007. var g = Object.getPrototypeOf(function() {}),
  36008. v = Object.setPrototypeOf((n(r = {
  36009. get stream() {
  36010. return this[h]
  36011. },
  36012. next: function() {
  36013. var e = this,
  36014. i = this[u];
  36015. if (null !== i) return Promise.reject(i);
  36016. if (this[l]) return Promise.resolve(f(void 0, !0));
  36017. if (this[h].destroyed) return new Promise(function(i, r) {
  36018. t.nextTick(function() {
  36019. e[u] ? r(e[u]) : i(f(void 0, !0))
  36020. })
  36021. });
  36022. var r, n = this[d];
  36023. if (n) r = new Promise(function(e, t) {
  36024. return function(i, r) {
  36025. e.then(function() {
  36026. t[l] ? i(f(void 0, !0)) : t[c](i, r)
  36027. }, r)
  36028. }
  36029. }(n, this));
  36030. else {
  36031. var a = this[h].read();
  36032. if (null !== a) return Promise.resolve(f(a, !1));
  36033. r = new Promise(this[c])
  36034. }
  36035. return this[d] = r, r
  36036. }
  36037. }, Symbol.asyncIterator, function() {
  36038. return this
  36039. }), n(r, "return", function() {
  36040. var e = this;
  36041. return new Promise(function(t, i) {
  36042. e[h].destroy(null, function(e) {
  36043. e ? i(e) : t(f(void 0, !0))
  36044. })
  36045. })
  36046. }), r), g);
  36047. e.exports = function(e) {
  36048. var t, i = Object.create(v, (n(t = {}, h, {
  36049. value: e,
  36050. writable: !0
  36051. }), n(t, s, {
  36052. value: null,
  36053. writable: !0
  36054. }), n(t, o, {
  36055. value: null,
  36056. writable: !0
  36057. }), n(t, u, {
  36058. value: null,
  36059. writable: !0
  36060. }), n(t, l, {
  36061. value: e._readableState.endEmitted,
  36062. writable: !0
  36063. }), n(t, c, {
  36064. value: function(e, t) {
  36065. var r = i[h].read();
  36066. r ? (i[d] = null, i[s] = null, i[o] = null, e(f(r, !1))) : (i[s] = e, i[o] = t)
  36067. },
  36068. writable: !0
  36069. }), t));
  36070. return i[d] = null, a(e, function(e) {
  36071. if (e && "ERR_STREAM_PREMATURE_CLOSE" !== e.code) {
  36072. var t = i[o];
  36073. return null !== t && (i[d] = null, i[s] = null, i[o] = null, t(e)), void(i[u] = e)
  36074. }
  36075. var r = i[s];
  36076. null !== r && (i[d] = null, i[s] = null, i[o] = null, r(f(void 0, !0))), i[l] = !0
  36077. }), e.on("readable", m.bind(null, i)), i
  36078. }
  36079. }).call(this, i(9))
  36080. }, function(e, t) {
  36081. e.exports = function() {
  36082. throw new Error("Readable.from is not available in the browser")
  36083. }
  36084. }, function(e, t, i) {
  36085. "use strict";
  36086. e.exports = n;
  36087. var r = i(78);
  36088. function n(e) {
  36089. if (!(this instanceof n)) return new n(e);
  36090. r.call(this, e)
  36091. }
  36092. i(5)(n, r), n.prototype._transform = function(e, t, i) {
  36093. i(null, e)
  36094. }
  36095. }, function(e, t, i) {
  36096. "use strict";
  36097. var r, n = i(25).codes,
  36098. a = n.ERR_MISSING_ARGS,
  36099. s = n.ERR_STREAM_DESTROYED;
  36100. function o(e) {
  36101. if (e) throw e
  36102. }
  36103. function u(e, t, n, a) {
  36104. a = function(e) {
  36105. var t = !1;
  36106. return function() {
  36107. t || (t = !0, e.apply(void 0, arguments))
  36108. }
  36109. }(a);
  36110. var o = !1;
  36111. e.on("close", function() {
  36112. o = !0
  36113. }), void 0 === r && (r = i(46)), r(e, {
  36114. readable: t,
  36115. writable: n
  36116. }, function(e) {
  36117. if (e) return a(e);
  36118. o = !0, a()
  36119. });
  36120. var u = !1;
  36121. return function(t) {
  36122. if (!o && !u) return u = !0,
  36123. function(e) {
  36124. return e.setHeader && "function" == typeof e.abort
  36125. }(e) ? e.abort() : "function" == typeof e.destroy ? e.destroy() : void a(t || new s("pipe"))
  36126. }
  36127. }
  36128. function l(e) {
  36129. e()
  36130. }
  36131. function d(e, t) {
  36132. return e.pipe(t)
  36133. }
  36134. e.exports = function() {
  36135. for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  36136. var r, n = function(e) {
  36137. return e.length ? "function" != typeof e[e.length - 1] ? o : e.pop() : o
  36138. }(t);
  36139. if (Array.isArray(t[0]) && (t = t[0]), t.length < 2) throw new a("streams");
  36140. var s = t.map(function(e, i) {
  36141. var a = i < t.length - 1;
  36142. return u(e, a, i > 0, function(e) {
  36143. r || (r = e), e && s.forEach(l), a || (s.forEach(l), n(r))
  36144. })
  36145. });
  36146. return t.reduce(d)
  36147. }
  36148. }, function(e, t, i) {
  36149. var r = i(5),
  36150. n = i(27),
  36151. a = i(6).Buffer,
  36152. s = [1518500249, 1859775393, -1894007588, -899497514],
  36153. o = new Array(80);
  36154. function u() {
  36155. this.init(), this._w = o, n.call(this, 64, 56)
  36156. }
  36157. function l(e) {
  36158. return e << 30 | e >>> 2
  36159. }
  36160. function d(e, t, i, r) {
  36161. return 0 === e ? t & i | ~t & r : 2 === e ? t & i | t & r | i & r : t ^ i ^ r
  36162. }
  36163. r(u, n), u.prototype.init = function() {
  36164. return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e =
  36165. 3285377520, this
  36166. }, u.prototype._update = function(e) {
  36167. for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, a = 0 | this._c, o = 0 | this._d, u = 0 |
  36168. this._e, c = 0; c < 16; ++c) i[c] = e.readInt32BE(4 * c);
  36169. for (; c < 80; ++c) i[c] = i[c - 3] ^ i[c - 8] ^ i[c - 14] ^ i[c - 16];
  36170. for (var h = 0; h < 80; ++h) {
  36171. var f = ~~(h / 20),
  36172. p = 0 | ((t = r) << 5 | t >>> 27) + d(f, n, a, o) + u + i[h] + s[f];
  36173. u = o, o = a, a = l(n), n = r, r = p
  36174. }
  36175. this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = a + this._c | 0, this._d = o + this._d |
  36176. 0, this._e = u + this._e | 0
  36177. }, u.prototype._hash = function() {
  36178. var e = a.allocUnsafe(20);
  36179. return e.writeInt32BE(0 | this._a, 0), e.writeInt32BE(0 | this._b, 4), e.writeInt32BE(0 | this._c, 8), e
  36180. .writeInt32BE(0 | this._d, 12), e.writeInt32BE(0 | this._e, 16), e
  36181. }, e.exports = u
  36182. }, function(e, t, i) {
  36183. var r = i(5),
  36184. n = i(27),
  36185. a = i(6).Buffer,
  36186. s = [1518500249, 1859775393, -1894007588, -899497514],
  36187. o = new Array(80);
  36188. function u() {
  36189. this.init(), this._w = o, n.call(this, 64, 56)
  36190. }
  36191. function l(e) {
  36192. return e << 5 | e >>> 27
  36193. }
  36194. function d(e) {
  36195. return e << 30 | e >>> 2
  36196. }
  36197. function c(e, t, i, r) {
  36198. return 0 === e ? t & i | ~t & r : 2 === e ? t & i | t & r | i & r : t ^ i ^ r
  36199. }
  36200. r(u, n), u.prototype.init = function() {
  36201. return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e =
  36202. 3285377520, this
  36203. }, u.prototype._update = function(e) {
  36204. for (var t, i = this._w, r = 0 | this._a, n = 0 | this._b, a = 0 | this._c, o = 0 | this._d, u = 0 |
  36205. this._e, h = 0; h < 16; ++h) i[h] = e.readInt32BE(4 * h);
  36206. for (; h < 80; ++h) i[h] = (t = i[h - 3] ^ i[h - 8] ^ i[h - 14] ^ i[h - 16]) << 1 | t >>> 31;
  36207. for (var f = 0; f < 80; ++f) {
  36208. var p = ~~(f / 20),
  36209. m = l(r) + c(p, n, a, o) + u + i[f] + s[p] | 0;
  36210. u = o, o = a, a = d(n), n = r, r = m
  36211. }
  36212. this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = a + this._c | 0, this._d = o + this._d |
  36213. 0, this._e = u + this._e | 0
  36214. }, u.prototype._hash = function() {
  36215. var e = a.allocUnsafe(20);
  36216. return e.writeInt32BE(0 | this._a, 0), e.writeInt32BE(0 | this._b, 4), e.writeInt32BE(0 | this._c, 8), e
  36217. .writeInt32BE(0 | this._d, 12), e.writeInt32BE(0 | this._e, 16), e
  36218. }, e.exports = u
  36219. }, function(e, t, i) {
  36220. var r = i(5),
  36221. n = i(79),
  36222. a = i(27),
  36223. s = i(6).Buffer,
  36224. o = new Array(64);
  36225. function u() {
  36226. this.init(), this._w = o, a.call(this, 64, 56)
  36227. }
  36228. r(u, n), u.prototype.init = function() {
  36229. return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, this._e =
  36230. 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, this
  36231. }, u.prototype._hash = function() {
  36232. var e = s.allocUnsafe(28);
  36233. return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e
  36234. .writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(
  36235. this._g, 24), e
  36236. }, e.exports = u
  36237. }, function(e, t, i) {
  36238. var r = i(5),
  36239. n = i(80),
  36240. a = i(27),
  36241. s = i(6).Buffer,
  36242. o = new Array(160);
  36243. function u() {
  36244. this.init(), this._w = o, a.call(this, 128, 112)
  36245. }
  36246. r(u, n), u.prototype.init = function() {
  36247. return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, this
  36248. ._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, this._al =
  36249. 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, this._el = 4290775857,
  36250. this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, this
  36251. }, u.prototype._hash = function() {
  36252. var e = s.allocUnsafe(48);
  36253. function t(t, i, r) {
  36254. e.writeInt32BE(t, r), e.writeInt32BE(i, r + 4)
  36255. }
  36256. return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this
  36257. ._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), e
  36258. }, e.exports = u
  36259. }, function(e, t, i) {
  36260. e.exports = n;
  36261. var r = i(8).EventEmitter;
  36262. function n() {
  36263. r.call(this)
  36264. }
  36265. i(5)(n, r), n.Readable = i(49), n.Writable = i(155), n.Duplex = i(156), n.Transform = i(157), n
  36266. .PassThrough = i(158), n.Stream = n, n.prototype.pipe = function(e, t) {
  36267. var i = this;
  36268. function n(t) {
  36269. e.writable && !1 === e.write(t) && i.pause && i.pause()
  36270. }
  36271. function a() {
  36272. i.readable && i.resume && i.resume()
  36273. }
  36274. i.on("data", n), e.on("drain", a), e._isStdio || t && !1 === t.end || (i.on("end", o), i.on("close",
  36275. u));
  36276. var s = !1;
  36277. function o() {
  36278. s || (s = !0, e.end())
  36279. }
  36280. function u() {
  36281. s || (s = !0, "function" == typeof e.destroy && e.destroy())
  36282. }
  36283. function l(e) {
  36284. if (d(), 0 === r.listenerCount(this, "error")) throw e
  36285. }
  36286. function d() {
  36287. i.removeListener("data", n), e.removeListener("drain", a), i.removeListener("end", o), i
  36288. .removeListener("close", u), i.removeListener("error", l), e.removeListener("error", l), i
  36289. .removeListener("end", d), i.removeListener("close", d), e.removeListener("close", d)
  36290. }
  36291. return i.on("error", l), e.on("error", l), i.on("end", d), i.on("close", d), e.on("close", d), e.emit(
  36292. "pipe", i), e
  36293. }
  36294. }, function(e, t) {}, function(e, t, i) {
  36295. "use strict";
  36296. var r = i(50).Buffer,
  36297. n = i(151);
  36298. e.exports = function() {
  36299. function e() {
  36300. ! function(e, t) {
  36301. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  36302. }(this, e), this.head = null, this.tail = null, this.length = 0
  36303. }
  36304. return e.prototype.push = function(e) {
  36305. var t = {
  36306. data: e,
  36307. next: null
  36308. };
  36309. this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length
  36310. }, e.prototype.unshift = function(e) {
  36311. var t = {
  36312. data: e,
  36313. next: this.head
  36314. };
  36315. 0 === this.length && (this.tail = t), this.head = t, ++this.length
  36316. }, e.prototype.shift = function() {
  36317. if (0 !== this.length) {
  36318. var e = this.head.data;
  36319. return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --this
  36320. .length, e
  36321. }
  36322. }, e.prototype.clear = function() {
  36323. this.head = this.tail = null, this.length = 0
  36324. }, e.prototype.join = function(e) {
  36325. if (0 === this.length) return "";
  36326. for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data;
  36327. return i
  36328. }, e.prototype.concat = function(e) {
  36329. if (0 === this.length) return r.alloc(0);
  36330. if (1 === this.length) return this.head.data;
  36331. for (var t, i, n = r.allocUnsafe(e >>> 0), a = this.head, s = 0; a;) t = n, i = s, a.data.copy(t,
  36332. i), s += a.data.length, a = a.next;
  36333. return n
  36334. }, e
  36335. }(), n && n.inspect && n.inspect.custom && (e.exports.prototype[n.inspect.custom] = function() {
  36336. var e = n.inspect({
  36337. length: this.length
  36338. });
  36339. return this.constructor.name + " " + e
  36340. })
  36341. }, function(e, t) {}, function(e, t, i) {
  36342. (function(e) {
  36343. var r = void 0 !== e && e || "undefined" != typeof self && self || window,
  36344. n = Function.prototype.apply;
  36345. function a(e, t) {
  36346. this._id = e, this._clearFn = t
  36347. }
  36348. t.setTimeout = function() {
  36349. return new a(n.call(setTimeout, r, arguments), clearTimeout)
  36350. }, t.setInterval = function() {
  36351. return new a(n.call(setInterval, r, arguments), clearInterval)
  36352. }, t.clearTimeout = t.clearInterval = function(e) {
  36353. e && e.close()
  36354. }, a.prototype.unref = a.prototype.ref = function() {}, a.prototype.close = function() {
  36355. this._clearFn.call(r, this._id)
  36356. }, t.enroll = function(e, t) {
  36357. clearTimeout(e._idleTimeoutId), e._idleTimeout = t
  36358. }, t.unenroll = function(e) {
  36359. clearTimeout(e._idleTimeoutId), e._idleTimeout = -1
  36360. }, t._unrefActive = t.active = function(e) {
  36361. clearTimeout(e._idleTimeoutId);
  36362. var t = e._idleTimeout;
  36363. t >= 0 && (e._idleTimeoutId = setTimeout(function() {
  36364. e._onTimeout && e._onTimeout()
  36365. }, t))
  36366. }, i(153), t.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== e && e
  36367. .setImmediate || this && this.setImmediate, t.clearImmediate = "undefined" != typeof self && self
  36368. .clearImmediate || void 0 !== e && e.clearImmediate || this && this.clearImmediate
  36369. }).call(this, i(13))
  36370. }, function(e, t, i) {
  36371. (function(e, t) {
  36372. ! function(e, i) {
  36373. "use strict";
  36374. if (!e.setImmediate) {
  36375. var r, n, a, s, o, u = 1,
  36376. l = {},
  36377. d = !1,
  36378. c = e.document,
  36379. h = Object.getPrototypeOf && Object.getPrototypeOf(e);
  36380. h = h && h.setTimeout ? h : e, "[object process]" === {}.toString.call(e.process) ? r = function(
  36381. e) {
  36382. t.nextTick(function() {
  36383. p(e)
  36384. })
  36385. } : function() {
  36386. if (e.postMessage && !e.importScripts) {
  36387. var t = !0,
  36388. i = e.onmessage;
  36389. return e.onmessage = function() {
  36390. t = !1
  36391. }, e.postMessage("", "*"), e.onmessage = i, t
  36392. }
  36393. }() ? (s = "setImmediate$" + Math.random() + "$", o = function(t) {
  36394. t.source === e && "string" == typeof t.data && 0 === t.data.indexOf(s) && p(+t.data.slice(s
  36395. .length))
  36396. }, e.addEventListener ? e.addEventListener("message", o, !1) : e.attachEvent("onmessage", o),
  36397. r = function(t) {
  36398. e.postMessage(s + t, "*")
  36399. }) : e.MessageChannel ? ((a = new MessageChannel).port1.onmessage = function(e) {
  36400. p(e.data)
  36401. }, r = function(e) {
  36402. a.port2.postMessage(e)
  36403. }) : c && "onreadystatechange" in c.createElement("script") ? (n = c.documentElement, r =
  36404. function(e) {
  36405. var t = c.createElement("script");
  36406. t.onreadystatechange = function() {
  36407. p(e), t.onreadystatechange = null, n.removeChild(t), t = null
  36408. }, n.appendChild(t)
  36409. }) : r = function(e) {
  36410. setTimeout(p, 0, e)
  36411. }, h.setImmediate = function(e) {
  36412. "function" != typeof e && (e = new Function("" + e));
  36413. for (var t = new Array(arguments.length - 1), i = 0; i < t.length; i++) t[i] = arguments[i + 1];
  36414. var n = {
  36415. callback: e,
  36416. args: t
  36417. };
  36418. return l[u] = n, r(u), u++
  36419. }, h.clearImmediate = f
  36420. }
  36421. function f(e) {
  36422. delete l[e]
  36423. }
  36424. function p(e) {
  36425. if (d) setTimeout(p, 0, e);
  36426. else {
  36427. var t = l[e];
  36428. if (t) {
  36429. d = !0;
  36430. try {
  36431. ! function(e) {
  36432. var t = e.callback,
  36433. i = e.args;
  36434. switch (i.length) {
  36435. case 0:
  36436. t();
  36437. break;
  36438. case 1:
  36439. t(i[0]);
  36440. break;
  36441. case 2:
  36442. t(i[0], i[1]);
  36443. break;
  36444. case 3:
  36445. t(i[0], i[1], i[2]);
  36446. break;
  36447. default:
  36448. t.apply(void 0, i)
  36449. }
  36450. }(t)
  36451. } finally {
  36452. f(e), d = !1
  36453. }
  36454. }
  36455. }
  36456. }
  36457. }("undefined" == typeof self ? void 0 === e ? this : e : self)
  36458. }).call(this, i(13), i(9))
  36459. }, function(e, t, i) {
  36460. "use strict";
  36461. e.exports = a;
  36462. var r = i(84),
  36463. n = Object.create(i(32));
  36464. function a(e) {
  36465. if (!(this instanceof a)) return new a(e);
  36466. r.call(this, e)
  36467. }
  36468. n.inherits = i(5), n.inherits(a, r), a.prototype._transform = function(e, t, i) {
  36469. i(null, e)
  36470. }
  36471. }, function(e, t, i) {
  36472. e.exports = i(51)
  36473. }, function(e, t, i) {
  36474. e.exports = i(23)
  36475. }, function(e, t, i) {
  36476. e.exports = i(49).Transform
  36477. }, function(e, t, i) {
  36478. e.exports = i(49).PassThrough
  36479. }, function(e, t, i) {
  36480. "use strict";
  36481. var r = i(5),
  36482. n = i(6).Buffer,
  36483. a = i(20),
  36484. s = n.alloc(128);
  36485. function o(e, t) {
  36486. a.call(this, "digest"), "string" == typeof t && (t = n.from(t)), this._alg = e, this._key = t, t.length >
  36487. 64 ? t = e(t) : t.length < 64 && (t = n.concat([t, s], 64));
  36488. for (var i = this._ipad = n.allocUnsafe(64), r = this._opad = n.allocUnsafe(64), o = 0; o < 64; o++) i[
  36489. o] = 54 ^ t[o], r[o] = 92 ^ t[o];
  36490. this._hash = [i]
  36491. }
  36492. r(o, a), o.prototype._update = function(e) {
  36493. this._hash.push(e)
  36494. }, o.prototype._final = function() {
  36495. var e = this._alg(n.concat(this._hash));
  36496. return this._alg(n.concat([this._opad, e]))
  36497. }, e.exports = o
  36498. }, function(e, t, i) {
  36499. e.exports = i(87)
  36500. }, function(e, t, i) {
  36501. (function(t) {
  36502. var r, n, a = i(6).Buffer,
  36503. s = i(89),
  36504. o = i(90),
  36505. u = i(91),
  36506. l = i(92),
  36507. d = t.crypto && t.crypto.subtle,
  36508. c = {
  36509. sha: "SHA-1",
  36510. "sha-1": "SHA-1",
  36511. sha1: "SHA-1",
  36512. sha256: "SHA-256",
  36513. "sha-256": "SHA-256",
  36514. sha384: "SHA-384",
  36515. "sha-384": "SHA-384",
  36516. "sha-512": "SHA-512",
  36517. sha512: "SHA-512"
  36518. },
  36519. h = [];
  36520. function f() {
  36521. return n || (n = t.process && t.process.nextTick ? t.process.nextTick : t.queueMicrotask ? t
  36522. .queueMicrotask : t.setImmediate ? t.setImmediate : t.setTimeout)
  36523. }
  36524. function p(e, t, i, r, n) {
  36525. return d.importKey("raw", e, {
  36526. name: "PBKDF2"
  36527. }, !1, ["deriveBits"]).then(function(e) {
  36528. return d.deriveBits({
  36529. name: "PBKDF2",
  36530. salt: t,
  36531. iterations: i,
  36532. hash: {
  36533. name: n
  36534. }
  36535. }, e, r << 3)
  36536. }).then(function(e) {
  36537. return a.from(e)
  36538. })
  36539. }
  36540. e.exports = function(e, i, n, m, g, v) {
  36541. "function" == typeof g && (v = g, g = void 0);
  36542. var y = c[(g = g || "sha1").toLowerCase()];
  36543. if (y && "function" == typeof t.Promise) {
  36544. if (s(n, m), e = l(e, o, "Password"), i = l(i, o, "Salt"), "function" != typeof v)
  36545. throw new Error("No callback provided to pbkdf2");
  36546. ! function(e, t) {
  36547. e.then(function(e) {
  36548. f()(function() {
  36549. t(null, e)
  36550. })
  36551. }, function(e) {
  36552. f()(function() {
  36553. t(e)
  36554. })
  36555. })
  36556. }(function(e) {
  36557. if (t.process && !t.process.browser) return Promise.resolve(!1);
  36558. if (!d || !d.importKey || !d.deriveBits) return Promise.resolve(!1);
  36559. if (void 0 !== h[e]) return h[e];
  36560. var i = p(r = r || a.alloc(8), r, 10, 128, e).then(function() {
  36561. return !0
  36562. }).catch(function() {
  36563. return !1
  36564. });
  36565. return h[e] = i, i
  36566. }(y).then(function(t) {
  36567. return t ? p(e, i, n, m, y) : u(e, i, n, m, g)
  36568. }), v)
  36569. } else f()(function() {
  36570. var t;
  36571. try {
  36572. t = u(e, i, n, m, g)
  36573. } catch (e) {
  36574. return v(e)
  36575. }
  36576. v(null, t)
  36577. })
  36578. }
  36579. }).call(this, i(13))
  36580. }, function(e, t, i) {
  36581. var r = i(163),
  36582. n = i(53),
  36583. a = i(54),
  36584. s = i(176),
  36585. o = i(40);
  36586. function u(e, t, i) {
  36587. if (e = e.toLowerCase(), a[e]) return n.createCipheriv(e, t, i);
  36588. if (s[e]) return new r({
  36589. key: t,
  36590. iv: i,
  36591. mode: e
  36592. });
  36593. throw new TypeError("invalid suite type")
  36594. }
  36595. function l(e, t, i) {
  36596. if (e = e.toLowerCase(), a[e]) return n.createDecipheriv(e, t, i);
  36597. if (s[e]) return new r({
  36598. key: t,
  36599. iv: i,
  36600. mode: e,
  36601. decrypt: !0
  36602. });
  36603. throw new TypeError("invalid suite type")
  36604. }
  36605. t.createCipher = t.Cipher = function(e, t) {
  36606. var i, r;
  36607. if (e = e.toLowerCase(), a[e]) i = a[e].key, r = a[e].iv;
  36608. else {
  36609. if (!s[e]) throw new TypeError("invalid suite type");
  36610. i = 8 * s[e].key, r = s[e].iv
  36611. }
  36612. var n = o(t, !1, i, r);
  36613. return u(e, n.key, n.iv)
  36614. }, t.createCipheriv = t.Cipheriv = u, t.createDecipher = t.Decipher = function(e, t) {
  36615. var i, r;
  36616. if (e = e.toLowerCase(), a[e]) i = a[e].key, r = a[e].iv;
  36617. else {
  36618. if (!s[e]) throw new TypeError("invalid suite type");
  36619. i = 8 * s[e].key, r = s[e].iv
  36620. }
  36621. var n = o(t, !1, i, r);
  36622. return l(e, n.key, n.iv)
  36623. }, t.createDecipheriv = t.Decipheriv = l, t.listCiphers = t.getCiphers = function() {
  36624. return Object.keys(s).concat(n.getCiphers())
  36625. }
  36626. }, function(e, t, i) {
  36627. var r = i(20),
  36628. n = i(164),
  36629. a = i(5),
  36630. s = i(6).Buffer,
  36631. o = {
  36632. "des-ede3-cbc": n.CBC.instantiate(n.EDE),
  36633. "des-ede3": n.EDE,
  36634. "des-ede-cbc": n.CBC.instantiate(n.EDE),
  36635. "des-ede": n.EDE,
  36636. "des-cbc": n.CBC.instantiate(n.DES),
  36637. "des-ecb": n.DES
  36638. };
  36639. function u(e) {
  36640. r.call(this);
  36641. var t, i = e.mode.toLowerCase(),
  36642. n = o[i];
  36643. t = e.decrypt ? "decrypt" : "encrypt";
  36644. var a = e.key;
  36645. s.isBuffer(a) || (a = s.from(a)), "des-ede" !== i && "des-ede-cbc" !== i || (a = s.concat([a, a.slice(0,
  36646. 8)]));
  36647. var u = e.iv;
  36648. s.isBuffer(u) || (u = s.from(u)), this._des = n.create({
  36649. key: a,
  36650. iv: u,
  36651. type: t
  36652. })
  36653. }
  36654. o.des = o["des-cbc"], o.des3 = o["des-ede3-cbc"], e.exports = u, a(u, r), u.prototype._update = function(
  36655. e) {
  36656. return s.from(this._des.update(e))
  36657. }, u.prototype._final = function() {
  36658. return s.from(this._des.final())
  36659. }
  36660. }, function(e, t, i) {
  36661. "use strict";
  36662. t.utils = i(93), t.Cipher = i(52), t.DES = i(94), t.CBC = i(165), t.EDE = i(166)
  36663. }, function(e, t, i) {
  36664. "use strict";
  36665. var r = i(14),
  36666. n = i(5),
  36667. a = {};
  36668. t.instantiate = function(e) {
  36669. function t(t) {
  36670. e.call(this, t), this._cbcInit()
  36671. }
  36672. n(t, e);
  36673. for (var i = Object.keys(a), r = 0; r < i.length; r++) {
  36674. var s = i[r];
  36675. t.prototype[s] = a[s]
  36676. }
  36677. return t.create = function(e) {
  36678. return new t(e)
  36679. }, t
  36680. }, a._cbcInit = function() {
  36681. var e = new function(e) {
  36682. r.equal(e.length, 8, "Invalid IV length"), this.iv = new Array(8);
  36683. for (var t = 0; t < this.iv.length; t++) this.iv[t] = e[t]
  36684. }(this.options.iv);
  36685. this._cbcState = e
  36686. }, a._update = function(e, t, i, r) {
  36687. var n = this._cbcState,
  36688. a = this.constructor.super_.prototype,
  36689. s = n.iv;
  36690. if ("encrypt" === this.type) {
  36691. for (var o = 0; o < this.blockSize; o++) s[o] ^= e[t + o];
  36692. for (a._update.call(this, s, 0, i, r), o = 0; o < this.blockSize; o++) s[o] = i[r + o]
  36693. } else {
  36694. for (a._update.call(this, e, t, i, r), o = 0; o < this.blockSize; o++) i[r + o] ^= s[o];
  36695. for (o = 0; o < this.blockSize; o++) s[o] = e[t + o]
  36696. }
  36697. }
  36698. }, function(e, t, i) {
  36699. "use strict";
  36700. var r = i(14),
  36701. n = i(5),
  36702. a = i(52),
  36703. s = i(94);
  36704. function o(e) {
  36705. a.call(this, e);
  36706. var t = new function(e, t) {
  36707. r.equal(t.length, 24, "Invalid key length");
  36708. var i = t.slice(0, 8),
  36709. n = t.slice(8, 16),
  36710. a = t.slice(16, 24);
  36711. this.ciphers = "encrypt" === e ? [s.create({
  36712. type: "encrypt",
  36713. key: i
  36714. }), s.create({
  36715. type: "decrypt",
  36716. key: n
  36717. }), s.create({
  36718. type: "encrypt",
  36719. key: a
  36720. })] : [s.create({
  36721. type: "decrypt",
  36722. key: a
  36723. }), s.create({
  36724. type: "encrypt",
  36725. key: n
  36726. }), s.create({
  36727. type: "decrypt",
  36728. key: i
  36729. })]
  36730. }(this.type, this.options.key);
  36731. this._edeState = t
  36732. }
  36733. n(o, a), e.exports = o, o.create = function(e) {
  36734. return new o(e)
  36735. }, o.prototype._update = function(e, t, i, r) {
  36736. var n = this._edeState;
  36737. n.ciphers[0]._update(e, t, i, r), n.ciphers[1]._update(i, r, i, r), n.ciphers[2]._update(i, r, i, r)
  36738. }, o.prototype._pad = s.prototype._pad, o.prototype._unpad = s.prototype._unpad
  36739. }, function(e, t, i) {
  36740. var r = i(54),
  36741. n = i(98),
  36742. a = i(6).Buffer,
  36743. s = i(99),
  36744. o = i(20),
  36745. u = i(39),
  36746. l = i(40);
  36747. function d(e, t, i) {
  36748. o.call(this), this._cache = new h, this._cipher = new u.AES(t), this._prev = a.from(i), this._mode = e,
  36749. this._autopadding = !0
  36750. }
  36751. i(5)(d, o), d.prototype._update = function(e) {
  36752. var t, i;
  36753. this._cache.add(e);
  36754. for (var r = []; t = this._cache.get();) i = this._mode.encrypt(this, t), r.push(i);
  36755. return a.concat(r)
  36756. };
  36757. var c = a.alloc(16, 16);
  36758. function h() {
  36759. this.cache = a.allocUnsafe(0)
  36760. }
  36761. function f(e, t, i) {
  36762. var o = r[e.toLowerCase()];
  36763. if (!o) throw new TypeError("invalid suite type");
  36764. if ("string" == typeof t && (t = a.from(t)), t.length !== o.key / 8) throw new TypeError(
  36765. "invalid key length " + t.length);
  36766. if ("string" == typeof i && (i = a.from(i)), "GCM" !== o.mode && i.length !== o.iv) throw new TypeError(
  36767. "invalid iv length " + i.length);
  36768. return "stream" === o.type ? new s(o.module, t, i) : "auth" === o.type ? new n(o.module, t, i) : new d(o
  36769. .module, t, i)
  36770. }
  36771. d.prototype._final = function() {
  36772. var e = this._cache.flush();
  36773. if (this._autopadding) return e = this._mode.encrypt(this, e), this._cipher.scrub(), e;
  36774. if (!e.equals(c)) throw this._cipher.scrub(), new Error("data not multiple of block length")
  36775. }, d.prototype.setAutoPadding = function(e) {
  36776. return this._autopadding = !!e, this
  36777. }, h.prototype.add = function(e) {
  36778. this.cache = a.concat([this.cache, e])
  36779. }, h.prototype.get = function() {
  36780. if (this.cache.length > 15) {
  36781. var e = this.cache.slice(0, 16);
  36782. return this.cache = this.cache.slice(16), e
  36783. }
  36784. return null
  36785. }, h.prototype.flush = function() {
  36786. for (var e = 16 - this.cache.length, t = a.allocUnsafe(e), i = -1; ++i < e;) t.writeUInt8(e, i);
  36787. return a.concat([this.cache, t])
  36788. }, t.createCipheriv = f, t.createCipher = function(e, t) {
  36789. var i = r[e.toLowerCase()];
  36790. if (!i) throw new TypeError("invalid suite type");
  36791. var n = l(t, !1, i.key, i.iv);
  36792. return f(e, n.key, n.iv)
  36793. }
  36794. }, function(e, t) {
  36795. t.encrypt = function(e, t) {
  36796. return e._cipher.encryptBlock(t)
  36797. }, t.decrypt = function(e, t) {
  36798. return e._cipher.decryptBlock(t)
  36799. }
  36800. }, function(e, t, i) {
  36801. var r = i(33);
  36802. t.encrypt = function(e, t) {
  36803. var i = r(t, e._prev);
  36804. return e._prev = e._cipher.encryptBlock(i), e._prev
  36805. }, t.decrypt = function(e, t) {
  36806. var i = e._prev;
  36807. e._prev = t;
  36808. var n = e._cipher.decryptBlock(t);
  36809. return r(n, i)
  36810. }
  36811. }, function(e, t, i) {
  36812. var r = i(6).Buffer,
  36813. n = i(33);
  36814. function a(e, t, i) {
  36815. var a = t.length,
  36816. s = n(t, e._cache);
  36817. return e._cache = e._cache.slice(a), e._prev = r.concat([e._prev, i ? t : s]), s
  36818. }
  36819. t.encrypt = function(e, t, i) {
  36820. for (var n, s = r.allocUnsafe(0); t.length;) {
  36821. if (0 === e._cache.length && (e._cache = e._cipher.encryptBlock(e._prev), e._prev = r.allocUnsafe(0)),
  36822. !(e._cache.length <= t.length)) {
  36823. s = r.concat([s, a(e, t, i)]);
  36824. break
  36825. }
  36826. n = e._cache.length, s = r.concat([s, a(e, t.slice(0, n), i)]), t = t.slice(n)
  36827. }
  36828. return s
  36829. }
  36830. }, function(e, t, i) {
  36831. var r = i(6).Buffer;
  36832. function n(e, t, i) {
  36833. var n = e._cipher.encryptBlock(e._prev)[0] ^ t;
  36834. return e._prev = r.concat([e._prev.slice(1), r.from([i ? t : n])]), n
  36835. }
  36836. t.encrypt = function(e, t, i) {
  36837. for (var a = t.length, s = r.allocUnsafe(a), o = -1; ++o < a;) s[o] = n(e, t[o], i);
  36838. return s
  36839. }
  36840. }, function(e, t, i) {
  36841. var r = i(6).Buffer;
  36842. function n(e, t, i) {
  36843. for (var r, n, s = -1, o = 0; ++s < 8;) r = t & 1 << 7 - s ? 128 : 0, o += (128 & (n = e._cipher
  36844. .encryptBlock(e._prev)[0] ^ r)) >> s % 8, e._prev = a(e._prev, i ? r : n);
  36845. return o
  36846. }
  36847. function a(e, t) {
  36848. var i = e.length,
  36849. n = -1,
  36850. a = r.allocUnsafe(e.length);
  36851. for (e = r.concat([e, r.from([t])]); ++n < i;) a[n] = e[n] << 1 | e[n + 1] >> 7;
  36852. return a
  36853. }
  36854. t.encrypt = function(e, t, i) {
  36855. for (var a = t.length, s = r.allocUnsafe(a), o = -1; ++o < a;) s[o] = n(e, t[o], i);
  36856. return s
  36857. }
  36858. }, function(e, t, i) {
  36859. (function(e) {
  36860. var r = i(33);
  36861. function n(e) {
  36862. return e._prev = e._cipher.encryptBlock(e._prev), e._prev
  36863. }
  36864. t.encrypt = function(t, i) {
  36865. for (; t._cache.length < i.length;) t._cache = e.concat([t._cache, n(t)]);
  36866. var a = t._cache.slice(0, i.length);
  36867. return t._cache = t._cache.slice(i.length), r(i, a)
  36868. }
  36869. }).call(this, i(10).Buffer)
  36870. }, function(e, t, i) {
  36871. var r = i(6).Buffer,
  36872. n = r.alloc(16, 0);
  36873. function a(e) {
  36874. var t = r.allocUnsafe(16);
  36875. return t.writeUInt32BE(e[0] >>> 0, 0), t.writeUInt32BE(e[1] >>> 0, 4), t.writeUInt32BE(e[2] >>> 0, 8), t
  36876. .writeUInt32BE(e[3] >>> 0, 12), t
  36877. }
  36878. function s(e) {
  36879. this.h = e, this.state = r.alloc(16, 0), this.cache = r.allocUnsafe(0)
  36880. }
  36881. s.prototype.ghash = function(e) {
  36882. for (var t = -1; ++t < e.length;) this.state[t] ^= e[t];
  36883. this._multiply()
  36884. }, s.prototype._multiply = function() {
  36885. for (var e, t, i, r = [(e = this.h).readUInt32BE(0), e.readUInt32BE(4), e.readUInt32BE(8), e
  36886. .readUInt32BE(12)
  36887. ], n = [0, 0, 0, 0], s = -1; ++s < 128;) {
  36888. for (0 != (this.state[~~(s / 8)] & 1 << 7 - s % 8) && (n[0] ^= r[0], n[1] ^= r[1], n[2] ^= r[2], n[
  36889. 3] ^= r[3]), i = 0 != (1 & r[3]), t = 3; t > 0; t--) r[t] = r[t] >>> 1 | (1 & r[t - 1]) << 31;
  36890. r[0] = r[0] >>> 1, i && (r[0] = r[0] ^ 225 << 24)
  36891. }
  36892. this.state = a(n)
  36893. }, s.prototype.update = function(e) {
  36894. var t;
  36895. for (this.cache = r.concat([this.cache, e]); this.cache.length >= 16;) t = this.cache.slice(0, 16), this
  36896. .cache = this.cache.slice(16), this.ghash(t)
  36897. }, s.prototype.final = function(e, t) {
  36898. return this.cache.length && this.ghash(r.concat([this.cache, n], 16)), this.ghash(a([0, e, 0, t])), this
  36899. .state
  36900. }, e.exports = s
  36901. }, function(e, t, i) {
  36902. var r = i(98),
  36903. n = i(6).Buffer,
  36904. a = i(54),
  36905. s = i(99),
  36906. o = i(20),
  36907. u = i(39),
  36908. l = i(40);
  36909. function d(e, t, i) {
  36910. o.call(this), this._cache = new c, this._last = void 0, this._cipher = new u.AES(t), this._prev = n.from(
  36911. i), this._mode = e, this._autopadding = !0
  36912. }
  36913. function c() {
  36914. this.cache = n.allocUnsafe(0)
  36915. }
  36916. function h(e, t, i) {
  36917. var o = a[e.toLowerCase()];
  36918. if (!o) throw new TypeError("invalid suite type");
  36919. if ("string" == typeof i && (i = n.from(i)), "GCM" !== o.mode && i.length !== o.iv) throw new TypeError(
  36920. "invalid iv length " + i.length);
  36921. if ("string" == typeof t && (t = n.from(t)), t.length !== o.key / 8) throw new TypeError(
  36922. "invalid key length " + t.length);
  36923. return "stream" === o.type ? new s(o.module, t, i, !0) : "auth" === o.type ? new r(o.module, t, i, !0) :
  36924. new d(o.module, t, i)
  36925. }
  36926. i(5)(d, o), d.prototype._update = function(e) {
  36927. var t, i;
  36928. this._cache.add(e);
  36929. for (var r = []; t = this._cache.get(this._autopadding);) i = this._mode.decrypt(this, t), r.push(i);
  36930. return n.concat(r)
  36931. }, d.prototype._final = function() {
  36932. var e = this._cache.flush();
  36933. if (this._autopadding) return function(e) {
  36934. var t = e[15];
  36935. if (t < 1 || t > 16) throw new Error("unable to decrypt data");
  36936. for (var i = -1; ++i < t;)
  36937. if (e[i + (16 - t)] !== t) throw new Error("unable to decrypt data");
  36938. if (16 !== t) return e.slice(0, 16 - t)
  36939. }(this._mode.decrypt(this, e));
  36940. if (e) throw new Error("data not multiple of block length")
  36941. }, d.prototype.setAutoPadding = function(e) {
  36942. return this._autopadding = !!e, this
  36943. }, c.prototype.add = function(e) {
  36944. this.cache = n.concat([this.cache, e])
  36945. }, c.prototype.get = function(e) {
  36946. var t;
  36947. if (e) {
  36948. if (this.cache.length > 16) return t = this.cache.slice(0, 16), this.cache = this.cache.slice(16), t
  36949. } else if (this.cache.length >= 16) return t = this.cache.slice(0, 16), this.cache = this.cache.slice(
  36950. 16), t;
  36951. return null
  36952. }, c.prototype.flush = function() {
  36953. if (this.cache.length) return this.cache
  36954. }, t.createDecipher = function(e, t) {
  36955. var i = a[e.toLowerCase()];
  36956. if (!i) throw new TypeError("invalid suite type");
  36957. var r = l(t, !1, i.key, i.iv);
  36958. return h(e, r.key, r.iv)
  36959. }, t.createDecipheriv = h
  36960. }, function(e, t) {
  36961. t["des-ecb"] = {
  36962. key: 8,
  36963. iv: 0
  36964. }, t["des-cbc"] = t.des = {
  36965. key: 8,
  36966. iv: 8
  36967. }, t["des-ede3-cbc"] = t.des3 = {
  36968. key: 24,
  36969. iv: 8
  36970. }, t["des-ede3"] = {
  36971. key: 24,
  36972. iv: 0
  36973. }, t["des-ede-cbc"] = {
  36974. key: 16,
  36975. iv: 8
  36976. }, t["des-ede"] = {
  36977. key: 16,
  36978. iv: 0
  36979. }
  36980. }, function(e, t, i) {
  36981. (function(e) {
  36982. var r = i(100),
  36983. n = i(180),
  36984. a = i(181),
  36985. s = {
  36986. binary: !0,
  36987. hex: !0,
  36988. base64: !0
  36989. };
  36990. t.DiffieHellmanGroup = t.createDiffieHellmanGroup = t.getDiffieHellman = function(t) {
  36991. var i = new e(n[t].prime, "hex"),
  36992. r = new e(n[t].gen, "hex");
  36993. return new a(i, r)
  36994. }, t.createDiffieHellman = t.DiffieHellman = function t(i, n, o, u) {
  36995. return e.isBuffer(n) || void 0 === s[n] ? t(i, "binary", n, o) : (n = n || "binary", u = u ||
  36996. "binary", o = o || new e([2]), e.isBuffer(o) || (o = new e(o, u)), "number" == typeof i ? new a(
  36997. r(i, o), o, !0) : (e.isBuffer(i) || (i = new e(i, n)), new a(i, o, !0)))
  36998. }
  36999. }).call(this, i(10).Buffer)
  37000. }, function(e, t) {}, function(e, t) {}, function(e) {
  37001. e.exports = JSON.parse(
  37002. '{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}'
  37003. )
  37004. }, function(e, t, i) {
  37005. (function(t) {
  37006. var r = i(11),
  37007. n = new(i(101)),
  37008. a = new r(24),
  37009. s = new r(11),
  37010. o = new r(10),
  37011. u = new r(3),
  37012. l = new r(7),
  37013. d = i(100),
  37014. c = i(24);
  37015. function h(e, i) {
  37016. return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this._pub = new r(e), this
  37017. }
  37018. function f(e, i) {
  37019. return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this._priv = new r(e), this
  37020. }
  37021. e.exports = m;
  37022. var p = {};
  37023. function m(e, t, i) {
  37024. this.setGenerator(t), this.__prime = new r(e), this._prime = r.mont(this.__prime), this._primeLen = e
  37025. .length, this._pub = void 0, this._priv = void 0, this._primeCode = void 0, i ? (this.setPublicKey =
  37026. h, this.setPrivateKey = f) : this._primeCode = 8
  37027. }
  37028. function g(e, i) {
  37029. var r = new t(e.toArray());
  37030. return i ? r.toString(i) : r
  37031. }
  37032. Object.defineProperty(m.prototype, "verifyError", {
  37033. enumerable: !0,
  37034. get: function() {
  37035. return "number" != typeof this._primeCode && (this._primeCode = function(e, t) {
  37036. var i = t.toString("hex"),
  37037. r = [i, e.toString(16)].join("_");
  37038. if (r in p) return p[r];
  37039. var c, h = 0;
  37040. if (e.isEven() || !d.simpleSieve || !d.fermatTest(e) || !n.test(e)) return h += 1, h +=
  37041. "02" === i || "05" === i ? 8 : 4, p[r] = h, h;
  37042. switch (n.test(e.shrn(1)) || (h += 2), i) {
  37043. case "02":
  37044. e.mod(a).cmp(s) && (h += 8);
  37045. break;
  37046. case "05":
  37047. (c = e.mod(o)).cmp(u) && c.cmp(l) && (h += 8);
  37048. break;
  37049. default:
  37050. h += 4
  37051. }
  37052. return p[r] = h, h
  37053. }(this.__prime, this.__gen)), this._primeCode
  37054. }
  37055. }), m.prototype.generateKeys = function() {
  37056. return this._priv || (this._priv = new r(c(this._primeLen))), this._pub = this._gen.toRed(this
  37057. ._prime).redPow(this._priv).fromRed(), this.getPublicKey()
  37058. }, m.prototype.computeSecret = function(e) {
  37059. var i = (e = (e = new r(e)).toRed(this._prime)).redPow(this._priv).fromRed(),
  37060. n = new t(i.toArray()),
  37061. a = this.getPrime();
  37062. if (n.length < a.length) {
  37063. var s = new t(a.length - n.length);
  37064. s.fill(0), n = t.concat([s, n])
  37065. }
  37066. return n
  37067. }, m.prototype.getPublicKey = function(e) {
  37068. return g(this._pub, e)
  37069. }, m.prototype.getPrivateKey = function(e) {
  37070. return g(this._priv, e)
  37071. }, m.prototype.getPrime = function(e) {
  37072. return g(this.__prime, e)
  37073. }, m.prototype.getGenerator = function(e) {
  37074. return g(this._gen, e)
  37075. }, m.prototype.setGenerator = function(e, i) {
  37076. return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this.__gen = e, this._gen = new r(e),
  37077. this
  37078. }
  37079. }).call(this, i(10).Buffer)
  37080. }, function(e, t, i) {
  37081. var r = i(6).Buffer,
  37082. n = i(31),
  37083. a = i(183),
  37084. s = i(5),
  37085. o = i(191),
  37086. u = i(222),
  37087. l = i(87);
  37088. function d(e) {
  37089. a.Writable.call(this);
  37090. var t = l[e];
  37091. if (!t) throw new Error("Unknown message digest");
  37092. this._hashType = t.hash, this._hash = n(t.hash), this._tag = t.id, this._signType = t.sign
  37093. }
  37094. function c(e) {
  37095. a.Writable.call(this);
  37096. var t = l[e];
  37097. if (!t) throw new Error("Unknown message digest");
  37098. this._hash = n(t.hash), this._tag = t.id, this._signType = t.sign
  37099. }
  37100. function h(e) {
  37101. return new d(e)
  37102. }
  37103. function f(e) {
  37104. return new c(e)
  37105. }
  37106. Object.keys(l).forEach(function(e) {
  37107. l[e].id = r.from(l[e].id, "hex"), l[e.toLowerCase()] = l[e]
  37108. }), s(d, a.Writable), d.prototype._write = function(e, t, i) {
  37109. this._hash.update(e), i()
  37110. }, d.prototype.update = function(e, t) {
  37111. return "string" == typeof e && (e = r.from(e, t)), this._hash.update(e), this
  37112. }, d.prototype.sign = function(e, t) {
  37113. this.end();
  37114. var i = this._hash.digest(),
  37115. r = o(i, e, this._hashType, this._signType, this._tag);
  37116. return t ? r.toString(t) : r
  37117. }, s(c, a.Writable), c.prototype._write = function(e, t, i) {
  37118. this._hash.update(e), i()
  37119. }, c.prototype.update = function(e, t) {
  37120. return "string" == typeof e && (e = r.from(e, t)), this._hash.update(e), this
  37121. }, c.prototype.verify = function(e, t, i) {
  37122. "string" == typeof t && (t = r.from(t, i)), this.end();
  37123. var n = this._hash.digest();
  37124. return u(t, n, e, this._signType, this._tag)
  37125. }, e.exports = {
  37126. Sign: h,
  37127. Verify: f,
  37128. createSign: h,
  37129. createVerify: f
  37130. }
  37131. }, function(e, t, i) {
  37132. (t = e.exports = i(102)).Stream = t, t.Readable = t, t.Writable = i(106), t.Duplex = i(29), t.Transform = i(
  37133. 107), t.PassThrough = i(189), t.finished = i(57), t.pipeline = i(190)
  37134. }, function(e, t) {}, function(e, t, i) {
  37135. "use strict";
  37136. function r(e, t) {
  37137. var i = Object.keys(e);
  37138. if (Object.getOwnPropertySymbols) {
  37139. var r = Object.getOwnPropertySymbols(e);
  37140. t && (r = r.filter(function(t) {
  37141. return Object.getOwnPropertyDescriptor(e, t).enumerable
  37142. })), i.push.apply(i, r)
  37143. }
  37144. return i
  37145. }
  37146. function n(e, t, i) {
  37147. return t in e ? Object.defineProperty(e, t, {
  37148. value: i,
  37149. enumerable: !0,
  37150. configurable: !0,
  37151. writable: !0
  37152. }) : e[t] = i, e
  37153. }
  37154. function a(e, t) {
  37155. for (var i = 0; i < t.length; i++) {
  37156. var r = t[i];
  37157. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  37158. .defineProperty(e, r.key, r)
  37159. }
  37160. }
  37161. var s = i(10).Buffer,
  37162. o = i(186).inspect,
  37163. u = o && o.custom || "inspect";
  37164. e.exports = function() {
  37165. function e() {
  37166. ! function(e, t) {
  37167. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  37168. }(this, e), this.head = null, this.tail = null, this.length = 0
  37169. }
  37170. var t, i;
  37171. return t = e, (i = [{
  37172. key: "push",
  37173. value: function(e) {
  37174. var t = {
  37175. data: e,
  37176. next: null
  37177. };
  37178. this.length > 0 ? this.tail.next = t : this.head = t, this.tail = t, ++this.length
  37179. }
  37180. }, {
  37181. key: "unshift",
  37182. value: function(e) {
  37183. var t = {
  37184. data: e,
  37185. next: this.head
  37186. };
  37187. 0 === this.length && (this.tail = t), this.head = t, ++this.length
  37188. }
  37189. }, {
  37190. key: "shift",
  37191. value: function() {
  37192. if (0 !== this.length) {
  37193. var e = this.head.data;
  37194. return 1 === this.length ? this.head = this.tail = null : this.head = this.head.next, --
  37195. this.length, e
  37196. }
  37197. }
  37198. }, {
  37199. key: "clear",
  37200. value: function() {
  37201. this.head = this.tail = null, this.length = 0
  37202. }
  37203. }, {
  37204. key: "join",
  37205. value: function(e) {
  37206. if (0 === this.length) return "";
  37207. for (var t = this.head, i = "" + t.data; t = t.next;) i += e + t.data;
  37208. return i
  37209. }
  37210. }, {
  37211. key: "concat",
  37212. value: function(e) {
  37213. if (0 === this.length) return s.alloc(0);
  37214. for (var t, i, r, n = s.allocUnsafe(e >>> 0), a = this.head, o = 0; a;) t = a.data, i = n,
  37215. r = o, s.prototype.copy.call(t, i, r), o += a.data.length, a = a.next;
  37216. return n
  37217. }
  37218. }, {
  37219. key: "consume",
  37220. value: function(e, t) {
  37221. var i;
  37222. return e < this.head.data.length ? (i = this.head.data.slice(0, e), this.head.data = this
  37223. .head.data.slice(e)) : i = e === this.head.data.length ? this.shift() : t ? this
  37224. ._getString(e) : this._getBuffer(e), i
  37225. }
  37226. }, {
  37227. key: "first",
  37228. value: function() {
  37229. return this.head.data
  37230. }
  37231. }, {
  37232. key: "_getString",
  37233. value: function(e) {
  37234. var t = this.head,
  37235. i = 1,
  37236. r = t.data;
  37237. for (e -= r.length; t = t.next;) {
  37238. var n = t.data,
  37239. a = e > n.length ? n.length : e;
  37240. if (a === n.length ? r += n : r += n.slice(0, e), 0 == (e -= a)) {
  37241. a === n.length ? (++i, t.next ? this.head = t.next : this.head = this.tail = null) : (
  37242. this.head = t, t.data = n.slice(a));
  37243. break
  37244. }++i
  37245. }
  37246. return this.length -= i, r
  37247. }
  37248. }, {
  37249. key: "_getBuffer",
  37250. value: function(e) {
  37251. var t = s.allocUnsafe(e),
  37252. i = this.head,
  37253. r = 1;
  37254. for (i.data.copy(t), e -= i.data.length; i = i.next;) {
  37255. var n = i.data,
  37256. a = e > n.length ? n.length : e;
  37257. if (n.copy(t, t.length - e, 0, a), 0 == (e -= a)) {
  37258. a === n.length ? (++r, i.next ? this.head = i.next : this.head = this.tail = null) : (
  37259. this.head = i, i.data = n.slice(a));
  37260. break
  37261. }++r
  37262. }
  37263. return this.length -= r, t
  37264. }
  37265. }, {
  37266. key: u,
  37267. value: function(e, t) {
  37268. return o(this, function(e) {
  37269. for (var t = 1; t < arguments.length; t++) {
  37270. var i = null != arguments[t] ? arguments[t] : {};
  37271. t % 2 ? r(Object(i), !0).forEach(function(t) {
  37272. n(e, t, i[t])
  37273. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object
  37274. .getOwnPropertyDescriptors(i)) : r(Object(i)).forEach(function(t) {
  37275. Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t))
  37276. })
  37277. }
  37278. return e
  37279. }({}, t, {
  37280. depth: 0,
  37281. customInspect: !1
  37282. }))
  37283. }
  37284. }]) && a(t.prototype, i), e
  37285. }()
  37286. }, function(e, t) {}, function(e, t, i) {
  37287. "use strict";
  37288. (function(t) {
  37289. var r;
  37290. function n(e, t, i) {
  37291. return t in e ? Object.defineProperty(e, t, {
  37292. value: i,
  37293. enumerable: !0,
  37294. configurable: !0,
  37295. writable: !0
  37296. }) : e[t] = i, e
  37297. }
  37298. var a = i(57),
  37299. s = Symbol("lastResolve"),
  37300. o = Symbol("lastReject"),
  37301. u = Symbol("error"),
  37302. l = Symbol("ended"),
  37303. d = Symbol("lastPromise"),
  37304. c = Symbol("handlePromise"),
  37305. h = Symbol("stream");
  37306. function f(e, t) {
  37307. return {
  37308. value: e,
  37309. done: t
  37310. }
  37311. }
  37312. function p(e) {
  37313. var t = e[s];
  37314. if (null !== t) {
  37315. var i = e[h].read();
  37316. null !== i && (e[d] = null, e[s] = null, e[o] = null, t(f(i, !1)))
  37317. }
  37318. }
  37319. function m(e) {
  37320. t.nextTick(p, e)
  37321. }
  37322. var g = Object.getPrototypeOf(function() {}),
  37323. v = Object.setPrototypeOf((n(r = {
  37324. get stream() {
  37325. return this[h]
  37326. },
  37327. next: function() {
  37328. var e = this,
  37329. i = this[u];
  37330. if (null !== i) return Promise.reject(i);
  37331. if (this[l]) return Promise.resolve(f(void 0, !0));
  37332. if (this[h].destroyed) return new Promise(function(i, r) {
  37333. t.nextTick(function() {
  37334. e[u] ? r(e[u]) : i(f(void 0, !0))
  37335. })
  37336. });
  37337. var r, n = this[d];
  37338. if (n) r = new Promise(function(e, t) {
  37339. return function(i, r) {
  37340. e.then(function() {
  37341. t[l] ? i(f(void 0, !0)) : t[c](i, r)
  37342. }, r)
  37343. }
  37344. }(n, this));
  37345. else {
  37346. var a = this[h].read();
  37347. if (null !== a) return Promise.resolve(f(a, !1));
  37348. r = new Promise(this[c])
  37349. }
  37350. return this[d] = r, r
  37351. }
  37352. }, Symbol.asyncIterator, function() {
  37353. return this
  37354. }), n(r, "return", function() {
  37355. var e = this;
  37356. return new Promise(function(t, i) {
  37357. e[h].destroy(null, function(e) {
  37358. e ? i(e) : t(f(void 0, !0))
  37359. })
  37360. })
  37361. }), r), g);
  37362. e.exports = function(e) {
  37363. var t, i = Object.create(v, (n(t = {}, h, {
  37364. value: e,
  37365. writable: !0
  37366. }), n(t, s, {
  37367. value: null,
  37368. writable: !0
  37369. }), n(t, o, {
  37370. value: null,
  37371. writable: !0
  37372. }), n(t, u, {
  37373. value: null,
  37374. writable: !0
  37375. }), n(t, l, {
  37376. value: e._readableState.endEmitted,
  37377. writable: !0
  37378. }), n(t, c, {
  37379. value: function(e, t) {
  37380. var r = i[h].read();
  37381. r ? (i[d] = null, i[s] = null, i[o] = null, e(f(r, !1))) : (i[s] = e, i[o] = t)
  37382. },
  37383. writable: !0
  37384. }), t));
  37385. return i[d] = null, a(e, function(e) {
  37386. if (e && "ERR_STREAM_PREMATURE_CLOSE" !== e.code) {
  37387. var t = i[o];
  37388. return null !== t && (i[d] = null, i[s] = null, i[o] = null, t(e)), void(i[u] = e)
  37389. }
  37390. var r = i[s];
  37391. null !== r && (i[d] = null, i[s] = null, i[o] = null, r(f(void 0, !0))), i[l] = !0
  37392. }), e.on("readable", m.bind(null, i)), i
  37393. }
  37394. }).call(this, i(9))
  37395. }, function(e, t) {
  37396. e.exports = function() {
  37397. throw new Error("Readable.from is not available in the browser")
  37398. }
  37399. }, function(e, t, i) {
  37400. "use strict";
  37401. e.exports = n;
  37402. var r = i(107);
  37403. function n(e) {
  37404. if (!(this instanceof n)) return new n(e);
  37405. r.call(this, e)
  37406. }
  37407. i(5)(n, r), n.prototype._transform = function(e, t, i) {
  37408. i(null, e)
  37409. }
  37410. }, function(e, t, i) {
  37411. "use strict";
  37412. var r, n = i(28).codes,
  37413. a = n.ERR_MISSING_ARGS,
  37414. s = n.ERR_STREAM_DESTROYED;
  37415. function o(e) {
  37416. if (e) throw e
  37417. }
  37418. function u(e, t, n, a) {
  37419. a = function(e) {
  37420. var t = !1;
  37421. return function() {
  37422. t || (t = !0, e.apply(void 0, arguments))
  37423. }
  37424. }(a);
  37425. var o = !1;
  37426. e.on("close", function() {
  37427. o = !0
  37428. }), void 0 === r && (r = i(57)), r(e, {
  37429. readable: t,
  37430. writable: n
  37431. }, function(e) {
  37432. if (e) return a(e);
  37433. o = !0, a()
  37434. });
  37435. var u = !1;
  37436. return function(t) {
  37437. if (!o && !u) return u = !0,
  37438. function(e) {
  37439. return e.setHeader && "function" == typeof e.abort
  37440. }(e) ? e.abort() : "function" == typeof e.destroy ? e.destroy() : void a(t || new s("pipe"))
  37441. }
  37442. }
  37443. function l(e) {
  37444. e()
  37445. }
  37446. function d(e, t) {
  37447. return e.pipe(t)
  37448. }
  37449. e.exports = function() {
  37450. for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++) t[i] = arguments[i];
  37451. var r, n = function(e) {
  37452. return e.length ? "function" != typeof e[e.length - 1] ? o : e.pop() : o
  37453. }(t);
  37454. if (Array.isArray(t[0]) && (t = t[0]), t.length < 2) throw new a("streams");
  37455. var s = t.map(function(e, i) {
  37456. var a = i < t.length - 1;
  37457. return u(e, a, i > 0, function(e) {
  37458. r || (r = e), e && s.forEach(l), a || (s.forEach(l), n(r))
  37459. })
  37460. });
  37461. return t.reduce(d)
  37462. }
  37463. }, function(e, t, i) {
  37464. var r = i(6).Buffer,
  37465. n = i(85),
  37466. a = i(58),
  37467. s = i(59).ec,
  37468. o = i(113),
  37469. u = i(42),
  37470. l = i(119);
  37471. function d(e, t, i, a) {
  37472. if ((e = r.from(e.toArray())).length < t.byteLength()) {
  37473. var s = r.alloc(t.byteLength() - e.length);
  37474. e = r.concat([s, e])
  37475. }
  37476. var o = i.length,
  37477. u = function(e, t) {
  37478. e = (e = c(e, t)).mod(t);
  37479. var i = r.from(e.toArray());
  37480. if (i.length < t.byteLength()) {
  37481. var n = r.alloc(t.byteLength() - i.length);
  37482. i = r.concat([n, i])
  37483. }
  37484. return i
  37485. }(i, t),
  37486. l = r.alloc(o);
  37487. l.fill(1);
  37488. var d = r.alloc(o);
  37489. return d = n(a, d).update(l).update(r.from([0])).update(e).update(u).digest(), l = n(a, d).update(l)
  37490. .digest(), {
  37491. k: d = n(a, d).update(l).update(r.from([1])).update(e).update(u).digest(),
  37492. v: l = n(a, d).update(l).digest()
  37493. }
  37494. }
  37495. function c(e, t) {
  37496. var i = new o(e),
  37497. r = (e.length << 3) - t.bitLength();
  37498. return r > 0 && i.ishrn(r), i
  37499. }
  37500. function h(e, t, i) {
  37501. var a, s;
  37502. do {
  37503. for (a = r.alloc(0); 8 * a.length < e.bitLength();) t.v = n(i, t.k).update(t.v).digest(), a = r.concat([
  37504. a, t.v
  37505. ]);
  37506. s = c(a, e), t.k = n(i, t.k).update(t.v).update(r.from([0])).digest(), t.v = n(i, t.k).update(t.v)
  37507. .digest()
  37508. } while (-1 !== s.cmp(e));
  37509. return s
  37510. }
  37511. function f(e, t, i, r) {
  37512. return e.toRed(o.mont(i)).redPow(t).fromRed().mod(r)
  37513. }
  37514. e.exports = function(e, t, i, n, p) {
  37515. var m = u(t);
  37516. if (m.curve) {
  37517. if ("ecdsa" !== n && "ecdsa/rsa" !== n) throw new Error("wrong private key type");
  37518. return function(e, t) {
  37519. var i = l[t.curve.join(".")];
  37520. if (!i) throw new Error("unknown curve " + t.curve.join("."));
  37521. var n = new s(i).keyFromPrivate(t.privateKey).sign(e);
  37522. return r.from(n.toDER())
  37523. }(e, m)
  37524. }
  37525. if ("dsa" === m.type) {
  37526. if ("dsa" !== n) throw new Error("wrong private key type");
  37527. return function(e, t, i) {
  37528. for (var n, a = t.params.priv_key, s = t.params.p, u = t.params.q, l = t.params.g, p = new o(0),
  37529. m = c(e, u).mod(u), g = !1, v = d(a, u, e, i); !1 === g;) p = f(l, n = h(u, v, i), s, u),
  37530. 0 === (g = n.invm(u).imul(m.add(a.mul(p))).mod(u)).cmpn(0) && (g = !1, p = new o(0));
  37531. return function(e, t) {
  37532. e = e.toArray(), t = t.toArray(), 128 & e[0] && (e = [0].concat(e)), 128 & t[0] && (t = [0]
  37533. .concat(t));
  37534. var i = [48, e.length + t.length + 4, 2, e.length];
  37535. return i = i.concat(e, [2, t.length], t), r.from(i)
  37536. }(p, g)
  37537. }(e, m, i)
  37538. }
  37539. if ("rsa" !== n && "ecdsa/rsa" !== n) throw new Error("wrong private key type");
  37540. e = r.concat([p, e]);
  37541. for (var g = m.modulus.byteLength(), v = [0, 1]; e.length + v.length + 1 < g;) v.push(255);
  37542. v.push(0);
  37543. for (var y = -1; ++y < e.length;) v.push(e[y]);
  37544. return a(v, m)
  37545. }, e.exports.getKey = d, e.exports.makeKey = h
  37546. }, function(e, t, i) {
  37547. (function(e) {
  37548. ! function(e, t) {
  37549. "use strict";
  37550. function r(e, t) {
  37551. if (!e) throw new Error(t || "Assertion failed")
  37552. }
  37553. function n(e, t) {
  37554. e.super_ = t;
  37555. var i = function() {};
  37556. i.prototype = t.prototype, e.prototype = new i, e.prototype.constructor = e
  37557. }
  37558. function a(e, t, i) {
  37559. if (a.isBN(e)) return e;
  37560. this.negative = 0, this.words = null, this.length = 0, this.red = null, null !== e && ("le" !== t &&
  37561. "be" !== t || (i = t, t = 10), this._init(e || 0, t || 10, i || "be"))
  37562. }
  37563. var s;
  37564. "object" == typeof e ? e.exports = a : t.BN = a, a.BN = a, a.wordSize = 26;
  37565. try {
  37566. s = "undefined" != typeof window && void 0 !== window.Buffer ? window.Buffer : i(193).Buffer
  37567. } catch (e) {}
  37568. function o(e, t) {
  37569. var i = e.charCodeAt(t);
  37570. return i >= 48 && i <= 57 ? i - 48 : i >= 65 && i <= 70 ? i - 55 : i >= 97 && i <= 102 ? i - 87 :
  37571. void r(!1, "Invalid character in " + e)
  37572. }
  37573. function u(e, t, i) {
  37574. var r = o(e, i);
  37575. return i - 1 >= t && (r |= o(e, i - 1) << 4), r
  37576. }
  37577. function l(e, t, i, n) {
  37578. for (var a = 0, s = 0, o = Math.min(e.length, i), u = t; u < o; u++) {
  37579. var l = e.charCodeAt(u) - 48;
  37580. a *= n, s = l >= 49 ? l - 49 + 10 : l >= 17 ? l - 17 + 10 : l, r(l >= 0 && s < n,
  37581. "Invalid character"), a += s
  37582. }
  37583. return a
  37584. }
  37585. function d(e, t) {
  37586. e.words = t.words, e.length = t.length, e.negative = t.negative, e.red = t.red
  37587. }
  37588. if (a.isBN = function(e) {
  37589. return e instanceof a || null !== e && "object" == typeof e && e.constructor.wordSize === a
  37590. .wordSize && Array.isArray(e.words)
  37591. }, a.max = function(e, t) {
  37592. return e.cmp(t) > 0 ? e : t
  37593. }, a.min = function(e, t) {
  37594. return e.cmp(t) < 0 ? e : t
  37595. }, a.prototype._init = function(e, t, i) {
  37596. if ("number" == typeof e) return this._initNumber(e, t, i);
  37597. if ("object" == typeof e) return this._initArray(e, t, i);
  37598. "hex" === t && (t = 16), r(t === (0 | t) && t >= 2 && t <= 36);
  37599. var n = 0;
  37600. "-" === (e = e.toString().replace(/\s+/g, ""))[0] && (n++, this.negative = 1), n < e.length && (
  37601. 16 === t ? this._parseHex(e, n, i) : (this._parseBase(e, t, n), "le" === i && this._initArray(
  37602. this.toArray(), t, i)))
  37603. }, a.prototype._initNumber = function(e, t, i) {
  37604. e < 0 && (this.negative = 1, e = -e), e < 67108864 ? (this.words = [67108863 & e], this.length =
  37605. 1) : e < 4503599627370496 ? (this.words = [67108863 & e, e / 67108864 & 67108863], this
  37606. .length = 2) : (r(e < 9007199254740992), this.words = [67108863 & e, e / 67108864 & 67108863,
  37607. 1
  37608. ], this.length = 3), "le" === i && this._initArray(this.toArray(), t, i)
  37609. }, a.prototype._initArray = function(e, t, i) {
  37610. if (r("number" == typeof e.length), e.length <= 0) return this.words = [0], this.length = 1, this;
  37611. this.length = Math.ceil(e.length / 3), this.words = new Array(this.length);
  37612. for (var n = 0; n < this.length; n++) this.words[n] = 0;
  37613. var a, s, o = 0;
  37614. if ("be" === i)
  37615. for (n = e.length - 1, a = 0; n >= 0; n -= 3) s = e[n] | e[n - 1] << 8 | e[n - 2] << 16, this
  37616. .words[a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >=
  37617. 26 && (o -= 26, a++);
  37618. else if ("le" === i)
  37619. for (n = 0, a = 0; n < e.length; n += 3) s = e[n] | e[n + 1] << 8 | e[n + 2] << 16, this.words[
  37620. a] |= s << o & 67108863, this.words[a + 1] = s >>> 26 - o & 67108863, (o += 24) >= 26 && (
  37621. o -= 26, a++);
  37622. return this._strip()
  37623. }, a.prototype._parseHex = function(e, t, i) {
  37624. this.length = Math.ceil((e.length - t) / 6), this.words = new Array(this.length);
  37625. for (var r = 0; r < this.length; r++) this.words[r] = 0;
  37626. var n, a = 0,
  37627. s = 0;
  37628. if ("be" === i)
  37629. for (r = e.length - 1; r >= t; r -= 2) n = u(e, t, r) << a, this.words[s] |= 67108863 & n, a >=
  37630. 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8;
  37631. else
  37632. for (r = (e.length - t) % 2 == 0 ? t + 1 : t; r < e.length; r += 2) n = u(e, t, r) << a, this
  37633. .words[s] |= 67108863 & n, a >= 18 ? (a -= 18, s += 1, this.words[s] |= n >>> 26) : a += 8;
  37634. this._strip()
  37635. }, a.prototype._parseBase = function(e, t, i) {
  37636. this.words = [0], this.length = 1;
  37637. for (var r = 0, n = 1; n <= 67108863; n *= t) r++;
  37638. r--, n = n / t | 0;
  37639. for (var a = e.length - i, s = a % r, o = Math.min(a, a - s) + i, u = 0, d = i; d < o; d += r) u =
  37640. l(e, d, d + r, t), this.imuln(n), this.words[0] + u < 67108864 ? this.words[0] += u : this
  37641. ._iaddn(u);
  37642. if (0 !== s) {
  37643. var c = 1;
  37644. for (u = l(e, d, e.length, t), d = 0; d < s; d++) c *= t;
  37645. this.imuln(c), this.words[0] + u < 67108864 ? this.words[0] += u : this._iaddn(u)
  37646. }
  37647. this._strip()
  37648. }, a.prototype.copy = function(e) {
  37649. e.words = new Array(this.length);
  37650. for (var t = 0; t < this.length; t++) e.words[t] = this.words[t];
  37651. e.length = this.length, e.negative = this.negative, e.red = this.red
  37652. }, a.prototype._move = function(e) {
  37653. d(e, this)
  37654. }, a.prototype.clone = function() {
  37655. var e = new a(null);
  37656. return this.copy(e), e
  37657. }, a.prototype._expand = function(e) {
  37658. for (; this.length < e;) this.words[this.length++] = 0;
  37659. return this
  37660. }, a.prototype._strip = function() {
  37661. for (; this.length > 1 && 0 === this.words[this.length - 1];) this.length--;
  37662. return this._normSign()
  37663. }, a.prototype._normSign = function() {
  37664. return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this
  37665. }, "undefined" != typeof Symbol && "function" == typeof Symbol.for) try {
  37666. a.prototype[Symbol.for("nodejs.util.inspect.custom")] = c
  37667. } catch (e) {
  37668. a.prototype.inspect = c
  37669. } else a.prototype.inspect = c;
  37670. function c() {
  37671. return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">"
  37672. }
  37673. var h = ["", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000",
  37674. "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000",
  37675. "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000",
  37676. "00000000000000000000", "000000000000000000000", "0000000000000000000000",
  37677. "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000"
  37678. ],
  37679. f = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  37680. 5, 5, 5, 5, 5, 5, 5
  37681. ],
  37682. p = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7,
  37683. 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6,
  37684. 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5,
  37685. 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  37686. ];
  37687. function m(e, t, i) {
  37688. i.negative = t.negative ^ e.negative;
  37689. var r = e.length + t.length | 0;
  37690. i.length = r, r = r - 1 | 0;
  37691. var n = 0 | e.words[0],
  37692. a = 0 | t.words[0],
  37693. s = n * a,
  37694. o = 67108863 & s,
  37695. u = s / 67108864 | 0;
  37696. i.words[0] = o;
  37697. for (var l = 1; l < r; l++) {
  37698. for (var d = u >>> 26, c = 67108863 & u, h = Math.min(l, t.length - 1), f = Math.max(0, l - e
  37699. .length + 1); f <= h; f++) {
  37700. var p = l - f | 0;
  37701. d += (s = (n = 0 | e.words[p]) * (a = 0 | t.words[f]) + c) / 67108864 | 0, c = 67108863 & s
  37702. }
  37703. i.words[l] = 0 | c, u = 0 | d
  37704. }
  37705. return 0 !== u ? i.words[l] = 0 | u : i.length--, i._strip()
  37706. }
  37707. a.prototype.toString = function(e, t) {
  37708. var i;
  37709. if (t = 0 | t || 1, 16 === (e = e || 10) || "hex" === e) {
  37710. i = "";
  37711. for (var n = 0, a = 0, s = 0; s < this.length; s++) {
  37712. var o = this.words[s],
  37713. u = (16777215 & (o << n | a)).toString(16);
  37714. a = o >>> 24 - n & 16777215, (n += 2) >= 26 && (n -= 26, s--), i = 0 !== a || s !== this
  37715. .length - 1 ? h[6 - u.length] + u + i : u + i
  37716. }
  37717. for (0 !== a && (i = a.toString(16) + i); i.length % t != 0;) i = "0" + i;
  37718. return 0 !== this.negative && (i = "-" + i), i
  37719. }
  37720. if (e === (0 | e) && e >= 2 && e <= 36) {
  37721. var l = f[e],
  37722. d = p[e];
  37723. i = "";
  37724. var c = this.clone();
  37725. for (c.negative = 0; !c.isZero();) {
  37726. var m = c.modrn(d).toString(e);
  37727. i = (c = c.idivn(d)).isZero() ? m + i : h[l - m.length] + m + i
  37728. }
  37729. for (this.isZero() && (i = "0" + i); i.length % t != 0;) i = "0" + i;
  37730. return 0 !== this.negative && (i = "-" + i), i
  37731. }
  37732. r(!1, "Base should be between 2 and 36")
  37733. }, a.prototype.toNumber = function() {
  37734. var e = this.words[0];
  37735. return 2 === this.length ? e += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[
  37736. 2] ? e += 4503599627370496 + 67108864 * this.words[1] : this.length > 2 && r(!1,
  37737. "Number can only safely store up to 53 bits"), 0 !== this.negative ? -e : e
  37738. }, a.prototype.toJSON = function() {
  37739. return this.toString(16, 2)
  37740. }, s && (a.prototype.toBuffer = function(e, t) {
  37741. return this.toArrayLike(s, e, t)
  37742. }), a.prototype.toArray = function(e, t) {
  37743. return this.toArrayLike(Array, e, t)
  37744. }, a.prototype.toArrayLike = function(e, t, i) {
  37745. this._strip();
  37746. var n = this.byteLength(),
  37747. a = i || Math.max(1, n);
  37748. r(n <= a, "byte array longer than desired length"), r(a > 0, "Requested array length <= 0");
  37749. var s = function(e, t) {
  37750. return e.allocUnsafe ? e.allocUnsafe(t) : new e(t)
  37751. }(e, a);
  37752. return this["_toArrayLike" + ("le" === t ? "LE" : "BE")](s, n), s
  37753. }, a.prototype._toArrayLikeLE = function(e, t) {
  37754. for (var i = 0, r = 0, n = 0, a = 0; n < this.length; n++) {
  37755. var s = this.words[n] << a | r;
  37756. e[i++] = 255 & s, i < e.length && (e[i++] = s >> 8 & 255), i < e.length && (e[i++] = s >> 16 &
  37757. 255), 6 === a ? (i < e.length && (e[i++] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24,
  37758. a += 2)
  37759. }
  37760. if (i < e.length)
  37761. for (e[i++] = r; i < e.length;) e[i++] = 0
  37762. }, a.prototype._toArrayLikeBE = function(e, t) {
  37763. for (var i = e.length - 1, r = 0, n = 0, a = 0; n < this.length; n++) {
  37764. var s = this.words[n] << a | r;
  37765. e[i--] = 255 & s, i >= 0 && (e[i--] = s >> 8 & 255), i >= 0 && (e[i--] = s >> 16 & 255), 6 ===
  37766. a ? (i >= 0 && (e[i--] = s >> 24 & 255), r = 0, a = 0) : (r = s >>> 24, a += 2)
  37767. }
  37768. if (i >= 0)
  37769. for (e[i--] = r; i >= 0;) e[i--] = 0
  37770. }, Math.clz32 ? a.prototype._countBits = function(e) {
  37771. return 32 - Math.clz32(e)
  37772. } : a.prototype._countBits = function(e) {
  37773. var t = e,
  37774. i = 0;
  37775. return t >= 4096 && (i += 13, t >>>= 13), t >= 64 && (i += 7, t >>>= 7), t >= 8 && (i += 4, t >>>=
  37776. 4), t >= 2 && (i += 2, t >>>= 2), i + t
  37777. }, a.prototype._zeroBits = function(e) {
  37778. if (0 === e) return 26;
  37779. var t = e,
  37780. i = 0;
  37781. return 0 == (8191 & t) && (i += 13, t >>>= 13), 0 == (127 & t) && (i += 7, t >>>= 7), 0 == (15 &
  37782. t) && (i += 4, t >>>= 4), 0 == (3 & t) && (i += 2, t >>>= 2), 0 == (1 & t) && i++, i
  37783. }, a.prototype.bitLength = function() {
  37784. var e = this.words[this.length - 1],
  37785. t = this._countBits(e);
  37786. return 26 * (this.length - 1) + t
  37787. }, a.prototype.zeroBits = function() {
  37788. if (this.isZero()) return 0;
  37789. for (var e = 0, t = 0; t < this.length; t++) {
  37790. var i = this._zeroBits(this.words[t]);
  37791. if (e += i, 26 !== i) break
  37792. }
  37793. return e
  37794. }, a.prototype.byteLength = function() {
  37795. return Math.ceil(this.bitLength() / 8)
  37796. }, a.prototype.toTwos = function(e) {
  37797. return 0 !== this.negative ? this.abs().inotn(e).iaddn(1) : this.clone()
  37798. }, a.prototype.fromTwos = function(e) {
  37799. return this.testn(e - 1) ? this.notn(e).iaddn(1).ineg() : this.clone()
  37800. }, a.prototype.isNeg = function() {
  37801. return 0 !== this.negative
  37802. }, a.prototype.neg = function() {
  37803. return this.clone().ineg()
  37804. }, a.prototype.ineg = function() {
  37805. return this.isZero() || (this.negative ^= 1), this
  37806. }, a.prototype.iuor = function(e) {
  37807. for (; this.length < e.length;) this.words[this.length++] = 0;
  37808. for (var t = 0; t < e.length; t++) this.words[t] = this.words[t] | e.words[t];
  37809. return this._strip()
  37810. }, a.prototype.ior = function(e) {
  37811. return r(0 == (this.negative | e.negative)), this.iuor(e)
  37812. }, a.prototype.or = function(e) {
  37813. return this.length > e.length ? this.clone().ior(e) : e.clone().ior(this)
  37814. }, a.prototype.uor = function(e) {
  37815. return this.length > e.length ? this.clone().iuor(e) : e.clone().iuor(this)
  37816. }, a.prototype.iuand = function(e) {
  37817. var t;
  37818. t = this.length > e.length ? e : this;
  37819. for (var i = 0; i < t.length; i++) this.words[i] = this.words[i] & e.words[i];
  37820. return this.length = t.length, this._strip()
  37821. }, a.prototype.iand = function(e) {
  37822. return r(0 == (this.negative | e.negative)), this.iuand(e)
  37823. }, a.prototype.and = function(e) {
  37824. return this.length > e.length ? this.clone().iand(e) : e.clone().iand(this)
  37825. }, a.prototype.uand = function(e) {
  37826. return this.length > e.length ? this.clone().iuand(e) : e.clone().iuand(this)
  37827. }, a.prototype.iuxor = function(e) {
  37828. var t, i;
  37829. this.length > e.length ? (t = this, i = e) : (t = e, i = this);
  37830. for (var r = 0; r < i.length; r++) this.words[r] = t.words[r] ^ i.words[r];
  37831. if (this !== t)
  37832. for (; r < t.length; r++) this.words[r] = t.words[r];
  37833. return this.length = t.length, this._strip()
  37834. }, a.prototype.ixor = function(e) {
  37835. return r(0 == (this.negative | e.negative)), this.iuxor(e)
  37836. }, a.prototype.xor = function(e) {
  37837. return this.length > e.length ? this.clone().ixor(e) : e.clone().ixor(this)
  37838. }, a.prototype.uxor = function(e) {
  37839. return this.length > e.length ? this.clone().iuxor(e) : e.clone().iuxor(this)
  37840. }, a.prototype.inotn = function(e) {
  37841. r("number" == typeof e && e >= 0);
  37842. var t = 0 | Math.ceil(e / 26),
  37843. i = e % 26;
  37844. this._expand(t), i > 0 && t--;
  37845. for (var n = 0; n < t; n++) this.words[n] = 67108863 & ~this.words[n];
  37846. return i > 0 && (this.words[n] = ~this.words[n] & 67108863 >> 26 - i), this._strip()
  37847. }, a.prototype.notn = function(e) {
  37848. return this.clone().inotn(e)
  37849. }, a.prototype.setn = function(e, t) {
  37850. r("number" == typeof e && e >= 0);
  37851. var i = e / 26 | 0,
  37852. n = e % 26;
  37853. return this._expand(i + 1), this.words[i] = t ? this.words[i] | 1 << n : this.words[i] & ~(1 <<
  37854. n), this._strip()
  37855. }, a.prototype.iadd = function(e) {
  37856. var t, i, r;
  37857. if (0 !== this.negative && 0 === e.negative) return this.negative = 0, t = this.isub(e), this
  37858. .negative ^= 1, this._normSign();
  37859. if (0 === this.negative && 0 !== e.negative) return e.negative = 0, t = this.isub(e), e.negative =
  37860. 1, t._normSign();
  37861. this.length > e.length ? (i = this, r = e) : (i = e, r = this);
  37862. for (var n = 0, a = 0; a < r.length; a++) t = (0 | i.words[a]) + (0 | r.words[a]) + n, this.words[
  37863. a] = 67108863 & t, n = t >>> 26;
  37864. for (; 0 !== n && a < i.length; a++) t = (0 | i.words[a]) + n, this.words[a] = 67108863 & t, n =
  37865. t >>> 26;
  37866. if (this.length = i.length, 0 !== n) this.words[this.length] = n, this.length++;
  37867. else if (i !== this)
  37868. for (; a < i.length; a++) this.words[a] = i.words[a];
  37869. return this
  37870. }, a.prototype.add = function(e) {
  37871. var t;
  37872. return 0 !== e.negative && 0 === this.negative ? (e.negative = 0, t = this.sub(e), e.negative ^=
  37873. 1, t) : 0 === e.negative && 0 !== this.negative ? (this.negative = 0, t = e.sub(this), this
  37874. .negative = 1, t) : this.length > e.length ? this.clone().iadd(e) : e.clone().iadd(this)
  37875. }, a.prototype.isub = function(e) {
  37876. if (0 !== e.negative) {
  37877. e.negative = 0;
  37878. var t = this.iadd(e);
  37879. return e.negative = 1, t._normSign()
  37880. }
  37881. if (0 !== this.negative) return this.negative = 0, this.iadd(e), this.negative = 1, this
  37882. ._normSign();
  37883. var i, r, n = this.cmp(e);
  37884. if (0 === n) return this.negative = 0, this.length = 1, this.words[0] = 0, this;
  37885. n > 0 ? (i = this, r = e) : (i = e, r = this);
  37886. for (var a = 0, s = 0; s < r.length; s++) a = (t = (0 | i.words[s]) - (0 | r.words[s]) + a) >> 26,
  37887. this.words[s] = 67108863 & t;
  37888. for (; 0 !== a && s < i.length; s++) a = (t = (0 | i.words[s]) + a) >> 26, this.words[s] =
  37889. 67108863 & t;
  37890. if (0 === a && s < i.length && i !== this)
  37891. for (; s < i.length; s++) this.words[s] = i.words[s];
  37892. return this.length = Math.max(this.length, s), i !== this && (this.negative = 1), this._strip()
  37893. }, a.prototype.sub = function(e) {
  37894. return this.clone().isub(e)
  37895. };
  37896. var g = function(e, t, i) {
  37897. var r, n, a, s = e.words,
  37898. o = t.words,
  37899. u = i.words,
  37900. l = 0,
  37901. d = 0 | s[0],
  37902. c = 8191 & d,
  37903. h = d >>> 13,
  37904. f = 0 | s[1],
  37905. p = 8191 & f,
  37906. m = f >>> 13,
  37907. g = 0 | s[2],
  37908. v = 8191 & g,
  37909. y = g >>> 13,
  37910. _ = 0 | s[3],
  37911. b = 8191 & _,
  37912. w = _ >>> 13,
  37913. E = 0 | s[4],
  37914. T = 8191 & E,
  37915. S = E >>> 13,
  37916. A = 0 | s[5],
  37917. k = 8191 & A,
  37918. R = A >>> 13,
  37919. M = 0 | s[6],
  37920. O = 8191 & M,
  37921. C = M >>> 13,
  37922. D = 0 | s[7],
  37923. I = 8191 & D,
  37924. L = D >>> 13,
  37925. x = 0 | s[8],
  37926. P = 8191 & x,
  37927. U = x >>> 13,
  37928. N = 0 | s[9],
  37929. B = 8191 & N,
  37930. F = N >>> 13,
  37931. j = 0 | o[0],
  37932. H = 8191 & j,
  37933. G = j >>> 13,
  37934. V = 0 | o[1],
  37935. W = 8191 & V,
  37936. q = V >>> 13,
  37937. X = 0 | o[2],
  37938. z = 8191 & X,
  37939. K = X >>> 13,
  37940. Y = 0 | o[3],
  37941. Q = 8191 & Y,
  37942. J = Y >>> 13,
  37943. Z = 0 | o[4],
  37944. $ = 8191 & Z,
  37945. ee = Z >>> 13,
  37946. te = 0 | o[5],
  37947. ie = 8191 & te,
  37948. re = te >>> 13,
  37949. ne = 0 | o[6],
  37950. ae = 8191 & ne,
  37951. se = ne >>> 13,
  37952. oe = 0 | o[7],
  37953. ue = 8191 & oe,
  37954. le = oe >>> 13,
  37955. de = 0 | o[8],
  37956. ce = 8191 & de,
  37957. he = de >>> 13,
  37958. fe = 0 | o[9],
  37959. pe = 8191 & fe,
  37960. me = fe >>> 13;
  37961. i.negative = e.negative ^ t.negative, i.length = 19;
  37962. var ge = (l + (r = Math.imul(c, H)) | 0) + ((8191 & (n = (n = Math.imul(c, G)) + Math.imul(h, H) |
  37963. 0)) << 13) | 0;
  37964. l = ((a = Math.imul(h, G)) + (n >>> 13) | 0) + (ge >>> 26) | 0, ge &= 67108863, r = Math.imul(p,
  37965. H), n = (n = Math.imul(p, G)) + Math.imul(m, H) | 0, a = Math.imul(m, G);
  37966. var ve = (l + (r = r + Math.imul(c, W) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, q) | 0) +
  37967. Math.imul(h, W) | 0)) << 13) | 0;
  37968. l = ((a = a + Math.imul(h, q) | 0) + (n >>> 13) | 0) + (ve >>> 26) | 0, ve &= 67108863, r = Math
  37969. .imul(v, H), n = (n = Math.imul(v, G)) + Math.imul(y, H) | 0, a = Math.imul(y, G), r = r + Math
  37970. .imul(p, W) | 0, n = (n = n + Math.imul(p, q) | 0) + Math.imul(m, W) | 0, a = a + Math.imul(m,
  37971. q) | 0;
  37972. var ye = (l + (r = r + Math.imul(c, z) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, K) | 0) +
  37973. Math.imul(h, z) | 0)) << 13) | 0;
  37974. l = ((a = a + Math.imul(h, K) | 0) + (n >>> 13) | 0) + (ye >>> 26) | 0, ye &= 67108863, r = Math
  37975. .imul(b, H), n = (n = Math.imul(b, G)) + Math.imul(w, H) | 0, a = Math.imul(w, G), r = r + Math
  37976. .imul(v, W) | 0, n = (n = n + Math.imul(v, q) | 0) + Math.imul(y, W) | 0, a = a + Math.imul(y,
  37977. q) | 0, r = r + Math.imul(p, z) | 0, n = (n = n + Math.imul(p, K) | 0) + Math.imul(m, z) | 0,
  37978. a = a + Math.imul(m, K) | 0;
  37979. var _e = (l + (r = r + Math.imul(c, Q) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, J) | 0) +
  37980. Math.imul(h, Q) | 0)) << 13) | 0;
  37981. l = ((a = a + Math.imul(h, J) | 0) + (n >>> 13) | 0) + (_e >>> 26) | 0, _e &= 67108863, r = Math
  37982. .imul(T, H), n = (n = Math.imul(T, G)) + Math.imul(S, H) | 0, a = Math.imul(S, G), r = r + Math
  37983. .imul(b, W) | 0, n = (n = n + Math.imul(b, q) | 0) + Math.imul(w, W) | 0, a = a + Math.imul(w,
  37984. q) | 0, r = r + Math.imul(v, z) | 0, n = (n = n + Math.imul(v, K) | 0) + Math.imul(y, z) | 0,
  37985. a = a + Math.imul(y, K) | 0, r = r + Math.imul(p, Q) | 0, n = (n = n + Math.imul(p, J) | 0) +
  37986. Math.imul(m, Q) | 0, a = a + Math.imul(m, J) | 0;
  37987. var be = (l + (r = r + Math.imul(c, $) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, ee) | 0) +
  37988. Math.imul(h, $) | 0)) << 13) | 0;
  37989. l = ((a = a + Math.imul(h, ee) | 0) + (n >>> 13) | 0) + (be >>> 26) | 0, be &= 67108863, r = Math
  37990. .imul(k, H), n = (n = Math.imul(k, G)) + Math.imul(R, H) | 0, a = Math.imul(R, G), r = r + Math
  37991. .imul(T, W) | 0, n = (n = n + Math.imul(T, q) | 0) + Math.imul(S, W) | 0, a = a + Math.imul(S,
  37992. q) | 0, r = r + Math.imul(b, z) | 0, n = (n = n + Math.imul(b, K) | 0) + Math.imul(w, z) | 0,
  37993. a = a + Math.imul(w, K) | 0, r = r + Math.imul(v, Q) | 0, n = (n = n + Math.imul(v, J) | 0) +
  37994. Math.imul(y, Q) | 0, a = a + Math.imul(y, J) | 0, r = r + Math.imul(p, $) | 0, n = (n = n + Math
  37995. .imul(p, ee) | 0) + Math.imul(m, $) | 0, a = a + Math.imul(m, ee) | 0;
  37996. var we = (l + (r = r + Math.imul(c, ie) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, re) | 0) +
  37997. Math.imul(h, ie) | 0)) << 13) | 0;
  37998. l = ((a = a + Math.imul(h, re) | 0) + (n >>> 13) | 0) + (we >>> 26) | 0, we &= 67108863, r = Math
  37999. .imul(O, H), n = (n = Math.imul(O, G)) + Math.imul(C, H) | 0, a = Math.imul(C, G), r = r + Math
  38000. .imul(k, W) | 0, n = (n = n + Math.imul(k, q) | 0) + Math.imul(R, W) | 0, a = a + Math.imul(R,
  38001. q) | 0, r = r + Math.imul(T, z) | 0, n = (n = n + Math.imul(T, K) | 0) + Math.imul(S, z) | 0,
  38002. a = a + Math.imul(S, K) | 0, r = r + Math.imul(b, Q) | 0, n = (n = n + Math.imul(b, J) | 0) +
  38003. Math.imul(w, Q) | 0, a = a + Math.imul(w, J) | 0, r = r + Math.imul(v, $) | 0, n = (n = n + Math
  38004. .imul(v, ee) | 0) + Math.imul(y, $) | 0, a = a + Math.imul(y, ee) | 0, r = r + Math.imul(p,
  38005. ie) | 0, n = (n = n + Math.imul(p, re) | 0) + Math.imul(m, ie) | 0, a = a + Math.imul(m, re) |
  38006. 0;
  38007. var Ee = (l + (r = r + Math.imul(c, ae) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, se) | 0) +
  38008. Math.imul(h, ae) | 0)) << 13) | 0;
  38009. l = ((a = a + Math.imul(h, se) | 0) + (n >>> 13) | 0) + (Ee >>> 26) | 0, Ee &= 67108863, r = Math
  38010. .imul(I, H), n = (n = Math.imul(I, G)) + Math.imul(L, H) | 0, a = Math.imul(L, G), r = r + Math
  38011. .imul(O, W) | 0, n = (n = n + Math.imul(O, q) | 0) + Math.imul(C, W) | 0, a = a + Math.imul(C,
  38012. q) | 0, r = r + Math.imul(k, z) | 0, n = (n = n + Math.imul(k, K) | 0) + Math.imul(R, z) | 0,
  38013. a = a + Math.imul(R, K) | 0, r = r + Math.imul(T, Q) | 0, n = (n = n + Math.imul(T, J) | 0) +
  38014. Math.imul(S, Q) | 0, a = a + Math.imul(S, J) | 0, r = r + Math.imul(b, $) | 0, n = (n = n + Math
  38015. .imul(b, ee) | 0) + Math.imul(w, $) | 0, a = a + Math.imul(w, ee) | 0, r = r + Math.imul(v,
  38016. ie) | 0, n = (n = n + Math.imul(v, re) | 0) + Math.imul(y, ie) | 0, a = a + Math.imul(y, re) |
  38017. 0, r = r + Math.imul(p, ae) | 0, n = (n = n + Math.imul(p, se) | 0) + Math.imul(m, ae) | 0, a =
  38018. a + Math.imul(m, se) | 0;
  38019. var Te = (l + (r = r + Math.imul(c, ue) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, le) | 0) +
  38020. Math.imul(h, ue) | 0)) << 13) | 0;
  38021. l = ((a = a + Math.imul(h, le) | 0) + (n >>> 13) | 0) + (Te >>> 26) | 0, Te &= 67108863, r = Math
  38022. .imul(P, H), n = (n = Math.imul(P, G)) + Math.imul(U, H) | 0, a = Math.imul(U, G), r = r + Math
  38023. .imul(I, W) | 0, n = (n = n + Math.imul(I, q) | 0) + Math.imul(L, W) | 0, a = a + Math.imul(L,
  38024. q) | 0, r = r + Math.imul(O, z) | 0, n = (n = n + Math.imul(O, K) | 0) + Math.imul(C, z) | 0,
  38025. a = a + Math.imul(C, K) | 0, r = r + Math.imul(k, Q) | 0, n = (n = n + Math.imul(k, J) | 0) +
  38026. Math.imul(R, Q) | 0, a = a + Math.imul(R, J) | 0, r = r + Math.imul(T, $) | 0, n = (n = n + Math
  38027. .imul(T, ee) | 0) + Math.imul(S, $) | 0, a = a + Math.imul(S, ee) | 0, r = r + Math.imul(b,
  38028. ie) | 0, n = (n = n + Math.imul(b, re) | 0) + Math.imul(w, ie) | 0, a = a + Math.imul(w, re) |
  38029. 0, r = r + Math.imul(v, ae) | 0, n = (n = n + Math.imul(v, se) | 0) + Math.imul(y, ae) | 0, a =
  38030. a + Math.imul(y, se) | 0, r = r + Math.imul(p, ue) | 0, n = (n = n + Math.imul(p, le) | 0) +
  38031. Math.imul(m, ue) | 0, a = a + Math.imul(m, le) | 0;
  38032. var Se = (l + (r = r + Math.imul(c, ce) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, he) | 0) +
  38033. Math.imul(h, ce) | 0)) << 13) | 0;
  38034. l = ((a = a + Math.imul(h, he) | 0) + (n >>> 13) | 0) + (Se >>> 26) | 0, Se &= 67108863, r = Math
  38035. .imul(B, H), n = (n = Math.imul(B, G)) + Math.imul(F, H) | 0, a = Math.imul(F, G), r = r + Math
  38036. .imul(P, W) | 0, n = (n = n + Math.imul(P, q) | 0) + Math.imul(U, W) | 0, a = a + Math.imul(U,
  38037. q) | 0, r = r + Math.imul(I, z) | 0, n = (n = n + Math.imul(I, K) | 0) + Math.imul(L, z) | 0,
  38038. a = a + Math.imul(L, K) | 0, r = r + Math.imul(O, Q) | 0, n = (n = n + Math.imul(O, J) | 0) +
  38039. Math.imul(C, Q) | 0, a = a + Math.imul(C, J) | 0, r = r + Math.imul(k, $) | 0, n = (n = n + Math
  38040. .imul(k, ee) | 0) + Math.imul(R, $) | 0, a = a + Math.imul(R, ee) | 0, r = r + Math.imul(T,
  38041. ie) | 0, n = (n = n + Math.imul(T, re) | 0) + Math.imul(S, ie) | 0, a = a + Math.imul(S, re) |
  38042. 0, r = r + Math.imul(b, ae) | 0, n = (n = n + Math.imul(b, se) | 0) + Math.imul(w, ae) | 0, a =
  38043. a + Math.imul(w, se) | 0, r = r + Math.imul(v, ue) | 0, n = (n = n + Math.imul(v, le) | 0) +
  38044. Math.imul(y, ue) | 0, a = a + Math.imul(y, le) | 0, r = r + Math.imul(p, ce) | 0, n = (n = n +
  38045. Math.imul(p, he) | 0) + Math.imul(m, ce) | 0, a = a + Math.imul(m, he) | 0;
  38046. var Ae = (l + (r = r + Math.imul(c, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(c, me) | 0) +
  38047. Math.imul(h, pe) | 0)) << 13) | 0;
  38048. l = ((a = a + Math.imul(h, me) | 0) + (n >>> 13) | 0) + (Ae >>> 26) | 0, Ae &= 67108863, r = Math
  38049. .imul(B, W), n = (n = Math.imul(B, q)) + Math.imul(F, W) | 0, a = Math.imul(F, q), r = r + Math
  38050. .imul(P, z) | 0, n = (n = n + Math.imul(P, K) | 0) + Math.imul(U, z) | 0, a = a + Math.imul(U,
  38051. K) | 0, r = r + Math.imul(I, Q) | 0, n = (n = n + Math.imul(I, J) | 0) + Math.imul(L, Q) | 0,
  38052. a = a + Math.imul(L, J) | 0, r = r + Math.imul(O, $) | 0, n = (n = n + Math.imul(O, ee) | 0) +
  38053. Math.imul(C, $) | 0, a = a + Math.imul(C, ee) | 0, r = r + Math.imul(k, ie) | 0, n = (n = n +
  38054. Math.imul(k, re) | 0) + Math.imul(R, ie) | 0, a = a + Math.imul(R, re) | 0, r = r + Math.imul(
  38055. T, ae) | 0, n = (n = n + Math.imul(T, se) | 0) + Math.imul(S, ae) | 0, a = a + Math.imul(S,
  38056. se) | 0, r = r + Math.imul(b, ue) | 0, n = (n = n + Math.imul(b, le) | 0) + Math.imul(w, ue) |
  38057. 0, a = a + Math.imul(w, le) | 0, r = r + Math.imul(v, ce) | 0, n = (n = n + Math.imul(v, he) |
  38058. 0) + Math.imul(y, ce) | 0, a = a + Math.imul(y, he) | 0;
  38059. var ke = (l + (r = r + Math.imul(p, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(p, me) | 0) +
  38060. Math.imul(m, pe) | 0)) << 13) | 0;
  38061. l = ((a = a + Math.imul(m, me) | 0) + (n >>> 13) | 0) + (ke >>> 26) | 0, ke &= 67108863, r = Math
  38062. .imul(B, z), n = (n = Math.imul(B, K)) + Math.imul(F, z) | 0, a = Math.imul(F, K), r = r + Math
  38063. .imul(P, Q) | 0, n = (n = n + Math.imul(P, J) | 0) + Math.imul(U, Q) | 0, a = a + Math.imul(U,
  38064. J) | 0, r = r + Math.imul(I, $) | 0, n = (n = n + Math.imul(I, ee) | 0) + Math.imul(L, $) | 0,
  38065. a = a + Math.imul(L, ee) | 0, r = r + Math.imul(O, ie) | 0, n = (n = n + Math.imul(O, re) | 0) +
  38066. Math.imul(C, ie) | 0, a = a + Math.imul(C, re) | 0, r = r + Math.imul(k, ae) | 0, n = (n = n +
  38067. Math.imul(k, se) | 0) + Math.imul(R, ae) | 0, a = a + Math.imul(R, se) | 0, r = r + Math.imul(
  38068. T, ue) | 0, n = (n = n + Math.imul(T, le) | 0) + Math.imul(S, ue) | 0, a = a + Math.imul(S,
  38069. le) | 0, r = r + Math.imul(b, ce) | 0, n = (n = n + Math.imul(b, he) | 0) + Math.imul(w, ce) |
  38070. 0, a = a + Math.imul(w, he) | 0;
  38071. var Re = (l + (r = r + Math.imul(v, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(v, me) | 0) +
  38072. Math.imul(y, pe) | 0)) << 13) | 0;
  38073. l = ((a = a + Math.imul(y, me) | 0) + (n >>> 13) | 0) + (Re >>> 26) | 0, Re &= 67108863, r = Math
  38074. .imul(B, Q), n = (n = Math.imul(B, J)) + Math.imul(F, Q) | 0, a = Math.imul(F, J), r = r + Math
  38075. .imul(P, $) | 0, n = (n = n + Math.imul(P, ee) | 0) + Math.imul(U, $) | 0, a = a + Math.imul(U,
  38076. ee) | 0, r = r + Math.imul(I, ie) | 0, n = (n = n + Math.imul(I, re) | 0) + Math.imul(L, ie) |
  38077. 0, a = a + Math.imul(L, re) | 0, r = r + Math.imul(O, ae) | 0, n = (n = n + Math.imul(O, se) |
  38078. 0) + Math.imul(C, ae) | 0, a = a + Math.imul(C, se) | 0, r = r + Math.imul(k, ue) | 0, n = (
  38079. n = n + Math.imul(k, le) | 0) + Math.imul(R, ue) | 0, a = a + Math.imul(R, le) | 0, r = r +
  38080. Math.imul(T, ce) | 0, n = (n = n + Math.imul(T, he) | 0) + Math.imul(S, ce) | 0, a = a + Math
  38081. .imul(S, he) | 0;
  38082. var Me = (l + (r = r + Math.imul(b, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(b, me) | 0) +
  38083. Math.imul(w, pe) | 0)) << 13) | 0;
  38084. l = ((a = a + Math.imul(w, me) | 0) + (n >>> 13) | 0) + (Me >>> 26) | 0, Me &= 67108863, r = Math
  38085. .imul(B, $), n = (n = Math.imul(B, ee)) + Math.imul(F, $) | 0, a = Math.imul(F, ee), r = r +
  38086. Math.imul(P, ie) | 0, n = (n = n + Math.imul(P, re) | 0) + Math.imul(U, ie) | 0, a = a + Math
  38087. .imul(U, re) | 0, r = r + Math.imul(I, ae) | 0, n = (n = n + Math.imul(I, se) | 0) + Math.imul(
  38088. L, ae) | 0, a = a + Math.imul(L, se) | 0, r = r + Math.imul(O, ue) | 0, n = (n = n + Math
  38089. .imul(O, le) | 0) + Math.imul(C, ue) | 0, a = a + Math.imul(C, le) | 0, r = r + Math.imul(k,
  38090. ce) | 0, n = (n = n + Math.imul(k, he) | 0) + Math.imul(R, ce) | 0, a = a + Math.imul(R, he) |
  38091. 0;
  38092. var Oe = (l + (r = r + Math.imul(T, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(T, me) | 0) +
  38093. Math.imul(S, pe) | 0)) << 13) | 0;
  38094. l = ((a = a + Math.imul(S, me) | 0) + (n >>> 13) | 0) + (Oe >>> 26) | 0, Oe &= 67108863, r = Math
  38095. .imul(B, ie), n = (n = Math.imul(B, re)) + Math.imul(F, ie) | 0, a = Math.imul(F, re), r = r +
  38096. Math.imul(P, ae) | 0, n = (n = n + Math.imul(P, se) | 0) + Math.imul(U, ae) | 0, a = a + Math
  38097. .imul(U, se) | 0, r = r + Math.imul(I, ue) | 0, n = (n = n + Math.imul(I, le) | 0) + Math.imul(
  38098. L, ue) | 0, a = a + Math.imul(L, le) | 0, r = r + Math.imul(O, ce) | 0, n = (n = n + Math
  38099. .imul(O, he) | 0) + Math.imul(C, ce) | 0, a = a + Math.imul(C, he) | 0;
  38100. var Ce = (l + (r = r + Math.imul(k, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(k, me) | 0) +
  38101. Math.imul(R, pe) | 0)) << 13) | 0;
  38102. l = ((a = a + Math.imul(R, me) | 0) + (n >>> 13) | 0) + (Ce >>> 26) | 0, Ce &= 67108863, r = Math
  38103. .imul(B, ae), n = (n = Math.imul(B, se)) + Math.imul(F, ae) | 0, a = Math.imul(F, se), r = r +
  38104. Math.imul(P, ue) | 0, n = (n = n + Math.imul(P, le) | 0) + Math.imul(U, ue) | 0, a = a + Math
  38105. .imul(U, le) | 0, r = r + Math.imul(I, ce) | 0, n = (n = n + Math.imul(I, he) | 0) + Math.imul(
  38106. L, ce) | 0, a = a + Math.imul(L, he) | 0;
  38107. var De = (l + (r = r + Math.imul(O, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(O, me) | 0) +
  38108. Math.imul(C, pe) | 0)) << 13) | 0;
  38109. l = ((a = a + Math.imul(C, me) | 0) + (n >>> 13) | 0) + (De >>> 26) | 0, De &= 67108863, r = Math
  38110. .imul(B, ue), n = (n = Math.imul(B, le)) + Math.imul(F, ue) | 0, a = Math.imul(F, le), r = r +
  38111. Math.imul(P, ce) | 0, n = (n = n + Math.imul(P, he) | 0) + Math.imul(U, ce) | 0, a = a + Math
  38112. .imul(U, he) | 0;
  38113. var Ie = (l + (r = r + Math.imul(I, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(I, me) | 0) +
  38114. Math.imul(L, pe) | 0)) << 13) | 0;
  38115. l = ((a = a + Math.imul(L, me) | 0) + (n >>> 13) | 0) + (Ie >>> 26) | 0, Ie &= 67108863, r = Math
  38116. .imul(B, ce), n = (n = Math.imul(B, he)) + Math.imul(F, ce) | 0, a = Math.imul(F, he);
  38117. var Le = (l + (r = r + Math.imul(P, pe) | 0) | 0) + ((8191 & (n = (n = n + Math.imul(P, me) | 0) +
  38118. Math.imul(U, pe) | 0)) << 13) | 0;
  38119. l = ((a = a + Math.imul(U, me) | 0) + (n >>> 13) | 0) + (Le >>> 26) | 0, Le &= 67108863;
  38120. var xe = (l + (r = Math.imul(B, pe)) | 0) + ((8191 & (n = (n = Math.imul(B, me)) + Math.imul(F,
  38121. pe) | 0)) << 13) | 0;
  38122. return l = ((a = Math.imul(F, me)) + (n >>> 13) | 0) + (xe >>> 26) | 0, xe &= 67108863, u[0] = ge,
  38123. u[1] = ve, u[2] = ye, u[3] = _e, u[4] = be, u[5] = we, u[6] = Ee, u[7] = Te, u[8] = Se, u[9] =
  38124. Ae, u[10] = ke, u[11] = Re, u[12] = Me, u[13] = Oe, u[14] = Ce, u[15] = De, u[16] = Ie, u[17] =
  38125. Le, u[18] = xe, 0 !== l && (u[19] = l, i.length++), i
  38126. };
  38127. function v(e, t, i) {
  38128. i.negative = t.negative ^ e.negative, i.length = e.length + t.length;
  38129. for (var r = 0, n = 0, a = 0; a < i.length - 1; a++) {
  38130. var s = n;
  38131. n = 0;
  38132. for (var o = 67108863 & r, u = Math.min(a, t.length - 1), l = Math.max(0, a - e.length + 1); l <=
  38133. u; l++) {
  38134. var d = a - l,
  38135. c = (0 | e.words[d]) * (0 | t.words[l]),
  38136. h = 67108863 & c;
  38137. o = 67108863 & (h = h + o | 0), n += (s = (s = s + (c / 67108864 | 0) | 0) + (h >>> 26) | 0) >>>
  38138. 26, s &= 67108863
  38139. }
  38140. i.words[a] = o, r = s, s = n
  38141. }
  38142. return 0 !== r ? i.words[a] = r : i.length--, i._strip()
  38143. }
  38144. function y(e, t, i) {
  38145. return v(e, t, i)
  38146. }
  38147. function _(e, t) {
  38148. this.x = e, this.y = t
  38149. }
  38150. Math.imul || (g = m), a.prototype.mulTo = function(e, t) {
  38151. var i = this.length + e.length;
  38152. return 10 === this.length && 10 === e.length ? g(this, e, t) : i < 63 ? m(this, e, t) : i < 1024 ?
  38153. v(this, e, t) : y(this, e, t)
  38154. }, _.prototype.makeRBT = function(e) {
  38155. for (var t = new Array(e), i = a.prototype._countBits(e) - 1, r = 0; r < e; r++) t[r] = this
  38156. .revBin(r, i, e);
  38157. return t
  38158. }, _.prototype.revBin = function(e, t, i) {
  38159. if (0 === e || e === i - 1) return e;
  38160. for (var r = 0, n = 0; n < t; n++) r |= (1 & e) << t - n - 1, e >>= 1;
  38161. return r
  38162. }, _.prototype.permute = function(e, t, i, r, n, a) {
  38163. for (var s = 0; s < a; s++) r[s] = t[e[s]], n[s] = i[e[s]]
  38164. }, _.prototype.transform = function(e, t, i, r, n, a) {
  38165. this.permute(a, e, t, i, r, n);
  38166. for (var s = 1; s < n; s <<= 1)
  38167. for (var o = s << 1, u = Math.cos(2 * Math.PI / o), l = Math.sin(2 * Math.PI / o), d = 0; d <
  38168. n; d += o)
  38169. for (var c = u, h = l, f = 0; f < s; f++) {
  38170. var p = i[d + f],
  38171. m = r[d + f],
  38172. g = i[d + f + s],
  38173. v = r[d + f + s],
  38174. y = c * g - h * v;
  38175. v = c * v + h * g, g = y, i[d + f] = p + g, r[d + f] = m + v, i[d + f + s] = p - g, r[d +
  38176. f + s] = m - v, f !== o && (y = u * c - l * h, h = u * h + l * c, c = y)
  38177. }
  38178. }, _.prototype.guessLen13b = function(e, t) {
  38179. var i = 1 | Math.max(t, e),
  38180. r = 1 & i,
  38181. n = 0;
  38182. for (i = i / 2 | 0; i; i >>>= 1) n++;
  38183. return 1 << n + 1 + r
  38184. }, _.prototype.conjugate = function(e, t, i) {
  38185. if (!(i <= 1))
  38186. for (var r = 0; r < i / 2; r++) {
  38187. var n = e[r];
  38188. e[r] = e[i - r - 1], e[i - r - 1] = n, n = t[r], t[r] = -t[i - r - 1], t[i - r - 1] = -n
  38189. }
  38190. }, _.prototype.normalize13b = function(e, t) {
  38191. for (var i = 0, r = 0; r < t / 2; r++) {
  38192. var n = 8192 * Math.round(e[2 * r + 1] / t) + Math.round(e[2 * r] / t) + i;
  38193. e[r] = 67108863 & n, i = n < 67108864 ? 0 : n / 67108864 | 0
  38194. }
  38195. return e
  38196. }, _.prototype.convert13b = function(e, t, i, n) {
  38197. for (var a = 0, s = 0; s < t; s++) a += 0 | e[s], i[2 * s] = 8191 & a, a >>>= 13, i[2 * s + 1] =
  38198. 8191 & a, a >>>= 13;
  38199. for (s = 2 * t; s < n; ++s) i[s] = 0;
  38200. r(0 === a), r(0 == (-8192 & a))
  38201. }, _.prototype.stub = function(e) {
  38202. for (var t = new Array(e), i = 0; i < e; i++) t[i] = 0;
  38203. return t
  38204. }, _.prototype.mulp = function(e, t, i) {
  38205. var r = 2 * this.guessLen13b(e.length, t.length),
  38206. n = this.makeRBT(r),
  38207. a = this.stub(r),
  38208. s = new Array(r),
  38209. o = new Array(r),
  38210. u = new Array(r),
  38211. l = new Array(r),
  38212. d = new Array(r),
  38213. c = new Array(r),
  38214. h = i.words;
  38215. h.length = r, this.convert13b(e.words, e.length, s, r), this.convert13b(t.words, t.length, l, r),
  38216. this.transform(s, a, o, u, r, n), this.transform(l, a, d, c, r, n);
  38217. for (var f = 0; f < r; f++) {
  38218. var p = o[f] * d[f] - u[f] * c[f];
  38219. u[f] = o[f] * c[f] + u[f] * d[f], o[f] = p
  38220. }
  38221. return this.conjugate(o, u, r), this.transform(o, u, h, a, r, n), this.conjugate(h, a, r), this
  38222. .normalize13b(h, r), i.negative = e.negative ^ t.negative, i.length = e.length + t.length, i
  38223. ._strip()
  38224. }, a.prototype.mul = function(e) {
  38225. var t = new a(null);
  38226. return t.words = new Array(this.length + e.length), this.mulTo(e, t)
  38227. }, a.prototype.mulf = function(e) {
  38228. var t = new a(null);
  38229. return t.words = new Array(this.length + e.length), y(this, e, t)
  38230. }, a.prototype.imul = function(e) {
  38231. return this.clone().mulTo(e, this)
  38232. }, a.prototype.imuln = function(e) {
  38233. var t = e < 0;
  38234. t && (e = -e), r("number" == typeof e), r(e < 67108864);
  38235. for (var i = 0, n = 0; n < this.length; n++) {
  38236. var a = (0 | this.words[n]) * e,
  38237. s = (67108863 & a) + (67108863 & i);
  38238. i >>= 26, i += a / 67108864 | 0, i += s >>> 26, this.words[n] = 67108863 & s
  38239. }
  38240. return 0 !== i && (this.words[n] = i, this.length++), t ? this.ineg() : this
  38241. }, a.prototype.muln = function(e) {
  38242. return this.clone().imuln(e)
  38243. }, a.prototype.sqr = function() {
  38244. return this.mul(this)
  38245. }, a.prototype.isqr = function() {
  38246. return this.imul(this.clone())
  38247. }, a.prototype.pow = function(e) {
  38248. var t = function(e) {
  38249. for (var t = new Array(e.bitLength()), i = 0; i < t.length; i++) {
  38250. var r = i / 26 | 0,
  38251. n = i % 26;
  38252. t[i] = e.words[r] >>> n & 1
  38253. }
  38254. return t
  38255. }(e);
  38256. if (0 === t.length) return new a(1);
  38257. for (var i = this, r = 0; r < t.length && 0 === t[r]; r++, i = i.sqr());
  38258. if (++r < t.length)
  38259. for (var n = i.sqr(); r < t.length; r++, n = n.sqr()) 0 !== t[r] && (i = i.mul(n));
  38260. return i
  38261. }, a.prototype.iushln = function(e) {
  38262. r("number" == typeof e && e >= 0);
  38263. var t, i = e % 26,
  38264. n = (e - i) / 26,
  38265. a = 67108863 >>> 26 - i << 26 - i;
  38266. if (0 !== i) {
  38267. var s = 0;
  38268. for (t = 0; t < this.length; t++) {
  38269. var o = this.words[t] & a,
  38270. u = (0 | this.words[t]) - o << i;
  38271. this.words[t] = u | s, s = o >>> 26 - i
  38272. }
  38273. s && (this.words[t] = s, this.length++)
  38274. }
  38275. if (0 !== n) {
  38276. for (t = this.length - 1; t >= 0; t--) this.words[t + n] = this.words[t];
  38277. for (t = 0; t < n; t++) this.words[t] = 0;
  38278. this.length += n
  38279. }
  38280. return this._strip()
  38281. }, a.prototype.ishln = function(e) {
  38282. return r(0 === this.negative), this.iushln(e)
  38283. }, a.prototype.iushrn = function(e, t, i) {
  38284. var n;
  38285. r("number" == typeof e && e >= 0), n = t ? (t - t % 26) / 26 : 0;
  38286. var a = e % 26,
  38287. s = Math.min((e - a) / 26, this.length),
  38288. o = 67108863 ^ 67108863 >>> a << a,
  38289. u = i;
  38290. if (n -= s, n = Math.max(0, n), u) {
  38291. for (var l = 0; l < s; l++) u.words[l] = this.words[l];
  38292. u.length = s
  38293. }
  38294. if (0 === s);
  38295. else if (this.length > s)
  38296. for (this.length -= s, l = 0; l < this.length; l++) this.words[l] = this.words[l + s];
  38297. else this.words[0] = 0, this.length = 1;
  38298. var d = 0;
  38299. for (l = this.length - 1; l >= 0 && (0 !== d || l >= n); l--) {
  38300. var c = 0 | this.words[l];
  38301. this.words[l] = d << 26 - a | c >>> a, d = c & o
  38302. }
  38303. return u && 0 !== d && (u.words[u.length++] = d), 0 === this.length && (this.words[0] = 0, this
  38304. .length = 1), this._strip()
  38305. }, a.prototype.ishrn = function(e, t, i) {
  38306. return r(0 === this.negative), this.iushrn(e, t, i)
  38307. }, a.prototype.shln = function(e) {
  38308. return this.clone().ishln(e)
  38309. }, a.prototype.ushln = function(e) {
  38310. return this.clone().iushln(e)
  38311. }, a.prototype.shrn = function(e) {
  38312. return this.clone().ishrn(e)
  38313. }, a.prototype.ushrn = function(e) {
  38314. return this.clone().iushrn(e)
  38315. }, a.prototype.testn = function(e) {
  38316. r("number" == typeof e && e >= 0);
  38317. var t = e % 26,
  38318. i = (e - t) / 26,
  38319. n = 1 << t;
  38320. return !(this.length <= i || !(this.words[i] & n))
  38321. }, a.prototype.imaskn = function(e) {
  38322. r("number" == typeof e && e >= 0);
  38323. var t = e % 26,
  38324. i = (e - t) / 26;
  38325. if (r(0 === this.negative, "imaskn works only with positive numbers"), this.length <= i)
  38326. return this;
  38327. if (0 !== t && i++, this.length = Math.min(i, this.length), 0 !== t) {
  38328. var n = 67108863 ^ 67108863 >>> t << t;
  38329. this.words[this.length - 1] &= n
  38330. }
  38331. return this._strip()
  38332. }, a.prototype.maskn = function(e) {
  38333. return this.clone().imaskn(e)
  38334. }, a.prototype.iaddn = function(e) {
  38335. return r("number" == typeof e), r(e < 67108864), e < 0 ? this.isubn(-e) : 0 !== this.negative ?
  38336. 1 === this.length && (0 | this.words[0]) <= e ? (this.words[0] = e - (0 | this.words[0]), this
  38337. .negative = 0, this) : (this.negative = 0, this.isubn(e), this.negative = 1, this) : this
  38338. ._iaddn(e)
  38339. }, a.prototype._iaddn = function(e) {
  38340. this.words[0] += e;
  38341. for (var t = 0; t < this.length && this.words[t] >= 67108864; t++) this.words[t] -= 67108864,
  38342. t === this.length - 1 ? this.words[t + 1] = 1 : this.words[t + 1]++;
  38343. return this.length = Math.max(this.length, t + 1), this
  38344. }, a.prototype.isubn = function(e) {
  38345. if (r("number" == typeof e), r(e < 67108864), e < 0) return this.iaddn(-e);
  38346. if (0 !== this.negative) return this.negative = 0, this.iaddn(e), this.negative = 1, this;
  38347. if (this.words[0] -= e, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0],
  38348. this.negative = 1;
  38349. else
  38350. for (var t = 0; t < this.length && this.words[t] < 0; t++) this.words[t] += 67108864, this
  38351. .words[t + 1] -= 1;
  38352. return this._strip()
  38353. }, a.prototype.addn = function(e) {
  38354. return this.clone().iaddn(e)
  38355. }, a.prototype.subn = function(e) {
  38356. return this.clone().isubn(e)
  38357. }, a.prototype.iabs = function() {
  38358. return this.negative = 0, this
  38359. }, a.prototype.abs = function() {
  38360. return this.clone().iabs()
  38361. }, a.prototype._ishlnsubmul = function(e, t, i) {
  38362. var n, a, s = e.length + i;
  38363. this._expand(s);
  38364. var o = 0;
  38365. for (n = 0; n < e.length; n++) {
  38366. a = (0 | this.words[n + i]) + o;
  38367. var u = (0 | e.words[n]) * t;
  38368. o = ((a -= 67108863 & u) >> 26) - (u / 67108864 | 0), this.words[n + i] = 67108863 & a
  38369. }
  38370. for (; n < this.length - i; n++) o = (a = (0 | this.words[n + i]) + o) >> 26, this.words[n + i] =
  38371. 67108863 & a;
  38372. if (0 === o) return this._strip();
  38373. for (r(-1 === o), o = 0, n = 0; n < this.length; n++) o = (a = -(0 | this.words[n]) + o) >> 26,
  38374. this.words[n] = 67108863 & a;
  38375. return this.negative = 1, this._strip()
  38376. }, a.prototype._wordDiv = function(e, t) {
  38377. var i = (this.length, e.length),
  38378. r = this.clone(),
  38379. n = e,
  38380. s = 0 | n.words[n.length - 1];
  38381. 0 != (i = 26 - this._countBits(s)) && (n = n.ushln(i), r.iushln(i), s = 0 | n.words[n.length -
  38382. 1]);
  38383. var o, u = r.length - n.length;
  38384. if ("mod" !== t) {
  38385. (o = new a(null)).length = u + 1, o.words = new Array(o.length);
  38386. for (var l = 0; l < o.length; l++) o.words[l] = 0
  38387. }
  38388. var d = r.clone()._ishlnsubmul(n, 1, u);
  38389. 0 === d.negative && (r = d, o && (o.words[u] = 1));
  38390. for (var c = u - 1; c >= 0; c--) {
  38391. var h = 67108864 * (0 | r.words[n.length + c]) + (0 | r.words[n.length + c - 1]);
  38392. for (h = Math.min(h / s | 0, 67108863), r._ishlnsubmul(n, h, c); 0 !== r.negative;) h--, r
  38393. .negative = 0, r._ishlnsubmul(n, 1, c), r.isZero() || (r.negative ^= 1);
  38394. o && (o.words[c] = h)
  38395. }
  38396. return o && o._strip(), r._strip(), "div" !== t && 0 !== i && r.iushrn(i), {
  38397. div: o || null,
  38398. mod: r
  38399. }
  38400. }, a.prototype.divmod = function(e, t, i) {
  38401. return r(!e.isZero()), this.isZero() ? {
  38402. div: new a(0),
  38403. mod: new a(0)
  38404. } : 0 !== this.negative && 0 === e.negative ? (o = this.neg().divmod(e, t), "mod" !== t && (n =
  38405. o.div.neg()), "div" !== t && (s = o.mod.neg(), i && 0 !== s.negative && s.iadd(e)), {
  38406. div: n,
  38407. mod: s
  38408. }) : 0 === this.negative && 0 !== e.negative ? (o = this.divmod(e.neg(), t), "mod" !== t && (n =
  38409. o.div.neg()), {
  38410. div: n,
  38411. mod: o.mod
  38412. }) : 0 != (this.negative & e.negative) ? (o = this.neg().divmod(e.neg(), t), "div" !== t && (s =
  38413. o.mod.neg(), i && 0 !== s.negative && s.isub(e)), {
  38414. div: o.div,
  38415. mod: s
  38416. }) : e.length > this.length || this.cmp(e) < 0 ? {
  38417. div: new a(0),
  38418. mod: this
  38419. } : 1 === e.length ? "div" === t ? {
  38420. div: this.divn(e.words[0]),
  38421. mod: null
  38422. } : "mod" === t ? {
  38423. div: null,
  38424. mod: new a(this.modrn(e.words[0]))
  38425. } : {
  38426. div: this.divn(e.words[0]),
  38427. mod: new a(this.modrn(e.words[0]))
  38428. } : this._wordDiv(e, t);
  38429. var n, s, o
  38430. }, a.prototype.div = function(e) {
  38431. return this.divmod(e, "div", !1).div
  38432. }, a.prototype.mod = function(e) {
  38433. return this.divmod(e, "mod", !1).mod
  38434. }, a.prototype.umod = function(e) {
  38435. return this.divmod(e, "mod", !0).mod
  38436. }, a.prototype.divRound = function(e) {
  38437. var t = this.divmod(e);
  38438. if (t.mod.isZero()) return t.div;
  38439. var i = 0 !== t.div.negative ? t.mod.isub(e) : t.mod,
  38440. r = e.ushrn(1),
  38441. n = e.andln(1),
  38442. a = i.cmp(r);
  38443. return a < 0 || 1 === n && 0 === a ? t.div : 0 !== t.div.negative ? t.div.isubn(1) : t.div.iaddn(
  38444. 1)
  38445. }, a.prototype.modrn = function(e) {
  38446. var t = e < 0;
  38447. t && (e = -e), r(e <= 67108863);
  38448. for (var i = (1 << 26) % e, n = 0, a = this.length - 1; a >= 0; a--) n = (i * n + (0 | this.words[
  38449. a])) % e;
  38450. return t ? -n : n
  38451. }, a.prototype.modn = function(e) {
  38452. return this.modrn(e)
  38453. }, a.prototype.idivn = function(e) {
  38454. var t = e < 0;
  38455. t && (e = -e), r(e <= 67108863);
  38456. for (var i = 0, n = this.length - 1; n >= 0; n--) {
  38457. var a = (0 | this.words[n]) + 67108864 * i;
  38458. this.words[n] = a / e | 0, i = a % e
  38459. }
  38460. return this._strip(), t ? this.ineg() : this
  38461. }, a.prototype.divn = function(e) {
  38462. return this.clone().idivn(e)
  38463. }, a.prototype.egcd = function(e) {
  38464. r(0 === e.negative), r(!e.isZero());
  38465. var t = this,
  38466. i = e.clone();
  38467. t = 0 !== t.negative ? t.umod(e) : t.clone();
  38468. for (var n = new a(1), s = new a(0), o = new a(0), u = new a(1), l = 0; t.isEven() && i.isEven();)
  38469. t.iushrn(1), i.iushrn(1), ++l;
  38470. for (var d = i.clone(), c = t.clone(); !t.isZero();) {
  38471. for (var h = 0, f = 1; 0 == (t.words[0] & f) && h < 26; ++h, f <<= 1);
  38472. if (h > 0)
  38473. for (t.iushrn(h); h-- > 0;)(n.isOdd() || s.isOdd()) && (n.iadd(d), s.isub(c)), n.iushrn(1), s
  38474. .iushrn(1);
  38475. for (var p = 0, m = 1; 0 == (i.words[0] & m) && p < 26; ++p, m <<= 1);
  38476. if (p > 0)
  38477. for (i.iushrn(p); p-- > 0;)(o.isOdd() || u.isOdd()) && (o.iadd(d), u.isub(c)), o.iushrn(1), u
  38478. .iushrn(1);
  38479. t.cmp(i) >= 0 ? (t.isub(i), n.isub(o), s.isub(u)) : (i.isub(t), o.isub(n), u.isub(s))
  38480. }
  38481. return {
  38482. a: o,
  38483. b: u,
  38484. gcd: i.iushln(l)
  38485. }
  38486. }, a.prototype._invmp = function(e) {
  38487. r(0 === e.negative), r(!e.isZero());
  38488. var t = this,
  38489. i = e.clone();
  38490. t = 0 !== t.negative ? t.umod(e) : t.clone();
  38491. for (var n, s = new a(1), o = new a(0), u = i.clone(); t.cmpn(1) > 0 && i.cmpn(1) > 0;) {
  38492. for (var l = 0, d = 1; 0 == (t.words[0] & d) && l < 26; ++l, d <<= 1);
  38493. if (l > 0)
  38494. for (t.iushrn(l); l-- > 0;) s.isOdd() && s.iadd(u), s.iushrn(1);
  38495. for (var c = 0, h = 1; 0 == (i.words[0] & h) && c < 26; ++c, h <<= 1);
  38496. if (c > 0)
  38497. for (i.iushrn(c); c-- > 0;) o.isOdd() && o.iadd(u), o.iushrn(1);
  38498. t.cmp(i) >= 0 ? (t.isub(i), s.isub(o)) : (i.isub(t), o.isub(s))
  38499. }
  38500. return (n = 0 === t.cmpn(1) ? s : o).cmpn(0) < 0 && n.iadd(e), n
  38501. }, a.prototype.gcd = function(e) {
  38502. if (this.isZero()) return e.abs();
  38503. if (e.isZero()) return this.abs();
  38504. var t = this.clone(),
  38505. i = e.clone();
  38506. t.negative = 0, i.negative = 0;
  38507. for (var r = 0; t.isEven() && i.isEven(); r++) t.iushrn(1), i.iushrn(1);
  38508. for (;;) {
  38509. for (; t.isEven();) t.iushrn(1);
  38510. for (; i.isEven();) i.iushrn(1);
  38511. var n = t.cmp(i);
  38512. if (n < 0) {
  38513. var a = t;
  38514. t = i, i = a
  38515. } else if (0 === n || 0 === i.cmpn(1)) break;
  38516. t.isub(i)
  38517. }
  38518. return i.iushln(r)
  38519. }, a.prototype.invm = function(e) {
  38520. return this.egcd(e).a.umod(e)
  38521. }, a.prototype.isEven = function() {
  38522. return 0 == (1 & this.words[0])
  38523. }, a.prototype.isOdd = function() {
  38524. return 1 == (1 & this.words[0])
  38525. }, a.prototype.andln = function(e) {
  38526. return this.words[0] & e
  38527. }, a.prototype.bincn = function(e) {
  38528. r("number" == typeof e);
  38529. var t = e % 26,
  38530. i = (e - t) / 26,
  38531. n = 1 << t;
  38532. if (this.length <= i) return this._expand(i + 1), this.words[i] |= n, this;
  38533. for (var a = n, s = i; 0 !== a && s < this.length; s++) {
  38534. var o = 0 | this.words[s];
  38535. a = (o += a) >>> 26, o &= 67108863, this.words[s] = o
  38536. }
  38537. return 0 !== a && (this.words[s] = a, this.length++), this
  38538. }, a.prototype.isZero = function() {
  38539. return 1 === this.length && 0 === this.words[0]
  38540. }, a.prototype.cmpn = function(e) {
  38541. var t, i = e < 0;
  38542. if (0 !== this.negative && !i) return -1;
  38543. if (0 === this.negative && i) return 1;
  38544. if (this._strip(), this.length > 1) t = 1;
  38545. else {
  38546. i && (e = -e), r(e <= 67108863, "Number is too big");
  38547. var n = 0 | this.words[0];
  38548. t = n === e ? 0 : n < e ? -1 : 1
  38549. }
  38550. return 0 !== this.negative ? 0 | -t : t
  38551. }, a.prototype.cmp = function(e) {
  38552. if (0 !== this.negative && 0 === e.negative) return -1;
  38553. if (0 === this.negative && 0 !== e.negative) return 1;
  38554. var t = this.ucmp(e);
  38555. return 0 !== this.negative ? 0 | -t : t
  38556. }, a.prototype.ucmp = function(e) {
  38557. if (this.length > e.length) return 1;
  38558. if (this.length < e.length) return -1;
  38559. for (var t = 0, i = this.length - 1; i >= 0; i--) {
  38560. var r = 0 | this.words[i],
  38561. n = 0 | e.words[i];
  38562. if (r !== n) {
  38563. r < n ? t = -1 : r > n && (t = 1);
  38564. break
  38565. }
  38566. }
  38567. return t
  38568. }, a.prototype.gtn = function(e) {
  38569. return 1 === this.cmpn(e)
  38570. }, a.prototype.gt = function(e) {
  38571. return 1 === this.cmp(e)
  38572. }, a.prototype.gten = function(e) {
  38573. return this.cmpn(e) >= 0
  38574. }, a.prototype.gte = function(e) {
  38575. return this.cmp(e) >= 0
  38576. }, a.prototype.ltn = function(e) {
  38577. return -1 === this.cmpn(e)
  38578. }, a.prototype.lt = function(e) {
  38579. return -1 === this.cmp(e)
  38580. }, a.prototype.lten = function(e) {
  38581. return this.cmpn(e) <= 0
  38582. }, a.prototype.lte = function(e) {
  38583. return this.cmp(e) <= 0
  38584. }, a.prototype.eqn = function(e) {
  38585. return 0 === this.cmpn(e)
  38586. }, a.prototype.eq = function(e) {
  38587. return 0 === this.cmp(e)
  38588. }, a.red = function(e) {
  38589. return new k(e)
  38590. }, a.prototype.toRed = function(e) {
  38591. return r(!this.red, "Already a number in reduction context"), r(0 === this.negative,
  38592. "red works only with positives"), e.convertTo(this)._forceRed(e)
  38593. }, a.prototype.fromRed = function() {
  38594. return r(this.red, "fromRed works only with numbers in reduction context"), this.red.convertFrom(
  38595. this)
  38596. }, a.prototype._forceRed = function(e) {
  38597. return this.red = e, this
  38598. }, a.prototype.forceRed = function(e) {
  38599. return r(!this.red, "Already a number in reduction context"), this._forceRed(e)
  38600. }, a.prototype.redAdd = function(e) {
  38601. return r(this.red, "redAdd works only with red numbers"), this.red.add(this, e)
  38602. }, a.prototype.redIAdd = function(e) {
  38603. return r(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, e)
  38604. }, a.prototype.redSub = function(e) {
  38605. return r(this.red, "redSub works only with red numbers"), this.red.sub(this, e)
  38606. }, a.prototype.redISub = function(e) {
  38607. return r(this.red, "redISub works only with red numbers"), this.red.isub(this, e)
  38608. }, a.prototype.redShl = function(e) {
  38609. return r(this.red, "redShl works only with red numbers"), this.red.shl(this, e)
  38610. }, a.prototype.redMul = function(e) {
  38611. return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red
  38612. .mul(this, e)
  38613. }, a.prototype.redIMul = function(e) {
  38614. return r(this.red, "redMul works only with red numbers"), this.red._verify2(this, e), this.red
  38615. .imul(this, e)
  38616. }, a.prototype.redSqr = function() {
  38617. return r(this.red, "redSqr works only with red numbers"), this.red._verify1(this), this.red.sqr(
  38618. this)
  38619. }, a.prototype.redISqr = function() {
  38620. return r(this.red, "redISqr works only with red numbers"), this.red._verify1(this), this.red.isqr(
  38621. this)
  38622. }, a.prototype.redSqrt = function() {
  38623. return r(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), this.red.sqrt(
  38624. this)
  38625. }, a.prototype.redInvm = function() {
  38626. return r(this.red, "redInvm works only with red numbers"), this.red._verify1(this), this.red.invm(
  38627. this)
  38628. }, a.prototype.redNeg = function() {
  38629. return r(this.red, "redNeg works only with red numbers"), this.red._verify1(this), this.red.neg(
  38630. this)
  38631. }, a.prototype.redPow = function(e) {
  38632. return r(this.red && !e.red, "redPow(normalNum)"), this.red._verify1(this), this.red.pow(this, e)
  38633. };
  38634. var b = {
  38635. k256: null,
  38636. p224: null,
  38637. p192: null,
  38638. p25519: null
  38639. };
  38640. function w(e, t) {
  38641. this.name = e, this.p = new a(t, 16), this.n = this.p.bitLength(), this.k = new a(1).iushln(this.n)
  38642. .isub(this.p), this.tmp = this._tmp()
  38643. }
  38644. function E() {
  38645. w.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")
  38646. }
  38647. function T() {
  38648. w.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")
  38649. }
  38650. function S() {
  38651. w.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")
  38652. }
  38653. function A() {
  38654. w.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")
  38655. }
  38656. function k(e) {
  38657. if ("string" == typeof e) {
  38658. var t = a._prime(e);
  38659. this.m = t.p, this.prime = t
  38660. } else r(e.gtn(1), "modulus must be greater than 1"), this.m = e, this.prime = null
  38661. }
  38662. function R(e) {
  38663. k.call(this, e), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this
  38664. .shift % 26), this.r = new a(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this
  38665. .rinv = this.r._invmp(this.m), this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv =
  38666. this.minv.umod(this.r), this.minv = this.r.sub(this.minv)
  38667. }
  38668. w.prototype._tmp = function() {
  38669. var e = new a(null);
  38670. return e.words = new Array(Math.ceil(this.n / 13)), e
  38671. }, w.prototype.ireduce = function(e) {
  38672. var t, i = e;
  38673. do {
  38674. this.split(i, this.tmp), t = (i = (i = this.imulK(i)).iadd(this.tmp)).bitLength()
  38675. } while (t > this.n);
  38676. var r = t < this.n ? -1 : i.ucmp(this.p);
  38677. return 0 === r ? (i.words[0] = 0, i.length = 1) : r > 0 ? i.isub(this.p) : void 0 !== i.strip ? i
  38678. .strip() : i._strip(), i
  38679. }, w.prototype.split = function(e, t) {
  38680. e.iushrn(this.n, 0, t)
  38681. }, w.prototype.imulK = function(e) {
  38682. return e.imul(this.k)
  38683. }, n(E, w), E.prototype.split = function(e, t) {
  38684. for (var i = Math.min(e.length, 9), r = 0; r < i; r++) t.words[r] = e.words[r];
  38685. if (t.length = i, e.length <= 9) return e.words[0] = 0, void(e.length = 1);
  38686. var n = e.words[9];
  38687. for (t.words[t.length++] = 4194303 & n, r = 10; r < e.length; r++) {
  38688. var a = 0 | e.words[r];
  38689. e.words[r - 10] = (4194303 & a) << 4 | n >>> 22, n = a
  38690. }
  38691. n >>>= 22, e.words[r - 10] = n, 0 === n && e.length > 10 ? e.length -= 10 : e.length -= 9
  38692. }, E.prototype.imulK = function(e) {
  38693. e.words[e.length] = 0, e.words[e.length + 1] = 0, e.length += 2;
  38694. for (var t = 0, i = 0; i < e.length; i++) {
  38695. var r = 0 | e.words[i];
  38696. t += 977 * r, e.words[i] = 67108863 & t, t = 64 * r + (t / 67108864 | 0)
  38697. }
  38698. return 0 === e.words[e.length - 1] && (e.length--, 0 === e.words[e.length - 1] && e.length--), e
  38699. }, n(T, w), n(S, w), n(A, w), A.prototype.imulK = function(e) {
  38700. for (var t = 0, i = 0; i < e.length; i++) {
  38701. var r = 19 * (0 | e.words[i]) + t,
  38702. n = 67108863 & r;
  38703. r >>>= 26, e.words[i] = n, t = r
  38704. }
  38705. return 0 !== t && (e.words[e.length++] = t), e
  38706. }, a._prime = function(e) {
  38707. if (b[e]) return b[e];
  38708. var t;
  38709. if ("k256" === e) t = new E;
  38710. else if ("p224" === e) t = new T;
  38711. else if ("p192" === e) t = new S;
  38712. else {
  38713. if ("p25519" !== e) throw new Error("Unknown prime " + e);
  38714. t = new A
  38715. }
  38716. return b[e] = t, t
  38717. }, k.prototype._verify1 = function(e) {
  38718. r(0 === e.negative, "red works only with positives"), r(e.red, "red works only with red numbers")
  38719. }, k.prototype._verify2 = function(e, t) {
  38720. r(0 == (e.negative | t.negative), "red works only with positives"), r(e.red && e.red === t.red,
  38721. "red works only with red numbers")
  38722. }, k.prototype.imod = function(e) {
  38723. return this.prime ? this.prime.ireduce(e)._forceRed(this) : (d(e, e.umod(this.m)._forceRed(this)),
  38724. e)
  38725. }, k.prototype.neg = function(e) {
  38726. return e.isZero() ? e.clone() : this.m.sub(e)._forceRed(this)
  38727. }, k.prototype.add = function(e, t) {
  38728. this._verify2(e, t);
  38729. var i = e.add(t);
  38730. return i.cmp(this.m) >= 0 && i.isub(this.m), i._forceRed(this)
  38731. }, k.prototype.iadd = function(e, t) {
  38732. this._verify2(e, t);
  38733. var i = e.iadd(t);
  38734. return i.cmp(this.m) >= 0 && i.isub(this.m), i
  38735. }, k.prototype.sub = function(e, t) {
  38736. this._verify2(e, t);
  38737. var i = e.sub(t);
  38738. return i.cmpn(0) < 0 && i.iadd(this.m), i._forceRed(this)
  38739. }, k.prototype.isub = function(e, t) {
  38740. this._verify2(e, t);
  38741. var i = e.isub(t);
  38742. return i.cmpn(0) < 0 && i.iadd(this.m), i
  38743. }, k.prototype.shl = function(e, t) {
  38744. return this._verify1(e), this.imod(e.ushln(t))
  38745. }, k.prototype.imul = function(e, t) {
  38746. return this._verify2(e, t), this.imod(e.imul(t))
  38747. }, k.prototype.mul = function(e, t) {
  38748. return this._verify2(e, t), this.imod(e.mul(t))
  38749. }, k.prototype.isqr = function(e) {
  38750. return this.imul(e, e.clone())
  38751. }, k.prototype.sqr = function(e) {
  38752. return this.mul(e, e)
  38753. }, k.prototype.sqrt = function(e) {
  38754. if (e.isZero()) return e.clone();
  38755. var t = this.m.andln(3);
  38756. if (r(t % 2 == 1), 3 === t) {
  38757. var i = this.m.add(new a(1)).iushrn(2);
  38758. return this.pow(e, i)
  38759. }
  38760. for (var n = this.m.subn(1), s = 0; !n.isZero() && 0 === n.andln(1);) s++, n.iushrn(1);
  38761. r(!n.isZero());
  38762. var o = new a(1).toRed(this),
  38763. u = o.redNeg(),
  38764. l = this.m.subn(1).iushrn(1),
  38765. d = this.m.bitLength();
  38766. for (d = new a(2 * d * d).toRed(this); 0 !== this.pow(d, l).cmp(u);) d.redIAdd(u);
  38767. for (var c = this.pow(d, n), h = this.pow(e, n.addn(1).iushrn(1)), f = this.pow(e, n), p =
  38768. s; 0 !== f.cmp(o);) {
  38769. for (var m = f, g = 0; 0 !== m.cmp(o); g++) m = m.redSqr();
  38770. r(g < p);
  38771. var v = this.pow(c, new a(1).iushln(p - g - 1));
  38772. h = h.redMul(v), c = v.redSqr(), f = f.redMul(c), p = g
  38773. }
  38774. return h
  38775. }, k.prototype.invm = function(e) {
  38776. var t = e._invmp(this.m);
  38777. return 0 !== t.negative ? (t.negative = 0, this.imod(t).redNeg()) : this.imod(t)
  38778. }, k.prototype.pow = function(e, t) {
  38779. if (t.isZero()) return new a(1).toRed(this);
  38780. if (0 === t.cmpn(1)) return e.clone();
  38781. var i = new Array(16);
  38782. i[0] = new a(1).toRed(this), i[1] = e;
  38783. for (var r = 2; r < i.length; r++) i[r] = this.mul(i[r - 1], e);
  38784. var n = i[0],
  38785. s = 0,
  38786. o = 0,
  38787. u = t.bitLength() % 26;
  38788. for (0 === u && (u = 26), r = t.length - 1; r >= 0; r--) {
  38789. for (var l = t.words[r], d = u - 1; d >= 0; d--) {
  38790. var c = l >> d & 1;
  38791. n !== i[0] && (n = this.sqr(n)), 0 !== c || 0 !== s ? (s <<= 1, s |= c, (4 == ++o || 0 ===
  38792. r && 0 === d) && (n = this.mul(n, i[s]), o = 0, s = 0)) : o = 0
  38793. }
  38794. u = 26
  38795. }
  38796. return n
  38797. }, k.prototype.convertTo = function(e) {
  38798. var t = e.umod(this.m);
  38799. return t === e ? t.clone() : t
  38800. }, k.prototype.convertFrom = function(e) {
  38801. var t = e.clone();
  38802. return t.red = null, t
  38803. }, a.mont = function(e) {
  38804. return new R(e)
  38805. }, n(R, k), R.prototype.convertTo = function(e) {
  38806. return this.imod(e.ushln(this.shift))
  38807. }, R.prototype.convertFrom = function(e) {
  38808. var t = this.imod(e.mul(this.rinv));
  38809. return t.red = null, t
  38810. }, R.prototype.imul = function(e, t) {
  38811. if (e.isZero() || t.isZero()) return e.words[0] = 0, e.length = 1, e;
  38812. var i = e.imul(t),
  38813. r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
  38814. n = i.isub(r).iushrn(this.shift),
  38815. a = n;
  38816. return n.cmp(this.m) >= 0 ? a = n.isub(this.m) : n.cmpn(0) < 0 && (a = n.iadd(this.m)), a
  38817. ._forceRed(this)
  38818. }, R.prototype.mul = function(e, t) {
  38819. if (e.isZero() || t.isZero()) return new a(0)._forceRed(this);
  38820. var i = e.mul(t),
  38821. r = i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),
  38822. n = i.isub(r).iushrn(this.shift),
  38823. s = n;
  38824. return n.cmp(this.m) >= 0 ? s = n.isub(this.m) : n.cmpn(0) < 0 && (s = n.iadd(this.m)), s
  38825. ._forceRed(this)
  38826. }, R.prototype.invm = function(e) {
  38827. return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)
  38828. }
  38829. }(e, this)
  38830. }).call(this, i(55)(e))
  38831. }, function(e, t) {}, function(e) {
  38832. e.exports = JSON.parse(
  38833. '{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny <fedor@indutny.com>","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}'
  38834. )
  38835. }, function(e, t, i) {
  38836. "use strict";
  38837. var r = i(15),
  38838. n = i(11),
  38839. a = i(5),
  38840. s = i(41),
  38841. o = r.assert;
  38842. function u(e) {
  38843. s.call(this, "short", e), this.a = new n(e.a, 16).toRed(this.red), this.b = new n(e.b, 16).toRed(this
  38844. .red), this.tinv = this.two.redInvm(), this.zeroA = 0 === this.a.fromRed().cmpn(0), this.threeA = 0 ===
  38845. this.a.fromRed().sub(this.p).cmpn(-3), this.endo = this._getEndomorphism(e), this._endoWnafT1 =
  38846. new Array(4), this._endoWnafT2 = new Array(4)
  38847. }
  38848. function l(e, t, i, r) {
  38849. s.BasePoint.call(this, e, "affine"), null === t && null === i ? (this.x = null, this.y = null, this
  38850. .inf = !0) : (this.x = new n(t, 16), this.y = new n(i, 16), r && (this.x.forceRed(this.curve.red),
  38851. this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y
  38852. .red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1)
  38853. }
  38854. function d(e, t, i, r) {
  38855. s.BasePoint.call(this, e, "jacobian"), null === t && null === i && null === r ? (this.x = this.curve.one,
  38856. this.y = this.curve.one, this.z = new n(0)) : (this.x = new n(t, 16), this.y = new n(i, 16), this.z =
  38857. new n(r, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y
  38858. .toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.zOne = this.z ===
  38859. this.curve.one
  38860. }
  38861. a(u, s), e.exports = u, u.prototype._getEndomorphism = function(e) {
  38862. if (this.zeroA && this.g && this.n && 1 === this.p.modn(3)) {
  38863. var t, i;
  38864. if (e.beta) t = new n(e.beta, 16).toRed(this.red);
  38865. else {
  38866. var r = this._getEndoRoots(this.p);
  38867. t = (t = r[0].cmp(r[1]) < 0 ? r[0] : r[1]).toRed(this.red)
  38868. }
  38869. if (e.lambda) i = new n(e.lambda, 16);
  38870. else {
  38871. var a = this._getEndoRoots(this.n);
  38872. 0 === this.g.mul(a[0]).x.cmp(this.g.x.redMul(t)) ? i = a[0] : (i = a[1], o(0 === this.g.mul(i).x
  38873. .cmp(this.g.x.redMul(t))))
  38874. }
  38875. return {
  38876. beta: t,
  38877. lambda: i,
  38878. basis: e.basis ? e.basis.map(function(e) {
  38879. return {
  38880. a: new n(e.a, 16),
  38881. b: new n(e.b, 16)
  38882. }
  38883. }) : this._getEndoBasis(i)
  38884. }
  38885. }
  38886. }, u.prototype._getEndoRoots = function(e) {
  38887. var t = e === this.p ? this.red : n.mont(e),
  38888. i = new n(2).toRed(t).redInvm(),
  38889. r = i.redNeg(),
  38890. a = new n(3).toRed(t).redNeg().redSqrt().redMul(i);
  38891. return [r.redAdd(a).fromRed(), r.redSub(a).fromRed()]
  38892. }, u.prototype._getEndoBasis = function(e) {
  38893. for (var t, i, r, a, s, o, u, l, d, c = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), h = e, f =
  38894. this.n.clone(), p = new n(1), m = new n(0), g = new n(0), v = new n(1), y = 0; 0 !== h.cmpn(0);) {
  38895. var _ = f.div(h);
  38896. l = f.sub(_.mul(h)), d = g.sub(_.mul(p));
  38897. var b = v.sub(_.mul(m));
  38898. if (!r && l.cmp(c) < 0) t = u.neg(), i = p, r = l.neg(), a = d;
  38899. else if (r && 2 == ++y) break;
  38900. u = l, f = h, h = l, g = p, p = d, v = m, m = b
  38901. }
  38902. s = l.neg(), o = d;
  38903. var w = r.sqr().add(a.sqr());
  38904. return s.sqr().add(o.sqr()).cmp(w) >= 0 && (s = t, o = i), r.negative && (r = r.neg(), a = a.neg()), s
  38905. .negative && (s = s.neg(), o = o.neg()), [{
  38906. a: r,
  38907. b: a
  38908. }, {
  38909. a: s,
  38910. b: o
  38911. }]
  38912. }, u.prototype._endoSplit = function(e) {
  38913. var t = this.endo.basis,
  38914. i = t[0],
  38915. r = t[1],
  38916. n = r.b.mul(e).divRound(this.n),
  38917. a = i.b.neg().mul(e).divRound(this.n),
  38918. s = n.mul(i.a),
  38919. o = a.mul(r.a),
  38920. u = n.mul(i.b),
  38921. l = a.mul(r.b);
  38922. return {
  38923. k1: e.sub(s).sub(o),
  38924. k2: u.add(l).neg()
  38925. }
  38926. }, u.prototype.pointFromX = function(e, t) {
  38927. (e = new n(e, 16)).red || (e = e.toRed(this.red));
  38928. var i = e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),
  38929. r = i.redSqrt();
  38930. if (0 !== r.redSqr().redSub(i).cmp(this.zero)) throw new Error("invalid point");
  38931. var a = r.fromRed().isOdd();
  38932. return (t && !a || !t && a) && (r = r.redNeg()), this.point(e, r)
  38933. }, u.prototype.validate = function(e) {
  38934. if (e.inf) return !0;
  38935. var t = e.x,
  38936. i = e.y,
  38937. r = this.a.redMul(t),
  38938. n = t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);
  38939. return 0 === i.redSqr().redISub(n).cmpn(0)
  38940. }, u.prototype._endoWnafMulAdd = function(e, t, i) {
  38941. for (var r = this._endoWnafT1, n = this._endoWnafT2, a = 0; a < e.length; a++) {
  38942. var s = this._endoSplit(t[a]),
  38943. o = e[a],
  38944. u = o._getBeta();
  38945. s.k1.negative && (s.k1.ineg(), o = o.neg(!0)), s.k2.negative && (s.k2.ineg(), u = u.neg(!0)), r[2 *
  38946. a] = o, r[2 * a + 1] = u, n[2 * a] = s.k1, n[2 * a + 1] = s.k2
  38947. }
  38948. for (var l = this._wnafMulAdd(1, r, n, 2 * a, i), d = 0; d < 2 * a; d++) r[d] = null, n[d] = null;
  38949. return l
  38950. }, a(l, s.BasePoint), u.prototype.point = function(e, t, i) {
  38951. return new l(this, e, t, i)
  38952. }, u.prototype.pointFromJSON = function(e, t) {
  38953. return l.fromJSON(this, e, t)
  38954. }, l.prototype._getBeta = function() {
  38955. if (this.curve.endo) {
  38956. var e = this.precomputed;
  38957. if (e && e.beta) return e.beta;
  38958. var t = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
  38959. if (e) {
  38960. var i = this.curve,
  38961. r = function(e) {
  38962. return i.point(e.x.redMul(i.endo.beta), e.y)
  38963. };
  38964. e.beta = t, t.precomputed = {
  38965. beta: null,
  38966. naf: e.naf && {
  38967. wnd: e.naf.wnd,
  38968. points: e.naf.points.map(r)
  38969. },
  38970. doubles: e.doubles && {
  38971. step: e.doubles.step,
  38972. points: e.doubles.points.map(r)
  38973. }
  38974. }
  38975. }
  38976. return t
  38977. }
  38978. }, l.prototype.toJSON = function() {
  38979. return this.precomputed ? [this.x, this.y, this.precomputed && {
  38980. doubles: this.precomputed.doubles && {
  38981. step: this.precomputed.doubles.step,
  38982. points: this.precomputed.doubles.points.slice(1)
  38983. },
  38984. naf: this.precomputed.naf && {
  38985. wnd: this.precomputed.naf.wnd,
  38986. points: this.precomputed.naf.points.slice(1)
  38987. }
  38988. }] : [this.x, this.y]
  38989. }, l.fromJSON = function(e, t, i) {
  38990. "string" == typeof t && (t = JSON.parse(t));
  38991. var r = e.point(t[0], t[1], i);
  38992. if (!t[2]) return r;
  38993. function n(t) {
  38994. return e.point(t[0], t[1], i)
  38995. }
  38996. var a = t[2];
  38997. return r.precomputed = {
  38998. beta: null,
  38999. doubles: a.doubles && {
  39000. step: a.doubles.step,
  39001. points: [r].concat(a.doubles.points.map(n))
  39002. },
  39003. naf: a.naf && {
  39004. wnd: a.naf.wnd,
  39005. points: [r].concat(a.naf.points.map(n))
  39006. }
  39007. }, r
  39008. }, l.prototype.inspect = function() {
  39009. return this.isInfinity() ? "<EC Point Infinity>" : "<EC Point x: " + this.x.fromRed().toString(16, 2) +
  39010. " y: " + this.y.fromRed().toString(16, 2) + ">"
  39011. }, l.prototype.isInfinity = function() {
  39012. return this.inf
  39013. }, l.prototype.add = function(e) {
  39014. if (this.inf) return e;
  39015. if (e.inf) return this;
  39016. if (this.eq(e)) return this.dbl();
  39017. if (this.neg().eq(e)) return this.curve.point(null, null);
  39018. if (0 === this.x.cmp(e.x)) return this.curve.point(null, null);
  39019. var t = this.y.redSub(e.y);
  39020. 0 !== t.cmpn(0) && (t = t.redMul(this.x.redSub(e.x).redInvm()));
  39021. var i = t.redSqr().redISub(this.x).redISub(e.x),
  39022. r = t.redMul(this.x.redSub(i)).redISub(this.y);
  39023. return this.curve.point(i, r)
  39024. }, l.prototype.dbl = function() {
  39025. if (this.inf) return this;
  39026. var e = this.y.redAdd(this.y);
  39027. if (0 === e.cmpn(0)) return this.curve.point(null, null);
  39028. var t = this.curve.a,
  39029. i = this.x.redSqr(),
  39030. r = e.redInvm(),
  39031. n = i.redAdd(i).redIAdd(i).redIAdd(t).redMul(r),
  39032. a = n.redSqr().redISub(this.x.redAdd(this.x)),
  39033. s = n.redMul(this.x.redSub(a)).redISub(this.y);
  39034. return this.curve.point(a, s)
  39035. }, l.prototype.getX = function() {
  39036. return this.x.fromRed()
  39037. }, l.prototype.getY = function() {
  39038. return this.y.fromRed()
  39039. }, l.prototype.mul = function(e) {
  39040. return e = new n(e, 16), this.isInfinity() ? this : this._hasDoubles(e) ? this.curve._fixedNafMul(this,
  39041. e) : this.curve.endo ? this.curve._endoWnafMulAdd([this], [e]) : this.curve._wnafMul(this, e)
  39042. }, l.prototype.mulAdd = function(e, t, i) {
  39043. var r = [this, t],
  39044. n = [e, i];
  39045. return this.curve.endo ? this.curve._endoWnafMulAdd(r, n) : this.curve._wnafMulAdd(1, r, n, 2)
  39046. }, l.prototype.jmulAdd = function(e, t, i) {
  39047. var r = [this, t],
  39048. n = [e, i];
  39049. return this.curve.endo ? this.curve._endoWnafMulAdd(r, n, !0) : this.curve._wnafMulAdd(1, r, n, 2, !0)
  39050. }, l.prototype.eq = function(e) {
  39051. return this === e || this.inf === e.inf && (this.inf || 0 === this.x.cmp(e.x) && 0 === this.y.cmp(e.y))
  39052. }, l.prototype.neg = function(e) {
  39053. if (this.inf) return this;
  39054. var t = this.curve.point(this.x, this.y.redNeg());
  39055. if (e && this.precomputed) {
  39056. var i = this.precomputed,
  39057. r = function(e) {
  39058. return e.neg()
  39059. };
  39060. t.precomputed = {
  39061. naf: i.naf && {
  39062. wnd: i.naf.wnd,
  39063. points: i.naf.points.map(r)
  39064. },
  39065. doubles: i.doubles && {
  39066. step: i.doubles.step,
  39067. points: i.doubles.points.map(r)
  39068. }
  39069. }
  39070. }
  39071. return t
  39072. }, l.prototype.toJ = function() {
  39073. return this.inf ? this.curve.jpoint(null, null, null) : this.curve.jpoint(this.x, this.y, this.curve
  39074. .one)
  39075. }, a(d, s.BasePoint), u.prototype.jpoint = function(e, t, i) {
  39076. return new d(this, e, t, i)
  39077. }, d.prototype.toP = function() {
  39078. if (this.isInfinity()) return this.curve.point(null, null);
  39079. var e = this.z.redInvm(),
  39080. t = e.redSqr(),
  39081. i = this.x.redMul(t),
  39082. r = this.y.redMul(t).redMul(e);
  39083. return this.curve.point(i, r)
  39084. }, d.prototype.neg = function() {
  39085. return this.curve.jpoint(this.x, this.y.redNeg(), this.z)
  39086. }, d.prototype.add = function(e) {
  39087. if (this.isInfinity()) return e;
  39088. if (e.isInfinity()) return this;
  39089. var t = e.z.redSqr(),
  39090. i = this.z.redSqr(),
  39091. r = this.x.redMul(t),
  39092. n = e.x.redMul(i),
  39093. a = this.y.redMul(t.redMul(e.z)),
  39094. s = e.y.redMul(i.redMul(this.z)),
  39095. o = r.redSub(n),
  39096. u = a.redSub(s);
  39097. if (0 === o.cmpn(0)) return 0 !== u.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl();
  39098. var l = o.redSqr(),
  39099. d = l.redMul(o),
  39100. c = r.redMul(l),
  39101. h = u.redSqr().redIAdd(d).redISub(c).redISub(c),
  39102. f = u.redMul(c.redISub(h)).redISub(a.redMul(d)),
  39103. p = this.z.redMul(e.z).redMul(o);
  39104. return this.curve.jpoint(h, f, p)
  39105. }, d.prototype.mixedAdd = function(e) {
  39106. if (this.isInfinity()) return e.toJ();
  39107. if (e.isInfinity()) return this;
  39108. var t = this.z.redSqr(),
  39109. i = this.x,
  39110. r = e.x.redMul(t),
  39111. n = this.y,
  39112. a = e.y.redMul(t).redMul(this.z),
  39113. s = i.redSub(r),
  39114. o = n.redSub(a);
  39115. if (0 === s.cmpn(0)) return 0 !== o.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl();
  39116. var u = s.redSqr(),
  39117. l = u.redMul(s),
  39118. d = i.redMul(u),
  39119. c = o.redSqr().redIAdd(l).redISub(d).redISub(d),
  39120. h = o.redMul(d.redISub(c)).redISub(n.redMul(l)),
  39121. f = this.z.redMul(s);
  39122. return this.curve.jpoint(c, h, f)
  39123. }, d.prototype.dblp = function(e) {
  39124. if (0 === e) return this;
  39125. if (this.isInfinity()) return this;
  39126. if (!e) return this.dbl();
  39127. var t;
  39128. if (this.curve.zeroA || this.curve.threeA) {
  39129. var i = this;
  39130. for (t = 0; t < e; t++) i = i.dbl();
  39131. return i
  39132. }
  39133. var r = this.curve.a,
  39134. n = this.curve.tinv,
  39135. a = this.x,
  39136. s = this.y,
  39137. o = this.z,
  39138. u = o.redSqr().redSqr(),
  39139. l = s.redAdd(s);
  39140. for (t = 0; t < e; t++) {
  39141. var d = a.redSqr(),
  39142. c = l.redSqr(),
  39143. h = c.redSqr(),
  39144. f = d.redAdd(d).redIAdd(d).redIAdd(r.redMul(u)),
  39145. p = a.redMul(c),
  39146. m = f.redSqr().redISub(p.redAdd(p)),
  39147. g = p.redISub(m),
  39148. v = f.redMul(g);
  39149. v = v.redIAdd(v).redISub(h);
  39150. var y = l.redMul(o);
  39151. t + 1 < e && (u = u.redMul(h)), a = m, o = y, l = v
  39152. }
  39153. return this.curve.jpoint(a, l.redMul(n), o)
  39154. }, d.prototype.dbl = function() {
  39155. return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this
  39156. ._threeDbl() : this._dbl()
  39157. }, d.prototype._zeroDbl = function() {
  39158. var e, t, i;
  39159. if (this.zOne) {
  39160. var r = this.x.redSqr(),
  39161. n = this.y.redSqr(),
  39162. a = n.redSqr(),
  39163. s = this.x.redAdd(n).redSqr().redISub(r).redISub(a);
  39164. s = s.redIAdd(s);
  39165. var o = r.redAdd(r).redIAdd(r),
  39166. u = o.redSqr().redISub(s).redISub(s),
  39167. l = a.redIAdd(a);
  39168. l = (l = l.redIAdd(l)).redIAdd(l), e = u, t = o.redMul(s.redISub(u)).redISub(l), i = this.y.redAdd(
  39169. this.y)
  39170. } else {
  39171. var d = this.x.redSqr(),
  39172. c = this.y.redSqr(),
  39173. h = c.redSqr(),
  39174. f = this.x.redAdd(c).redSqr().redISub(d).redISub(h);
  39175. f = f.redIAdd(f);
  39176. var p = d.redAdd(d).redIAdd(d),
  39177. m = p.redSqr(),
  39178. g = h.redIAdd(h);
  39179. g = (g = g.redIAdd(g)).redIAdd(g), e = m.redISub(f).redISub(f), t = p.redMul(f.redISub(e)).redISub(g),
  39180. i = (i = this.y.redMul(this.z)).redIAdd(i)
  39181. }
  39182. return this.curve.jpoint(e, t, i)
  39183. }, d.prototype._threeDbl = function() {
  39184. var e, t, i;
  39185. if (this.zOne) {
  39186. var r = this.x.redSqr(),
  39187. n = this.y.redSqr(),
  39188. a = n.redSqr(),
  39189. s = this.x.redAdd(n).redSqr().redISub(r).redISub(a);
  39190. s = s.redIAdd(s);
  39191. var o = r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),
  39192. u = o.redSqr().redISub(s).redISub(s);
  39193. e = u;
  39194. var l = a.redIAdd(a);
  39195. l = (l = l.redIAdd(l)).redIAdd(l), t = o.redMul(s.redISub(u)).redISub(l), i = this.y.redAdd(this.y)
  39196. } else {
  39197. var d = this.z.redSqr(),
  39198. c = this.y.redSqr(),
  39199. h = this.x.redMul(c),
  39200. f = this.x.redSub(d).redMul(this.x.redAdd(d));
  39201. f = f.redAdd(f).redIAdd(f);
  39202. var p = h.redIAdd(h),
  39203. m = (p = p.redIAdd(p)).redAdd(p);
  39204. e = f.redSqr().redISub(m), i = this.y.redAdd(this.z).redSqr().redISub(c).redISub(d);
  39205. var g = c.redSqr();
  39206. g = (g = (g = g.redIAdd(g)).redIAdd(g)).redIAdd(g), t = f.redMul(p.redISub(e)).redISub(g)
  39207. }
  39208. return this.curve.jpoint(e, t, i)
  39209. }, d.prototype._dbl = function() {
  39210. var e = this.curve.a,
  39211. t = this.x,
  39212. i = this.y,
  39213. r = this.z,
  39214. n = r.redSqr().redSqr(),
  39215. a = t.redSqr(),
  39216. s = i.redSqr(),
  39217. o = a.redAdd(a).redIAdd(a).redIAdd(e.redMul(n)),
  39218. u = t.redAdd(t),
  39219. l = (u = u.redIAdd(u)).redMul(s),
  39220. d = o.redSqr().redISub(l.redAdd(l)),
  39221. c = l.redISub(d),
  39222. h = s.redSqr();
  39223. h = (h = (h = h.redIAdd(h)).redIAdd(h)).redIAdd(h);
  39224. var f = o.redMul(c).redISub(h),
  39225. p = i.redAdd(i).redMul(r);
  39226. return this.curve.jpoint(d, f, p)
  39227. }, d.prototype.trpl = function() {
  39228. if (!this.curve.zeroA) return this.dbl().add(this);
  39229. var e = this.x.redSqr(),
  39230. t = this.y.redSqr(),
  39231. i = this.z.redSqr(),
  39232. r = t.redSqr(),
  39233. n = e.redAdd(e).redIAdd(e),
  39234. a = n.redSqr(),
  39235. s = this.x.redAdd(t).redSqr().redISub(e).redISub(r),
  39236. o = (s = (s = (s = s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(a)).redSqr(),
  39237. u = r.redIAdd(r);
  39238. u = (u = (u = u.redIAdd(u)).redIAdd(u)).redIAdd(u);
  39239. var l = n.redIAdd(s).redSqr().redISub(a).redISub(o).redISub(u),
  39240. d = t.redMul(l);
  39241. d = (d = d.redIAdd(d)).redIAdd(d);
  39242. var c = this.x.redMul(o).redISub(d);
  39243. c = (c = c.redIAdd(c)).redIAdd(c);
  39244. var h = this.y.redMul(l.redMul(u.redISub(l)).redISub(s.redMul(o)));
  39245. h = (h = (h = h.redIAdd(h)).redIAdd(h)).redIAdd(h);
  39246. var f = this.z.redAdd(s).redSqr().redISub(i).redISub(o);
  39247. return this.curve.jpoint(c, h, f)
  39248. }, d.prototype.mul = function(e, t) {
  39249. return e = new n(e, t), this.curve._wnafMul(this, e)
  39250. }, d.prototype.eq = function(e) {
  39251. if ("affine" === e.type) return this.eq(e.toJ());
  39252. if (this === e) return !0;
  39253. var t = this.z.redSqr(),
  39254. i = e.z.redSqr();
  39255. if (0 !== this.x.redMul(i).redISub(e.x.redMul(t)).cmpn(0)) return !1;
  39256. var r = t.redMul(this.z),
  39257. n = i.redMul(e.z);
  39258. return 0 === this.y.redMul(n).redISub(e.y.redMul(r)).cmpn(0)
  39259. }, d.prototype.eqXToP = function(e) {
  39260. var t = this.z.redSqr(),
  39261. i = e.toRed(this.curve.red).redMul(t);
  39262. if (0 === this.x.cmp(i)) return !0;
  39263. for (var r = e.clone(), n = this.curve.redN.redMul(t);;) {
  39264. if (r.iadd(this.curve.n), r.cmp(this.curve.p) >= 0) return !1;
  39265. if (i.redIAdd(n), 0 === this.x.cmp(i)) return !0
  39266. }
  39267. }, d.prototype.inspect = function() {
  39268. return this.isInfinity() ? "<EC JPoint Infinity>" : "<EC JPoint x: " + this.x.toString(16, 2) + " y: " +
  39269. this.y.toString(16, 2) + " z: " + this.z.toString(16, 2) + ">"
  39270. }, d.prototype.isInfinity = function() {
  39271. return 0 === this.z.cmpn(0)
  39272. }
  39273. }, function(e, t, i) {
  39274. "use strict";
  39275. var r = i(11),
  39276. n = i(5),
  39277. a = i(41),
  39278. s = i(15);
  39279. function o(e) {
  39280. a.call(this, "mont", e), this.a = new r(e.a, 16).toRed(this.red), this.b = new r(e.b, 16).toRed(this.red),
  39281. this.i4 = new r(4).toRed(this.red).redInvm(), this.two = new r(2).toRed(this.red), this.a24 = this.i4
  39282. .redMul(this.a.redAdd(this.two))
  39283. }
  39284. function u(e, t, i) {
  39285. a.BasePoint.call(this, e, "projective"), null === t && null === i ? (this.x = this.curve.one, this.z =
  39286. this.curve.zero) : (this.x = new r(t, 16), this.z = new r(i, 16), this.x.red || (this.x = this.x
  39287. .toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)))
  39288. }
  39289. n(o, a), e.exports = o, o.prototype.validate = function(e) {
  39290. var t = e.normalize().x,
  39291. i = t.redSqr(),
  39292. r = i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t);
  39293. return 0 === r.redSqrt().redSqr().cmp(r)
  39294. }, n(u, a.BasePoint), o.prototype.decodePoint = function(e, t) {
  39295. return this.point(s.toArray(e, t), 1)
  39296. }, o.prototype.point = function(e, t) {
  39297. return new u(this, e, t)
  39298. }, o.prototype.pointFromJSON = function(e) {
  39299. return u.fromJSON(this, e)
  39300. }, u.prototype.precompute = function() {}, u.prototype._encode = function() {
  39301. return this.getX().toArray("be", this.curve.p.byteLength())
  39302. }, u.fromJSON = function(e, t) {
  39303. return new u(e, t[0], t[1] || e.one)
  39304. }, u.prototype.inspect = function() {
  39305. return this.isInfinity() ? "<EC Point Infinity>" : "<EC Point x: " + this.x.fromRed().toString(16, 2) +
  39306. " z: " + this.z.fromRed().toString(16, 2) + ">"
  39307. }, u.prototype.isInfinity = function() {
  39308. return 0 === this.z.cmpn(0)
  39309. }, u.prototype.dbl = function() {
  39310. var e = this.x.redAdd(this.z).redSqr(),
  39311. t = this.x.redSub(this.z).redSqr(),
  39312. i = e.redSub(t),
  39313. r = e.redMul(t),
  39314. n = i.redMul(t.redAdd(this.curve.a24.redMul(i)));
  39315. return this.curve.point(r, n)
  39316. }, u.prototype.add = function() {
  39317. throw new Error("Not supported on Montgomery curve")
  39318. }, u.prototype.diffAdd = function(e, t) {
  39319. var i = this.x.redAdd(this.z),
  39320. r = this.x.redSub(this.z),
  39321. n = e.x.redAdd(e.z),
  39322. a = e.x.redSub(e.z).redMul(i),
  39323. s = n.redMul(r),
  39324. o = t.z.redMul(a.redAdd(s).redSqr()),
  39325. u = t.x.redMul(a.redISub(s).redSqr());
  39326. return this.curve.point(o, u)
  39327. }, u.prototype.mul = function(e) {
  39328. for (var t = e.clone(), i = this, r = this.curve.point(null, null), n = []; 0 !== t.cmpn(0); t.iushrn(
  39329. 1)) n.push(t.andln(1));
  39330. for (var a = n.length - 1; a >= 0; a--) 0 === n[a] ? (i = i.diffAdd(r, this), r = r.dbl()) : (r = i
  39331. .diffAdd(r, this), i = i.dbl());
  39332. return r
  39333. }, u.prototype.mulAdd = function() {
  39334. throw new Error("Not supported on Montgomery curve")
  39335. }, u.prototype.jumlAdd = function() {
  39336. throw new Error("Not supported on Montgomery curve")
  39337. }, u.prototype.eq = function(e) {
  39338. return 0 === this.getX().cmp(e.getX())
  39339. }, u.prototype.normalize = function() {
  39340. return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this
  39341. }, u.prototype.getX = function() {
  39342. return this.normalize(), this.x.fromRed()
  39343. }
  39344. }, function(e, t, i) {
  39345. "use strict";
  39346. var r = i(15),
  39347. n = i(11),
  39348. a = i(5),
  39349. s = i(41),
  39350. o = r.assert;
  39351. function u(e) {
  39352. this.twisted = 1 != (0 | e.a), this.mOneA = this.twisted && -1 == (0 | e.a), this.extended = this.mOneA, s
  39353. .call(this, "edwards", e), this.a = new n(e.a, 16).umod(this.red.m), this.a = this.a.toRed(this.red),
  39354. this.c = new n(e.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), this.d = new n(e.d, 16).toRed(this
  39355. .red), this.dd = this.d.redAdd(this.d), o(!this.twisted || 0 === this.c.fromRed().cmpn(1)), this
  39356. .oneC = 1 == (0 | e.c)
  39357. }
  39358. function l(e, t, i, r, a) {
  39359. s.BasePoint.call(this, e, "projective"), null === t && null === i && null === r ? (this.x = this.curve
  39360. .zero, this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (
  39361. this.x = new n(t, 16), this.y = new n(i, 16), this.z = r ? new n(r, 16) : this.curve.one, this.t =
  39362. a && new n(a, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this
  39363. .y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t
  39364. .red && (this.t = this.t.toRed(this.curve.red)), this.zOne = this.z === this.curve.one, this.curve
  39365. .extended && !this.t && (this.t = this.x.redMul(this.y), this.zOne || (this.t = this.t.redMul(this.z
  39366. .redInvm()))))
  39367. }
  39368. a(u, s), e.exports = u, u.prototype._mulA = function(e) {
  39369. return this.mOneA ? e.redNeg() : this.a.redMul(e)
  39370. }, u.prototype._mulC = function(e) {
  39371. return this.oneC ? e : this.c.redMul(e)
  39372. }, u.prototype.jpoint = function(e, t, i, r) {
  39373. return this.point(e, t, i, r)
  39374. }, u.prototype.pointFromX = function(e, t) {
  39375. (e = new n(e, 16)).red || (e = e.toRed(this.red));
  39376. var i = e.redSqr(),
  39377. r = this.c2.redSub(this.a.redMul(i)),
  39378. a = this.one.redSub(this.c2.redMul(this.d).redMul(i)),
  39379. s = r.redMul(a.redInvm()),
  39380. o = s.redSqrt();
  39381. if (0 !== o.redSqr().redSub(s).cmp(this.zero)) throw new Error("invalid point");
  39382. var u = o.fromRed().isOdd();
  39383. return (t && !u || !t && u) && (o = o.redNeg()), this.point(e, o)
  39384. }, u.prototype.pointFromY = function(e, t) {
  39385. (e = new n(e, 16)).red || (e = e.toRed(this.red));
  39386. var i = e.redSqr(),
  39387. r = i.redSub(this.c2),
  39388. a = i.redMul(this.d).redMul(this.c2).redSub(this.a),
  39389. s = r.redMul(a.redInvm());
  39390. if (0 === s.cmp(this.zero)) {
  39391. if (t) throw new Error("invalid point");
  39392. return this.point(this.zero, e)
  39393. }
  39394. var o = s.redSqrt();
  39395. if (0 !== o.redSqr().redSub(s).cmp(this.zero)) throw new Error("invalid point");
  39396. return o.fromRed().isOdd() !== t && (o = o.redNeg()), this.point(o, e)
  39397. }, u.prototype.validate = function(e) {
  39398. if (e.isInfinity()) return !0;
  39399. e.normalize();
  39400. var t = e.x.redSqr(),
  39401. i = e.y.redSqr(),
  39402. r = t.redMul(this.a).redAdd(i),
  39403. n = this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(i)));
  39404. return 0 === r.cmp(n)
  39405. }, a(l, s.BasePoint), u.prototype.pointFromJSON = function(e) {
  39406. return l.fromJSON(this, e)
  39407. }, u.prototype.point = function(e, t, i, r) {
  39408. return new l(this, e, t, i, r)
  39409. }, l.fromJSON = function(e, t) {
  39410. return new l(e, t[0], t[1], t[2])
  39411. }, l.prototype.inspect = function() {
  39412. return this.isInfinity() ? "<EC Point Infinity>" : "<EC Point x: " + this.x.fromRed().toString(16, 2) +
  39413. " y: " + this.y.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">"
  39414. }, l.prototype.isInfinity = function() {
  39415. return 0 === this.x.cmpn(0) && (0 === this.y.cmp(this.z) || this.zOne && 0 === this.y.cmp(this.curve.c))
  39416. }, l.prototype._extDbl = function() {
  39417. var e = this.x.redSqr(),
  39418. t = this.y.redSqr(),
  39419. i = this.z.redSqr();
  39420. i = i.redIAdd(i);
  39421. var r = this.curve._mulA(e),
  39422. n = this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),
  39423. a = r.redAdd(t),
  39424. s = a.redSub(i),
  39425. o = r.redSub(t),
  39426. u = n.redMul(s),
  39427. l = a.redMul(o),
  39428. d = n.redMul(o),
  39429. c = s.redMul(a);
  39430. return this.curve.point(u, l, c, d)
  39431. }, l.prototype._projDbl = function() {
  39432. var e, t, i, r, n, a, s = this.x.redAdd(this.y).redSqr(),
  39433. o = this.x.redSqr(),
  39434. u = this.y.redSqr();
  39435. if (this.curve.twisted) {
  39436. var l = (r = this.curve._mulA(o)).redAdd(u);
  39437. this.zOne ? (e = s.redSub(o).redSub(u).redMul(l.redSub(this.curve.two)), t = l.redMul(r.redSub(u)),
  39438. i = l.redSqr().redSub(l).redSub(l)) : (n = this.z.redSqr(), a = l.redSub(n).redISub(n), e = s
  39439. .redSub(o).redISub(u).redMul(a), t = l.redMul(r.redSub(u)), i = l.redMul(a))
  39440. } else r = o.redAdd(u), n = this.curve._mulC(this.z).redSqr(), a = r.redSub(n).redSub(n), e = this.curve
  39441. ._mulC(s.redISub(r)).redMul(a), t = this.curve._mulC(r).redMul(o.redISub(u)), i = r.redMul(a);
  39442. return this.curve.point(e, t, i)
  39443. }, l.prototype.dbl = function() {
  39444. return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl()
  39445. }, l.prototype._extAdd = function(e) {
  39446. var t = this.y.redSub(this.x).redMul(e.y.redSub(e.x)),
  39447. i = this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),
  39448. r = this.t.redMul(this.curve.dd).redMul(e.t),
  39449. n = this.z.redMul(e.z.redAdd(e.z)),
  39450. a = i.redSub(t),
  39451. s = n.redSub(r),
  39452. o = n.redAdd(r),
  39453. u = i.redAdd(t),
  39454. l = a.redMul(s),
  39455. d = o.redMul(u),
  39456. c = a.redMul(u),
  39457. h = s.redMul(o);
  39458. return this.curve.point(l, d, h, c)
  39459. }, l.prototype._projAdd = function(e) {
  39460. var t, i, r = this.z.redMul(e.z),
  39461. n = r.redSqr(),
  39462. a = this.x.redMul(e.x),
  39463. s = this.y.redMul(e.y),
  39464. o = this.curve.d.redMul(a).redMul(s),
  39465. u = n.redSub(o),
  39466. l = n.redAdd(o),
  39467. d = this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(a).redISub(s),
  39468. c = r.redMul(u).redMul(d);
  39469. return this.curve.twisted ? (t = r.redMul(l).redMul(s.redSub(this.curve._mulA(a))), i = u.redMul(l)) : (
  39470. t = r.redMul(l).redMul(s.redSub(a)), i = this.curve._mulC(u).redMul(l)), this.curve.point(c, t, i)
  39471. }, l.prototype.add = function(e) {
  39472. return this.isInfinity() ? e : e.isInfinity() ? this : this.curve.extended ? this._extAdd(e) : this
  39473. ._projAdd(e)
  39474. }, l.prototype.mul = function(e) {
  39475. return this._hasDoubles(e) ? this.curve._fixedNafMul(this, e) : this.curve._wnafMul(this, e)
  39476. }, l.prototype.mulAdd = function(e, t, i) {
  39477. return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, !1)
  39478. }, l.prototype.jmulAdd = function(e, t, i) {
  39479. return this.curve._wnafMulAdd(1, [this, t], [e, i], 2, !0)
  39480. }, l.prototype.normalize = function() {
  39481. if (this.zOne) return this;
  39482. var e = this.z.redInvm();
  39483. return this.x = this.x.redMul(e), this.y = this.y.redMul(e), this.t && (this.t = this.t.redMul(e)), this
  39484. .z = this.curve.one, this.zOne = !0, this
  39485. }, l.prototype.neg = function() {
  39486. return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg())
  39487. }, l.prototype.getX = function() {
  39488. return this.normalize(), this.x.fromRed()
  39489. }, l.prototype.getY = function() {
  39490. return this.normalize(), this.y.fromRed()
  39491. }, l.prototype.eq = function(e) {
  39492. return this === e || 0 === this.getX().cmp(e.getX()) && 0 === this.getY().cmp(e.getY())
  39493. }, l.prototype.eqXToP = function(e) {
  39494. var t = e.toRed(this.curve.red).redMul(this.z);
  39495. if (0 === this.x.cmp(t)) return !0;
  39496. for (var i = e.clone(), r = this.curve.redN.redMul(this.z);;) {
  39497. if (i.iadd(this.curve.n), i.cmp(this.curve.p) >= 0) return !1;
  39498. if (t.redIAdd(r), 0 === this.x.cmp(t)) return !0
  39499. }
  39500. }, l.prototype.toP = l.prototype.normalize, l.prototype.mixedAdd = l.prototype.add
  39501. }, function(e, t, i) {
  39502. "use strict";
  39503. t.sha1 = i(199), t.sha224 = i(200), t.sha256 = i(111), t.sha384 = i(201), t.sha512 = i(112)
  39504. }, function(e, t, i) {
  39505. "use strict";
  39506. var r = i(18),
  39507. n = i(34),
  39508. a = i(110),
  39509. s = r.rotl32,
  39510. o = r.sum32,
  39511. u = r.sum32_5,
  39512. l = a.ft_1,
  39513. d = n.BlockHash,
  39514. c = [1518500249, 1859775393, 2400959708, 3395469782];
  39515. function h() {
  39516. if (!(this instanceof h)) return new h;
  39517. d.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.W = new Array(80)
  39518. }
  39519. r.inherits(h, d), e.exports = h, h.blockSize = 512, h.outSize = 160, h.hmacStrength = 80, h.padLength = 64,
  39520. h.prototype._update = function(e, t) {
  39521. for (var i = this.W, r = 0; r < 16; r++) i[r] = e[t + r];
  39522. for (; r < i.length; r++) i[r] = s(i[r - 3] ^ i[r - 8] ^ i[r - 14] ^ i[r - 16], 1);
  39523. var n = this.h[0],
  39524. a = this.h[1],
  39525. d = this.h[2],
  39526. h = this.h[3],
  39527. f = this.h[4];
  39528. for (r = 0; r < i.length; r++) {
  39529. var p = ~~(r / 20),
  39530. m = u(s(n, 5), l(p, a, d, h), f, i[r], c[p]);
  39531. f = h, h = d, d = s(a, 30), a = n, n = m
  39532. }
  39533. this.h[0] = o(this.h[0], n), this.h[1] = o(this.h[1], a), this.h[2] = o(this.h[2], d), this.h[3] = o(
  39534. this.h[3], h), this.h[4] = o(this.h[4], f)
  39535. }, h.prototype._digest = function(e) {
  39536. return "hex" === e ? r.toHex32(this.h, "big") : r.split32(this.h, "big")
  39537. }
  39538. }, function(e, t, i) {
  39539. "use strict";
  39540. var r = i(18),
  39541. n = i(111);
  39542. function a() {
  39543. if (!(this instanceof a)) return new a;
  39544. n.call(this), this.h = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839,
  39545. 3204075428
  39546. ]
  39547. }
  39548. r.inherits(a, n), e.exports = a, a.blockSize = 512, a.outSize = 224, a.hmacStrength = 192, a.padLength = 64,
  39549. a.prototype._digest = function(e) {
  39550. return "hex" === e ? r.toHex32(this.h.slice(0, 7), "big") : r.split32(this.h.slice(0, 7), "big")
  39551. }
  39552. }, function(e, t, i) {
  39553. "use strict";
  39554. var r = i(18),
  39555. n = i(112);
  39556. function a() {
  39557. if (!(this instanceof a)) return new a;
  39558. n.call(this), this.h = [3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, 355462360,
  39559. 4144912697, 1731405415, 4290775857, 2394180231, 1750603025, 3675008525, 1694076839, 1203062813,
  39560. 3204075428
  39561. ]
  39562. }
  39563. r.inherits(a, n), e.exports = a, a.blockSize = 1024, a.outSize = 384, a.hmacStrength = 192, a.padLength =
  39564. 128, a.prototype._digest = function(e) {
  39565. return "hex" === e ? r.toHex32(this.h.slice(0, 12), "big") : r.split32(this.h.slice(0, 12), "big")
  39566. }
  39567. }, function(e, t, i) {
  39568. "use strict";
  39569. var r = i(18),
  39570. n = i(34),
  39571. a = r.rotl32,
  39572. s = r.sum32,
  39573. o = r.sum32_3,
  39574. u = r.sum32_4,
  39575. l = n.BlockHash;
  39576. function d() {
  39577. if (!(this instanceof d)) return new d;
  39578. l.call(this), this.h = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.endian = "little"
  39579. }
  39580. function c(e, t, i, r) {
  39581. return e <= 15 ? t ^ i ^ r : e <= 31 ? t & i | ~t & r : e <= 47 ? (t | ~i) ^ r : e <= 63 ? t & r | i & ~
  39582. r : t ^ (i | ~r)
  39583. }
  39584. function h(e) {
  39585. return e <= 15 ? 0 : e <= 31 ? 1518500249 : e <= 47 ? 1859775393 : e <= 63 ? 2400959708 : 2840853838
  39586. }
  39587. function f(e) {
  39588. return e <= 15 ? 1352829926 : e <= 31 ? 1548603684 : e <= 47 ? 1836072691 : e <= 63 ? 2053994217 : 0
  39589. }
  39590. r.inherits(d, l), t.ripemd160 = d, d.blockSize = 512, d.outSize = 160, d.hmacStrength = 192, d.padLength =
  39591. 64, d.prototype._update = function(e, t) {
  39592. for (var i = this.h[0], r = this.h[1], n = this.h[2], l = this.h[3], d = this.h[4], y = i, _ = r, b = n,
  39593. w = l, E = d, T = 0; T < 80; T++) {
  39594. var S = s(a(u(i, c(T, r, n, l), e[p[T] + t], h(T)), g[T]), d);
  39595. i = d, d = l, l = a(n, 10), n = r, r = S, S = s(a(u(y, c(79 - T, _, b, w), e[m[T] + t], f(T)), v[T]),
  39596. E), y = E, E = w, w = a(b, 10), b = _, _ = S
  39597. }
  39598. S = o(this.h[1], n, w), this.h[1] = o(this.h[2], l, E), this.h[2] = o(this.h[3], d, y), this.h[3] = o(
  39599. this.h[4], i, _), this.h[4] = o(this.h[0], r, b), this.h[0] = S
  39600. }, d.prototype._digest = function(e) {
  39601. return "hex" === e ? r.toHex32(this.h, "little") : r.split32(this.h, "little")
  39602. };
  39603. var p = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2,
  39604. 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7,
  39605. 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  39606. ],
  39607. m = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9,
  39608. 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9,
  39609. 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  39610. ],
  39611. g = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11,
  39612. 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14,
  39613. 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  39614. ],
  39615. v = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6,
  39616. 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9,
  39617. 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  39618. ]
  39619. }, function(e, t, i) {
  39620. "use strict";
  39621. var r = i(18),
  39622. n = i(14);
  39623. function a(e, t, i) {
  39624. if (!(this instanceof a)) return new a(e, t, i);
  39625. this.Hash = e, this.blockSize = e.blockSize / 8, this.outSize = e.outSize / 8, this.inner = null, this
  39626. .outer = null, this._init(r.toArray(t, i))
  39627. }
  39628. e.exports = a, a.prototype._init = function(e) {
  39629. e.length > this.blockSize && (e = (new this.Hash).update(e).digest()), n(e.length <= this.blockSize);
  39630. for (var t = e.length; t < this.blockSize; t++) e.push(0);
  39631. for (t = 0; t < e.length; t++) e[t] ^= 54;
  39632. for (this.inner = (new this.Hash).update(e), t = 0; t < e.length; t++) e[t] ^= 106;
  39633. this.outer = (new this.Hash).update(e)
  39634. }, a.prototype.update = function(e, t) {
  39635. return this.inner.update(e, t), this
  39636. }, a.prototype.digest = function(e) {
  39637. return this.outer.update(this.inner.digest()), this.outer.digest(e)
  39638. }
  39639. }, function(e, t) {
  39640. e.exports = {
  39641. doubles: {
  39642. step: 4,
  39643. points: [
  39644. ["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a",
  39645. "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"
  39646. ],
  39647. ["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508",
  39648. "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"
  39649. ],
  39650. ["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739",
  39651. "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"
  39652. ],
  39653. ["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640",
  39654. "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"
  39655. ],
  39656. ["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c",
  39657. "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"
  39658. ],
  39659. ["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda",
  39660. "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"
  39661. ],
  39662. ["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa",
  39663. "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"
  39664. ],
  39665. ["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0",
  39666. "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"
  39667. ],
  39668. ["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d",
  39669. "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"
  39670. ],
  39671. ["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d",
  39672. "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"
  39673. ],
  39674. ["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1",
  39675. "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"
  39676. ],
  39677. ["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0",
  39678. "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"
  39679. ],
  39680. ["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047",
  39681. "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"
  39682. ],
  39683. ["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862",
  39684. "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"
  39685. ],
  39686. ["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7",
  39687. "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"
  39688. ],
  39689. ["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd",
  39690. "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"
  39691. ],
  39692. ["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83",
  39693. "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"
  39694. ],
  39695. ["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a",
  39696. "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"
  39697. ],
  39698. ["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8",
  39699. "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"
  39700. ],
  39701. ["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d",
  39702. "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"
  39703. ],
  39704. ["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725",
  39705. "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"
  39706. ],
  39707. ["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754",
  39708. "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"
  39709. ],
  39710. ["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c",
  39711. "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"
  39712. ],
  39713. ["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6",
  39714. "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"
  39715. ],
  39716. ["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39",
  39717. "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"
  39718. ],
  39719. ["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891",
  39720. "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"
  39721. ],
  39722. ["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b",
  39723. "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"
  39724. ],
  39725. ["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03",
  39726. "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"
  39727. ],
  39728. ["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d",
  39729. "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"
  39730. ],
  39731. ["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070",
  39732. "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"
  39733. ],
  39734. ["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4",
  39735. "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"
  39736. ],
  39737. ["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da",
  39738. "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"
  39739. ],
  39740. ["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11",
  39741. "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"
  39742. ],
  39743. ["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e",
  39744. "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"
  39745. ],
  39746. ["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41",
  39747. "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"
  39748. ],
  39749. ["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef",
  39750. "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"
  39751. ],
  39752. ["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8",
  39753. "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"
  39754. ],
  39755. ["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d",
  39756. "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"
  39757. ],
  39758. ["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96",
  39759. "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"
  39760. ],
  39761. ["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd",
  39762. "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"
  39763. ],
  39764. ["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5",
  39765. "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"
  39766. ],
  39767. ["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266",
  39768. "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"
  39769. ],
  39770. ["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71",
  39771. "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"
  39772. ],
  39773. ["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac",
  39774. "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"
  39775. ],
  39776. ["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751",
  39777. "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"
  39778. ],
  39779. ["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e",
  39780. "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"
  39781. ],
  39782. ["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241",
  39783. "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"
  39784. ],
  39785. ["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3",
  39786. "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"
  39787. ],
  39788. ["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f",
  39789. "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"
  39790. ],
  39791. ["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19",
  39792. "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"
  39793. ],
  39794. ["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be",
  39795. "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"
  39796. ],
  39797. ["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9",
  39798. "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"
  39799. ],
  39800. ["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2",
  39801. "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"
  39802. ],
  39803. ["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13",
  39804. "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"
  39805. ],
  39806. ["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c",
  39807. "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"
  39808. ],
  39809. ["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba",
  39810. "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"
  39811. ],
  39812. ["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151",
  39813. "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"
  39814. ],
  39815. ["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073",
  39816. "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"
  39817. ],
  39818. ["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458",
  39819. "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"
  39820. ],
  39821. ["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b",
  39822. "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"
  39823. ],
  39824. ["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366",
  39825. "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"
  39826. ],
  39827. ["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa",
  39828. "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"
  39829. ],
  39830. ["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0",
  39831. "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"
  39832. ],
  39833. ["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787",
  39834. "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"
  39835. ],
  39836. ["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e",
  39837. "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"
  39838. ]
  39839. ]
  39840. },
  39841. naf: {
  39842. wnd: 7,
  39843. points: [
  39844. ["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9",
  39845. "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"
  39846. ],
  39847. ["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4",
  39848. "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"
  39849. ],
  39850. ["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc",
  39851. "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"
  39852. ],
  39853. ["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe",
  39854. "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"
  39855. ],
  39856. ["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb",
  39857. "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"
  39858. ],
  39859. ["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8",
  39860. "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"
  39861. ],
  39862. ["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e",
  39863. "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"
  39864. ],
  39865. ["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34",
  39866. "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"
  39867. ],
  39868. ["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c",
  39869. "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"
  39870. ],
  39871. ["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5",
  39872. "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"
  39873. ],
  39874. ["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f",
  39875. "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"
  39876. ],
  39877. ["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714",
  39878. "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"
  39879. ],
  39880. ["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729",
  39881. "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"
  39882. ],
  39883. ["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db",
  39884. "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"
  39885. ],
  39886. ["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4",
  39887. "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"
  39888. ],
  39889. ["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5",
  39890. "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"
  39891. ],
  39892. ["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479",
  39893. "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"
  39894. ],
  39895. ["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d",
  39896. "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"
  39897. ],
  39898. ["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f",
  39899. "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"
  39900. ],
  39901. ["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb",
  39902. "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"
  39903. ],
  39904. ["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9",
  39905. "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"
  39906. ],
  39907. ["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963",
  39908. "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"
  39909. ],
  39910. ["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74",
  39911. "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"
  39912. ],
  39913. ["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530",
  39914. "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"
  39915. ],
  39916. ["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b",
  39917. "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"
  39918. ],
  39919. ["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247",
  39920. "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"
  39921. ],
  39922. ["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1",
  39923. "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"
  39924. ],
  39925. ["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120",
  39926. "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"
  39927. ],
  39928. ["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435",
  39929. "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"
  39930. ],
  39931. ["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18",
  39932. "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"
  39933. ],
  39934. ["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8",
  39935. "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"
  39936. ],
  39937. ["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb",
  39938. "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"
  39939. ],
  39940. ["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f",
  39941. "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"
  39942. ],
  39943. ["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143",
  39944. "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"
  39945. ],
  39946. ["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba",
  39947. "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"
  39948. ],
  39949. ["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45",
  39950. "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"
  39951. ],
  39952. ["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a",
  39953. "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"
  39954. ],
  39955. ["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e",
  39956. "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"
  39957. ],
  39958. ["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8",
  39959. "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"
  39960. ],
  39961. ["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c",
  39962. "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"
  39963. ],
  39964. ["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519",
  39965. "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"
  39966. ],
  39967. ["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab",
  39968. "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"
  39969. ],
  39970. ["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca",
  39971. "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"
  39972. ],
  39973. ["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf",
  39974. "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"
  39975. ],
  39976. ["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610",
  39977. "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"
  39978. ],
  39979. ["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4",
  39980. "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"
  39981. ],
  39982. ["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c",
  39983. "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"
  39984. ],
  39985. ["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940",
  39986. "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"
  39987. ],
  39988. ["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980",
  39989. "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"
  39990. ],
  39991. ["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3",
  39992. "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"
  39993. ],
  39994. ["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf",
  39995. "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"
  39996. ],
  39997. ["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63",
  39998. "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"
  39999. ],
  40000. ["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448",
  40001. "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"
  40002. ],
  40003. ["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf",
  40004. "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"
  40005. ],
  40006. ["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5",
  40007. "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"
  40008. ],
  40009. ["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6",
  40010. "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"
  40011. ],
  40012. ["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5",
  40013. "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"
  40014. ],
  40015. ["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99",
  40016. "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"
  40017. ],
  40018. ["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51",
  40019. "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"
  40020. ],
  40021. ["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5",
  40022. "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"
  40023. ],
  40024. ["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5",
  40025. "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"
  40026. ],
  40027. ["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997",
  40028. "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"
  40029. ],
  40030. ["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881",
  40031. "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"
  40032. ],
  40033. ["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5",
  40034. "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"
  40035. ],
  40036. ["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66",
  40037. "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"
  40038. ],
  40039. ["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726",
  40040. "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"
  40041. ],
  40042. ["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede",
  40043. "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"
  40044. ],
  40045. ["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94",
  40046. "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"
  40047. ],
  40048. ["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31",
  40049. "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"
  40050. ],
  40051. ["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51",
  40052. "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"
  40053. ],
  40054. ["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252",
  40055. "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"
  40056. ],
  40057. ["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5",
  40058. "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"
  40059. ],
  40060. ["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b",
  40061. "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"
  40062. ],
  40063. ["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4",
  40064. "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"
  40065. ],
  40066. ["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f",
  40067. "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"
  40068. ],
  40069. ["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889",
  40070. "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"
  40071. ],
  40072. ["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246",
  40073. "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"
  40074. ],
  40075. ["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984",
  40076. "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"
  40077. ],
  40078. ["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a",
  40079. "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"
  40080. ],
  40081. ["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030",
  40082. "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"
  40083. ],
  40084. ["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197",
  40085. "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"
  40086. ],
  40087. ["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593",
  40088. "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"
  40089. ],
  40090. ["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef",
  40091. "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"
  40092. ],
  40093. ["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38",
  40094. "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"
  40095. ],
  40096. ["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a",
  40097. "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"
  40098. ],
  40099. ["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111",
  40100. "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"
  40101. ],
  40102. ["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502",
  40103. "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"
  40104. ],
  40105. ["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea",
  40106. "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"
  40107. ],
  40108. ["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26",
  40109. "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"
  40110. ],
  40111. ["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986",
  40112. "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"
  40113. ],
  40114. ["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e",
  40115. "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"
  40116. ],
  40117. ["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4",
  40118. "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"
  40119. ],
  40120. ["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda",
  40121. "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"
  40122. ],
  40123. ["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859",
  40124. "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"
  40125. ],
  40126. ["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f",
  40127. "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"
  40128. ],
  40129. ["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c",
  40130. "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"
  40131. ],
  40132. ["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942",
  40133. "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"
  40134. ],
  40135. ["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a",
  40136. "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"
  40137. ],
  40138. ["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80",
  40139. "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"
  40140. ],
  40141. ["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d",
  40142. "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"
  40143. ],
  40144. ["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1",
  40145. "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"
  40146. ],
  40147. ["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63",
  40148. "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"
  40149. ],
  40150. ["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352",
  40151. "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"
  40152. ],
  40153. ["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193",
  40154. "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"
  40155. ],
  40156. ["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00",
  40157. "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"
  40158. ],
  40159. ["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58",
  40160. "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"
  40161. ],
  40162. ["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7",
  40163. "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"
  40164. ],
  40165. ["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8",
  40166. "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"
  40167. ],
  40168. ["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e",
  40169. "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"
  40170. ],
  40171. ["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d",
  40172. "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"
  40173. ],
  40174. ["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b",
  40175. "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"
  40176. ],
  40177. ["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f",
  40178. "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"
  40179. ],
  40180. ["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6",
  40181. "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"
  40182. ],
  40183. ["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297",
  40184. "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"
  40185. ],
  40186. ["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a",
  40187. "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"
  40188. ],
  40189. ["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c",
  40190. "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"
  40191. ],
  40192. ["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52",
  40193. "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"
  40194. ],
  40195. ["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb",
  40196. "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"
  40197. ],
  40198. ["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065",
  40199. "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"
  40200. ],
  40201. ["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917",
  40202. "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"
  40203. ],
  40204. ["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9",
  40205. "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"
  40206. ],
  40207. ["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3",
  40208. "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"
  40209. ],
  40210. ["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57",
  40211. "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"
  40212. ],
  40213. ["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66",
  40214. "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"
  40215. ],
  40216. ["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8",
  40217. "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"
  40218. ],
  40219. ["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721",
  40220. "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"
  40221. ],
  40222. ["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180",
  40223. "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"
  40224. ]
  40225. ]
  40226. }
  40227. }
  40228. }, function(e, t, i) {
  40229. "use strict";
  40230. var r = i(11),
  40231. n = i(206),
  40232. a = i(15),
  40233. s = i(60),
  40234. o = i(56),
  40235. u = a.assert,
  40236. l = i(207),
  40237. d = i(208);
  40238. function c(e) {
  40239. if (!(this instanceof c)) return new c(e);
  40240. "string" == typeof e && (u(Object.prototype.hasOwnProperty.call(s, e), "Unknown curve " + e), e = s[e]),
  40241. e instanceof s.PresetCurve && (e = {
  40242. curve: e
  40243. }), this.curve = e.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), this.g = this.curve.g,
  40244. this.g = e.curve.g, this.g.precompute(e.curve.n.bitLength() + 1), this.hash = e.hash || e.curve.hash
  40245. }
  40246. e.exports = c, c.prototype.keyPair = function(e) {
  40247. return new l(this, e)
  40248. }, c.prototype.keyFromPrivate = function(e, t) {
  40249. return l.fromPrivate(this, e, t)
  40250. }, c.prototype.keyFromPublic = function(e, t) {
  40251. return l.fromPublic(this, e, t)
  40252. }, c.prototype.genKeyPair = function(e) {
  40253. e || (e = {});
  40254. for (var t = new n({
  40255. hash: this.hash,
  40256. pers: e.pers,
  40257. persEnc: e.persEnc || "utf8",
  40258. entropy: e.entropy || o(this.hash.hmacStrength),
  40259. entropyEnc: e.entropy && e.entropyEnc || "utf8",
  40260. nonce: this.n.toArray()
  40261. }), i = this.n.byteLength(), a = this.n.sub(new r(2));;) {
  40262. var s = new r(t.generate(i));
  40263. if (!(s.cmp(a) > 0)) return s.iaddn(1), this.keyFromPrivate(s)
  40264. }
  40265. }, c.prototype._truncateToN = function(e, t) {
  40266. var i = 8 * e.byteLength() - this.n.bitLength();
  40267. return i > 0 && (e = e.ushrn(i)), !t && e.cmp(this.n) >= 0 ? e.sub(this.n) : e
  40268. }, c.prototype.sign = function(e, t, i, a) {
  40269. "object" == typeof i && (a = i, i = null), a || (a = {}), t = this.keyFromPrivate(t, i), e = this
  40270. ._truncateToN(new r(e, 16));
  40271. for (var s = this.n.byteLength(), o = t.getPrivate().toArray("be", s), u = e.toArray("be", s), l =
  40272. new n({
  40273. hash: this.hash,
  40274. entropy: o,
  40275. nonce: u,
  40276. pers: a.pers,
  40277. persEnc: a.persEnc || "utf8"
  40278. }), c = this.n.sub(new r(1)), h = 0;; h++) {
  40279. var f = a.k ? a.k(h) : new r(l.generate(this.n.byteLength()));
  40280. if (!((f = this._truncateToN(f, !0)).cmpn(1) <= 0 || f.cmp(c) >= 0)) {
  40281. var p = this.g.mul(f);
  40282. if (!p.isInfinity()) {
  40283. var m = p.getX(),
  40284. g = m.umod(this.n);
  40285. if (0 !== g.cmpn(0)) {
  40286. var v = f.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));
  40287. if (0 !== (v = v.umod(this.n)).cmpn(0)) {
  40288. var y = (p.getY().isOdd() ? 1 : 0) | (0 !== m.cmp(g) ? 2 : 0);
  40289. return a.canonical && v.cmp(this.nh) > 0 && (v = this.n.sub(v), y ^= 1), new d({
  40290. r: g,
  40291. s: v,
  40292. recoveryParam: y
  40293. })
  40294. }
  40295. }
  40296. }
  40297. }
  40298. }
  40299. }, c.prototype.verify = function(e, t, i, n) {
  40300. e = this._truncateToN(new r(e, 16)), i = this.keyFromPublic(i, n);
  40301. var a = (t = new d(t, "hex")).r,
  40302. s = t.s;
  40303. if (a.cmpn(1) < 0 || a.cmp(this.n) >= 0) return !1;
  40304. if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return !1;
  40305. var o, u = s.invm(this.n),
  40306. l = u.mul(e).umod(this.n),
  40307. c = u.mul(a).umod(this.n);
  40308. return this.curve._maxwellTrick ? !(o = this.g.jmulAdd(l, i.getPublic(), c)).isInfinity() && o.eqXToP(
  40309. a) : !(o = this.g.mulAdd(l, i.getPublic(), c)).isInfinity() && 0 === o.getX().umod(this.n).cmp(a)
  40310. }, c.prototype.recoverPubKey = function(e, t, i, n) {
  40311. u((3 & i) === i, "The recovery param is more than two bits"), t = new d(t, n);
  40312. var a = this.n,
  40313. s = new r(e),
  40314. o = t.r,
  40315. l = t.s,
  40316. c = 1 & i,
  40317. h = i >> 1;
  40318. if (o.cmp(this.curve.p.umod(this.curve.n)) >= 0 && h) throw new Error(
  40319. "Unable to find sencond key candinate");
  40320. o = h ? this.curve.pointFromX(o.add(this.curve.n), c) : this.curve.pointFromX(o, c);
  40321. var f = t.r.invm(a),
  40322. p = a.sub(s).mul(f).umod(a),
  40323. m = l.mul(f).umod(a);
  40324. return this.g.mulAdd(p, o, m)
  40325. }, c.prototype.getKeyRecoveryParam = function(e, t, i, r) {
  40326. if (null !== (t = new d(t, r)).recoveryParam) return t.recoveryParam;
  40327. for (var n = 0; n < 4; n++) {
  40328. var a;
  40329. try {
  40330. a = this.recoverPubKey(e, t, n)
  40331. } catch (e) {
  40332. continue
  40333. }
  40334. if (a.eq(i)) return n
  40335. }
  40336. throw new Error("Unable to find valid recovery factor")
  40337. }
  40338. }, function(e, t, i) {
  40339. "use strict";
  40340. var r = i(61),
  40341. n = i(108),
  40342. a = i(14);
  40343. function s(e) {
  40344. if (!(this instanceof s)) return new s(e);
  40345. this.hash = e.hash, this.predResist = !!e.predResist, this.outLen = this.hash.outSize, this.minEntropy = e
  40346. .minEntropy || this.hash.hmacStrength, this._reseed = null, this.reseedInterval = null, this.K = null,
  40347. this.V = null;
  40348. var t = n.toArray(e.entropy, e.entropyEnc || "hex"),
  40349. i = n.toArray(e.nonce, e.nonceEnc || "hex"),
  40350. r = n.toArray(e.pers, e.persEnc || "hex");
  40351. a(t.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), this
  40352. ._init(t, i, r)
  40353. }
  40354. e.exports = s, s.prototype._init = function(e, t, i) {
  40355. var r = e.concat(t).concat(i);
  40356. this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8);
  40357. for (var n = 0; n < this.V.length; n++) this.K[n] = 0, this.V[n] = 1;
  40358. this._update(r), this._reseed = 1, this.reseedInterval = 281474976710656
  40359. }, s.prototype._hmac = function() {
  40360. return new r.hmac(this.hash, this.K)
  40361. }, s.prototype._update = function(e) {
  40362. var t = this._hmac().update(this.V).update([0]);
  40363. e && (t = t.update(e)), this.K = t.digest(), this.V = this._hmac().update(this.V).digest(), e && (this
  40364. .K = this._hmac().update(this.V).update([1]).update(e).digest(), this.V = this._hmac().update(this
  40365. .V).digest())
  40366. }, s.prototype.reseed = function(e, t, i, r) {
  40367. "string" != typeof t && (r = i, i = t, t = null), e = n.toArray(e, t), i = n.toArray(i, r), a(e
  40368. .length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"),
  40369. this._update(e.concat(i || [])), this._reseed = 1
  40370. }, s.prototype.generate = function(e, t, i, r) {
  40371. if (this._reseed > this.reseedInterval) throw new Error("Reseed is required");
  40372. "string" != typeof t && (r = i, i = t, t = null), i && (i = n.toArray(i, r || "hex"), this._update(i));
  40373. for (var a = []; a.length < e;) this.V = this._hmac().update(this.V).digest(), a = a.concat(this.V);
  40374. var s = a.slice(0, e);
  40375. return this._update(i), this._reseed++, n.encode(s, t)
  40376. }
  40377. }, function(e, t, i) {
  40378. "use strict";
  40379. var r = i(11),
  40380. n = i(15).assert;
  40381. function a(e, t) {
  40382. this.ec = e, this.priv = null, this.pub = null, t.priv && this._importPrivate(t.priv, t.privEnc), t.pub &&
  40383. this._importPublic(t.pub, t.pubEnc)
  40384. }
  40385. e.exports = a, a.fromPublic = function(e, t, i) {
  40386. return t instanceof a ? t : new a(e, {
  40387. pub: t,
  40388. pubEnc: i
  40389. })
  40390. }, a.fromPrivate = function(e, t, i) {
  40391. return t instanceof a ? t : new a(e, {
  40392. priv: t,
  40393. privEnc: i
  40394. })
  40395. }, a.prototype.validate = function() {
  40396. var e = this.getPublic();
  40397. return e.isInfinity() ? {
  40398. result: !1,
  40399. reason: "Invalid public key"
  40400. } : e.validate() ? e.mul(this.ec.curve.n).isInfinity() ? {
  40401. result: !0,
  40402. reason: null
  40403. } : {
  40404. result: !1,
  40405. reason: "Public key * N != O"
  40406. } : {
  40407. result: !1,
  40408. reason: "Public key is not a point"
  40409. }
  40410. }, a.prototype.getPublic = function(e, t) {
  40411. return "string" == typeof e && (t = e, e = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), t ?
  40412. this.pub.encode(t, e) : this.pub
  40413. }, a.prototype.getPrivate = function(e) {
  40414. return "hex" === e ? this.priv.toString(16, 2) : this.priv
  40415. }, a.prototype._importPrivate = function(e, t) {
  40416. this.priv = new r(e, t || 16), this.priv = this.priv.umod(this.ec.curve.n)
  40417. }, a.prototype._importPublic = function(e, t) {
  40418. if (e.x || e.y) return "mont" === this.ec.curve.type ? n(e.x, "Need x coordinate") : "short" !== this.ec
  40419. .curve.type && "edwards" !== this.ec.curve.type || n(e.x && e.y, "Need both x and y coordinate"),
  40420. void(this.pub = this.ec.curve.point(e.x, e.y));
  40421. this.pub = this.ec.curve.decodePoint(e, t)
  40422. }, a.prototype.derive = function(e) {
  40423. return e.validate() || n(e.validate(), "public point not validated"), e.mul(this.priv).getX()
  40424. }, a.prototype.sign = function(e, t, i) {
  40425. return this.ec.sign(e, this, t, i)
  40426. }, a.prototype.verify = function(e, t) {
  40427. return this.ec.verify(e, t, this)
  40428. }, a.prototype.inspect = function() {
  40429. return "<Key priv: " + (this.priv && this.priv.toString(16, 2)) + " pub: " + (this.pub && this.pub
  40430. .inspect()) + " >"
  40431. }
  40432. }, function(e, t, i) {
  40433. "use strict";
  40434. var r = i(11),
  40435. n = i(15),
  40436. a = n.assert;
  40437. function s(e, t) {
  40438. if (e instanceof s) return e;
  40439. this._importDER(e, t) || (a(e.r && e.s, "Signature without r or s"), this.r = new r(e.r, 16), this.s =
  40440. new r(e.s, 16), void 0 === e.recoveryParam ? this.recoveryParam = null : this.recoveryParam = e
  40441. .recoveryParam)
  40442. }
  40443. function o(e, t) {
  40444. var i = e[t.place++];
  40445. if (!(128 & i)) return i;
  40446. var r = 15 & i;
  40447. if (0 === r || r > 4) return !1;
  40448. for (var n = 0, a = 0, s = t.place; a < r; a++, s++) n <<= 8, n |= e[s], n >>>= 0;
  40449. return !(n <= 127) && (t.place = s, n)
  40450. }
  40451. function u(e) {
  40452. for (var t = 0, i = e.length - 1; !e[t] && !(128 & e[t + 1]) && t < i;) t++;
  40453. return 0 === t ? e : e.slice(t)
  40454. }
  40455. function l(e, t) {
  40456. if (t < 128) e.push(t);
  40457. else {
  40458. var i = 1 + (Math.log(t) / Math.LN2 >>> 3);
  40459. for (e.push(128 | i); --i;) e.push(t >>> (i << 3) & 255);
  40460. e.push(t)
  40461. }
  40462. }
  40463. e.exports = s, s.prototype._importDER = function(e, t) {
  40464. e = n.toArray(e, t);
  40465. var i = new function() {
  40466. this.place = 0
  40467. };
  40468. if (48 !== e[i.place++]) return !1;
  40469. var a = o(e, i);
  40470. if (!1 === a) return !1;
  40471. if (a + i.place !== e.length) return !1;
  40472. if (2 !== e[i.place++]) return !1;
  40473. var s = o(e, i);
  40474. if (!1 === s) return !1;
  40475. var u = e.slice(i.place, s + i.place);
  40476. if (i.place += s, 2 !== e[i.place++]) return !1;
  40477. var l = o(e, i);
  40478. if (!1 === l) return !1;
  40479. if (e.length !== l + i.place) return !1;
  40480. var d = e.slice(i.place, l + i.place);
  40481. if (0 === u[0]) {
  40482. if (!(128 & u[1])) return !1;
  40483. u = u.slice(1)
  40484. }
  40485. if (0 === d[0]) {
  40486. if (!(128 & d[1])) return !1;
  40487. d = d.slice(1)
  40488. }
  40489. return this.r = new r(u), this.s = new r(d), this.recoveryParam = null, !0
  40490. }, s.prototype.toDER = function(e) {
  40491. var t = this.r.toArray(),
  40492. i = this.s.toArray();
  40493. for (128 & t[0] && (t = [0].concat(t)), 128 & i[0] && (i = [0].concat(i)), t = u(t), i = u(i); !(i[0] ||
  40494. 128 & i[1]);) i = i.slice(1);
  40495. var r = [2];
  40496. l(r, t.length), (r = r.concat(t)).push(2), l(r, i.length);
  40497. var a = r.concat(i),
  40498. s = [48];
  40499. return l(s, a.length), s = s.concat(a), n.encode(s, e)
  40500. }
  40501. }, function(e, t, i) {
  40502. "use strict";
  40503. var r = i(61),
  40504. n = i(60),
  40505. a = i(15),
  40506. s = a.assert,
  40507. o = a.parseBytes,
  40508. u = i(210),
  40509. l = i(211);
  40510. function d(e) {
  40511. if (s("ed25519" === e, "only tested with ed25519 so far"), !(this instanceof d)) return new d(e);
  40512. e = n[e].curve, this.curve = e, this.g = e.g, this.g.precompute(e.n.bitLength() + 1), this.pointClass = e
  40513. .point().constructor, this.encodingLength = Math.ceil(e.n.bitLength() / 8), this.hash = r.sha512
  40514. }
  40515. e.exports = d, d.prototype.sign = function(e, t) {
  40516. e = o(e);
  40517. var i = this.keyFromSecret(t),
  40518. r = this.hashInt(i.messagePrefix(), e),
  40519. n = this.g.mul(r),
  40520. a = this.encodePoint(n),
  40521. s = this.hashInt(a, i.pubBytes(), e).mul(i.priv()),
  40522. u = r.add(s).umod(this.curve.n);
  40523. return this.makeSignature({
  40524. R: n,
  40525. S: u,
  40526. Rencoded: a
  40527. })
  40528. }, d.prototype.verify = function(e, t, i) {
  40529. e = o(e), t = this.makeSignature(t);
  40530. var r = this.keyFromPublic(i),
  40531. n = this.hashInt(t.Rencoded(), r.pubBytes(), e),
  40532. a = this.g.mul(t.S());
  40533. return t.R().add(r.pub().mul(n)).eq(a)
  40534. }, d.prototype.hashInt = function() {
  40535. for (var e = this.hash(), t = 0; t < arguments.length; t++) e.update(arguments[t]);
  40536. return a.intFromLE(e.digest()).umod(this.curve.n)
  40537. }, d.prototype.keyFromPublic = function(e) {
  40538. return u.fromPublic(this, e)
  40539. }, d.prototype.keyFromSecret = function(e) {
  40540. return u.fromSecret(this, e)
  40541. }, d.prototype.makeSignature = function(e) {
  40542. return e instanceof l ? e : new l(this, e)
  40543. }, d.prototype.encodePoint = function(e) {
  40544. var t = e.getY().toArray("le", this.encodingLength);
  40545. return t[this.encodingLength - 1] |= e.getX().isOdd() ? 128 : 0, t
  40546. }, d.prototype.decodePoint = function(e) {
  40547. var t = (e = a.parseBytes(e)).length - 1,
  40548. i = e.slice(0, t).concat(-129 & e[t]),
  40549. r = 0 != (128 & e[t]),
  40550. n = a.intFromLE(i);
  40551. return this.curve.pointFromY(n, r)
  40552. }, d.prototype.encodeInt = function(e) {
  40553. return e.toArray("le", this.encodingLength)
  40554. }, d.prototype.decodeInt = function(e) {
  40555. return a.intFromLE(e)
  40556. }, d.prototype.isPoint = function(e) {
  40557. return e instanceof this.pointClass
  40558. }
  40559. }, function(e, t, i) {
  40560. "use strict";
  40561. var r = i(15),
  40562. n = r.assert,
  40563. a = r.parseBytes,
  40564. s = r.cachedProperty;
  40565. function o(e, t) {
  40566. this.eddsa = e, this._secret = a(t.secret), e.isPoint(t.pub) ? this._pub = t.pub : this._pubBytes = a(t
  40567. .pub)
  40568. }
  40569. o.fromPublic = function(e, t) {
  40570. return t instanceof o ? t : new o(e, {
  40571. pub: t
  40572. })
  40573. }, o.fromSecret = function(e, t) {
  40574. return t instanceof o ? t : new o(e, {
  40575. secret: t
  40576. })
  40577. }, o.prototype.secret = function() {
  40578. return this._secret
  40579. }, s(o, "pubBytes", function() {
  40580. return this.eddsa.encodePoint(this.pub())
  40581. }), s(o, "pub", function() {
  40582. return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv())
  40583. }), s(o, "privBytes", function() {
  40584. var e = this.eddsa,
  40585. t = this.hash(),
  40586. i = e.encodingLength - 1,
  40587. r = t.slice(0, e.encodingLength);
  40588. return r[0] &= 248, r[i] &= 127, r[i] |= 64, r
  40589. }), s(o, "priv", function() {
  40590. return this.eddsa.decodeInt(this.privBytes())
  40591. }), s(o, "hash", function() {
  40592. return this.eddsa.hash().update(this.secret()).digest()
  40593. }), s(o, "messagePrefix", function() {
  40594. return this.hash().slice(this.eddsa.encodingLength)
  40595. }), o.prototype.sign = function(e) {
  40596. return n(this._secret, "KeyPair can only verify"), this.eddsa.sign(e, this)
  40597. }, o.prototype.verify = function(e, t) {
  40598. return this.eddsa.verify(e, t, this)
  40599. }, o.prototype.getSecret = function(e) {
  40600. return n(this._secret, "KeyPair is public only"), r.encode(this.secret(), e)
  40601. }, o.prototype.getPublic = function(e) {
  40602. return r.encode(this.pubBytes(), e)
  40603. }, e.exports = o
  40604. }, function(e, t, i) {
  40605. "use strict";
  40606. var r = i(11),
  40607. n = i(15),
  40608. a = n.assert,
  40609. s = n.cachedProperty,
  40610. o = n.parseBytes;
  40611. function u(e, t) {
  40612. this.eddsa = e, "object" != typeof t && (t = o(t)), Array.isArray(t) && (t = {
  40613. R: t.slice(0, e.encodingLength),
  40614. S: t.slice(e.encodingLength)
  40615. }), a(t.R && t.S, "Signature without R or S"), e.isPoint(t.R) && (this._R = t.R), t.S instanceof r && (
  40616. this._S = t.S), this._Rencoded = Array.isArray(t.R) ? t.R : t.Rencoded, this._Sencoded = Array
  40617. .isArray(t.S) ? t.S : t.Sencoded
  40618. }
  40619. s(u, "S", function() {
  40620. return this.eddsa.decodeInt(this.Sencoded())
  40621. }), s(u, "R", function() {
  40622. return this.eddsa.decodePoint(this.Rencoded())
  40623. }), s(u, "Rencoded", function() {
  40624. return this.eddsa.encodePoint(this.R())
  40625. }), s(u, "Sencoded", function() {
  40626. return this.eddsa.encodeInt(this.S())
  40627. }), u.prototype.toBytes = function() {
  40628. return this.Rencoded().concat(this.Sencoded())
  40629. }, u.prototype.toHex = function() {
  40630. return n.encode(this.toBytes(), "hex").toUpperCase()
  40631. }, e.exports = u
  40632. }, function(e, t) {}, function(e, t, i) {
  40633. "use strict";
  40634. var r = i(114);
  40635. t.certificate = i(219);
  40636. var n = r.define("RSAPrivateKey", function() {
  40637. this.seq().obj(this.key("version").int(), this.key("modulus").int(), this.key("publicExponent").int(),
  40638. this.key("privateExponent").int(), this.key("prime1").int(), this.key("prime2").int(), this.key(
  40639. "exponent1").int(), this.key("exponent2").int(), this.key("coefficient").int())
  40640. });
  40641. t.RSAPrivateKey = n;
  40642. var a = r.define("RSAPublicKey", function() {
  40643. this.seq().obj(this.key("modulus").int(), this.key("publicExponent").int())
  40644. });
  40645. t.RSAPublicKey = a;
  40646. var s = r.define("SubjectPublicKeyInfo", function() {
  40647. this.seq().obj(this.key("algorithm").use(o), this.key("subjectPublicKey").bitstr())
  40648. });
  40649. t.PublicKey = s;
  40650. var o = r.define("AlgorithmIdentifier", function() {
  40651. this.seq().obj(this.key("algorithm").objid(), this.key("none").null_().optional(), this.key("curve")
  40652. .objid().optional(), this.key("params").seq().obj(this.key("p").int(), this.key("q").int(), this
  40653. .key("g").int()).optional())
  40654. }),
  40655. u = r.define("PrivateKeyInfo", function() {
  40656. this.seq().obj(this.key("version").int(), this.key("algorithm").use(o), this.key("subjectPrivateKey")
  40657. .octstr())
  40658. });
  40659. t.PrivateKey = u;
  40660. var l = r.define("EncryptedPrivateKeyInfo", function() {
  40661. this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(), this.key("decrypt").seq().obj(
  40662. this.key("kde").seq().obj(this.key("id").objid(), this.key("kdeparams").seq().obj(this.key(
  40663. "salt").octstr(), this.key("iters").int())), this.key("cipher").seq().obj(this.key("algo")
  40664. .objid(), this.key("iv").octstr()))), this.key("subjectPrivateKey").octstr())
  40665. });
  40666. t.EncryptedPrivateKey = l;
  40667. var d = r.define("DSAPrivateKey", function() {
  40668. this.seq().obj(this.key("version").int(), this.key("p").int(), this.key("q").int(), this.key("g")
  40669. .int(), this.key("pub_key").int(), this.key("priv_key").int())
  40670. });
  40671. t.DSAPrivateKey = d, t.DSAparam = r.define("DSAparam", function() {
  40672. this.int()
  40673. });
  40674. var c = r.define("ECPrivateKey", function() {
  40675. this.seq().obj(this.key("version").int(), this.key("privateKey").octstr(), this.key("parameters")
  40676. .optional().explicit(0).use(h), this.key("publicKey").optional().explicit(1).bitstr())
  40677. });
  40678. t.ECPrivateKey = c;
  40679. var h = r.define("ECParameters", function() {
  40680. this.choice({
  40681. namedCurve: this.objid()
  40682. })
  40683. });
  40684. t.signature = r.define("signature", function() {
  40685. this.seq().obj(this.key("r").int(), this.key("s").int())
  40686. })
  40687. }, function(e, t, i) {
  40688. "use strict";
  40689. var r = i(115),
  40690. n = i(117),
  40691. a = i(5);
  40692. function s(e, t) {
  40693. this.name = e, this.body = t, this.decoders = {}, this.encoders = {}
  40694. }
  40695. t.define = function(e, t) {
  40696. return new s(e, t)
  40697. }, s.prototype._createNamed = function(e) {
  40698. var t = this.name;
  40699. function i(e) {
  40700. this._initNamed(e, t)
  40701. }
  40702. return a(i, e), i.prototype._initNamed = function(t, i) {
  40703. e.call(this, t, i)
  40704. }, new i(this)
  40705. }, s.prototype._getDecoder = function(e) {
  40706. return e = e || "der", this.decoders.hasOwnProperty(e) || (this.decoders[e] = this._createNamed(n[e])),
  40707. this.decoders[e]
  40708. }, s.prototype.decode = function(e, t, i) {
  40709. return this._getDecoder(t).decode(e, i)
  40710. }, s.prototype._getEncoder = function(e) {
  40711. return e = e || "der", this.encoders.hasOwnProperty(e) || (this.encoders[e] = this._createNamed(r[e])),
  40712. this.encoders[e]
  40713. }, s.prototype.encode = function(e, t, i) {
  40714. return this._getEncoder(t).encode(e, i)
  40715. }
  40716. }, function(e, t, i) {
  40717. "use strict";
  40718. var r = i(5),
  40719. n = i(116);
  40720. function a(e) {
  40721. n.call(this, e), this.enc = "pem"
  40722. }
  40723. r(a, n), e.exports = a, a.prototype.encode = function(e, t) {
  40724. for (var i = n.prototype.encode.call(this, e).toString("base64"), r = ["-----BEGIN " + t.label +
  40725. "-----"], a = 0; a < i.length; a += 64) r.push(i.slice(a, a + 64));
  40726. return r.push("-----END " + t.label + "-----"), r.join("\n")
  40727. }
  40728. }, function(e, t, i) {
  40729. "use strict";
  40730. var r = i(5),
  40731. n = i(62).Buffer,
  40732. a = i(118);
  40733. function s(e) {
  40734. a.call(this, e), this.enc = "pem"
  40735. }
  40736. r(s, a), e.exports = s, s.prototype.decode = function(e, t) {
  40737. for (var i = e.toString().split(/[\r\n]+/g), r = t.label.toUpperCase(), s =
  40738. /^-----(BEGIN|END) ([^-]+)-----$/, o = -1, u = -1, l = 0; l < i.length; l++) {
  40739. var d = i[l].match(s);
  40740. if (null !== d && d[2] === r) {
  40741. if (-1 !== o) {
  40742. if ("END" !== d[1]) break;
  40743. u = l;
  40744. break
  40745. }
  40746. if ("BEGIN" !== d[1]) break;
  40747. o = l
  40748. }
  40749. }
  40750. if (-1 === o || -1 === u) throw new Error("PEM section not found for: " + r);
  40751. var c = i.slice(o + 1, u).join("");
  40752. c.replace(/[^a-z0-9+/=]+/gi, "");
  40753. var h = n.from(c, "base64");
  40754. return a.prototype.decode.call(this, h, t)
  40755. }
  40756. }, function(e, t, i) {
  40757. "use strict";
  40758. var r = t;
  40759. r.Reporter = i(64).Reporter, r.DecoderBuffer = i(35).DecoderBuffer, r.EncoderBuffer = i(35).EncoderBuffer, r
  40760. .Node = i(63)
  40761. }, function(e, t, i) {
  40762. "use strict";
  40763. var r = t;
  40764. r._reverse = function(e) {
  40765. var t = {};
  40766. return Object.keys(e).forEach(function(i) {
  40767. (0 | i) == i && (i |= 0);
  40768. var r = e[i];
  40769. t[r] = i
  40770. }), t
  40771. }, r.der = i(65)
  40772. }, function(e, t, i) {
  40773. "use strict";
  40774. var r = i(114),
  40775. n = r.define("Time", function() {
  40776. this.choice({
  40777. utcTime: this.utctime(),
  40778. generalTime: this.gentime()
  40779. })
  40780. }),
  40781. a = r.define("AttributeTypeValue", function() {
  40782. this.seq().obj(this.key("type").objid(), this.key("value").any())
  40783. }),
  40784. s = r.define("AlgorithmIdentifier", function() {
  40785. this.seq().obj(this.key("algorithm").objid(), this.key("parameters").optional(), this.key("curve")
  40786. .objid().optional())
  40787. }),
  40788. o = r.define("SubjectPublicKeyInfo", function() {
  40789. this.seq().obj(this.key("algorithm").use(s), this.key("subjectPublicKey").bitstr())
  40790. }),
  40791. u = r.define("RelativeDistinguishedName", function() {
  40792. this.setof(a)
  40793. }),
  40794. l = r.define("RDNSequence", function() {
  40795. this.seqof(u)
  40796. }),
  40797. d = r.define("Name", function() {
  40798. this.choice({
  40799. rdnSequence: this.use(l)
  40800. })
  40801. }),
  40802. c = r.define("Validity", function() {
  40803. this.seq().obj(this.key("notBefore").use(n), this.key("notAfter").use(n))
  40804. }),
  40805. h = r.define("Extension", function() {
  40806. this.seq().obj(this.key("extnID").objid(), this.key("critical").bool().def(!1), this.key("extnValue")
  40807. .octstr())
  40808. }),
  40809. f = r.define("TBSCertificate", function() {
  40810. this.seq().obj(this.key("version").explicit(0).int().optional(), this.key("serialNumber").int(), this
  40811. .key("signature").use(s), this.key("issuer").use(d), this.key("validity").use(c), this.key(
  40812. "subject").use(d), this.key("subjectPublicKeyInfo").use(o), this.key("issuerUniqueID").implicit(
  40813. 1).bitstr().optional(), this.key("subjectUniqueID").implicit(2).bitstr().optional(), this.key(
  40814. "extensions").explicit(3).seqof(h).optional())
  40815. }),
  40816. p = r.define("X509Certificate", function() {
  40817. this.seq().obj(this.key("tbsCertificate").use(f), this.key("signatureAlgorithm").use(s), this.key(
  40818. "signatureValue").bitstr())
  40819. });
  40820. e.exports = p
  40821. }, function(e) {
  40822. e.exports = JSON.parse(
  40823. '{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}'
  40824. )
  40825. }, function(e, t, i) {
  40826. var r =
  40827. /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,
  40828. n = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,
  40829. a = /^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,
  40830. s = i(40),
  40831. o = i(53),
  40832. u = i(6).Buffer;
  40833. e.exports = function(e, t) {
  40834. var i, l = e.toString(),
  40835. d = l.match(r);
  40836. if (d) {
  40837. var c = "aes" + d[1],
  40838. h = u.from(d[2], "hex"),
  40839. f = u.from(d[3].replace(/[\r\n]/g, ""), "base64"),
  40840. p = s(t, h.slice(0, 8), parseInt(d[1], 10)).key,
  40841. m = [],
  40842. g = o.createDecipheriv(c, p, h);
  40843. m.push(g.update(f)), m.push(g.final()), i = u.concat(m)
  40844. } else {
  40845. var v = l.match(a);
  40846. i = u.from(v[2].replace(/[\r\n]/g, ""), "base64")
  40847. }
  40848. return {
  40849. tag: l.match(n)[1],
  40850. data: i
  40851. }
  40852. }
  40853. }, function(e, t, i) {
  40854. var r = i(6).Buffer,
  40855. n = i(113),
  40856. a = i(59).ec,
  40857. s = i(42),
  40858. o = i(119);
  40859. function u(e, t) {
  40860. if (e.cmpn(0) <= 0) throw new Error("invalid sig");
  40861. if (e.cmp(t) >= t) throw new Error("invalid sig")
  40862. }
  40863. e.exports = function(e, t, i, l, d) {
  40864. var c = s(i);
  40865. if ("ec" === c.type) {
  40866. if ("ecdsa" !== l && "ecdsa/rsa" !== l) throw new Error("wrong public key type");
  40867. return function(e, t, i) {
  40868. var r = o[i.data.algorithm.curve.join(".")];
  40869. if (!r) throw new Error("unknown curve " + i.data.algorithm.curve.join("."));
  40870. var n = new a(r),
  40871. s = i.data.subjectPrivateKey.data;
  40872. return n.verify(t, e, s)
  40873. }(e, t, c)
  40874. }
  40875. if ("dsa" === c.type) {
  40876. if ("dsa" !== l) throw new Error("wrong public key type");
  40877. return function(e, t, i) {
  40878. var r = i.data.p,
  40879. a = i.data.q,
  40880. o = i.data.g,
  40881. l = i.data.pub_key,
  40882. d = s.signature.decode(e, "der"),
  40883. c = d.s,
  40884. h = d.r;
  40885. u(c, a), u(h, a);
  40886. var f = n.mont(r),
  40887. p = c.invm(a);
  40888. return 0 === o.toRed(f).redPow(new n(t).mul(p).mod(a)).fromRed().mul(l.toRed(f).redPow(h.mul(p)
  40889. .mod(a)).fromRed()).mod(r).mod(a).cmp(h)
  40890. }(e, t, c)
  40891. }
  40892. if ("rsa" !== l && "ecdsa/rsa" !== l) throw new Error("wrong public key type");
  40893. t = r.concat([d, t]);
  40894. for (var h = c.modulus.byteLength(), f = [1], p = 0; t.length + f.length + 2 < h;) f.push(255), p++;
  40895. f.push(0);
  40896. for (var m = -1; ++m < t.length;) f.push(t[m]);
  40897. f = r.from(f);
  40898. var g = n.mont(c.modulus);
  40899. e = (e = new n(e).toRed(g)).redPow(new n(c.publicExponent)), e = r.from(e.fromRed().toArray());
  40900. var v = p < 8 ? 1 : 0;
  40901. for (h = Math.min(e.length, f.length), e.length !== f.length && (v = 1), m = -1; ++m < h;) v |= e[m] ^
  40902. f[m];
  40903. return 0 === v
  40904. }
  40905. }, function(e, t, i) {
  40906. (function(t) {
  40907. var r = i(59),
  40908. n = i(11);
  40909. e.exports = function(e) {
  40910. return new s(e)
  40911. };
  40912. var a = {
  40913. secp256k1: {
  40914. name: "secp256k1",
  40915. byteLength: 32
  40916. },
  40917. secp224r1: {
  40918. name: "p224",
  40919. byteLength: 28
  40920. },
  40921. prime256v1: {
  40922. name: "p256",
  40923. byteLength: 32
  40924. },
  40925. prime192v1: {
  40926. name: "p192",
  40927. byteLength: 24
  40928. },
  40929. ed25519: {
  40930. name: "ed25519",
  40931. byteLength: 32
  40932. },
  40933. secp384r1: {
  40934. name: "p384",
  40935. byteLength: 48
  40936. },
  40937. secp521r1: {
  40938. name: "p521",
  40939. byteLength: 66
  40940. }
  40941. };
  40942. function s(e) {
  40943. this.curveType = a[e], this.curveType || (this.curveType = {
  40944. name: e
  40945. }), this.curve = new r.ec(this.curveType.name), this.keys = void 0
  40946. }
  40947. function o(e, i, r) {
  40948. Array.isArray(e) || (e = e.toArray());
  40949. var n = new t(e);
  40950. if (r && n.length < r) {
  40951. var a = new t(r - n.length);
  40952. a.fill(0), n = t.concat([a, n])
  40953. }
  40954. return i ? n.toString(i) : n
  40955. }
  40956. a.p224 = a.secp224r1, a.p256 = a.secp256r1 = a.prime256v1, a.p192 = a.secp192r1 = a.prime192v1, a.p384 =
  40957. a.secp384r1, a.p521 = a.secp521r1, s.prototype.generateKeys = function(e, t) {
  40958. return this.keys = this.curve.genKeyPair(), this.getPublicKey(e, t)
  40959. }, s.prototype.computeSecret = function(e, i, r) {
  40960. return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), o(this.curve.keyFromPublic(e)
  40961. .getPublic().mul(this.keys.getPrivate()).getX(), r, this.curveType.byteLength)
  40962. }, s.prototype.getPublicKey = function(e, t) {
  40963. var i = this.keys.getPublic("compressed" === t, !0);
  40964. return "hybrid" === t && (i[i.length - 1] % 2 ? i[0] = 7 : i[0] = 6), o(i, e)
  40965. }, s.prototype.getPrivateKey = function(e) {
  40966. return o(this.keys.getPrivate(), e)
  40967. }, s.prototype.setPublicKey = function(e, i) {
  40968. return i = i || "utf8", t.isBuffer(e) || (e = new t(e, i)), this.keys._importPublic(e), this
  40969. }, s.prototype.setPrivateKey = function(e, i) {
  40970. i = i || "utf8", t.isBuffer(e) || (e = new t(e, i));
  40971. var r = new n(e);
  40972. return r = r.toString(16), this.keys = this.curve.genKeyPair(), this.keys._importPrivate(r), this
  40973. }
  40974. }).call(this, i(10).Buffer)
  40975. }, function(e, t, i) {
  40976. t.publicEncrypt = i(225), t.privateDecrypt = i(226), t.privateEncrypt = function(e, i) {
  40977. return t.publicEncrypt(e, i, !0)
  40978. }, t.publicDecrypt = function(e, i) {
  40979. return t.privateDecrypt(e, i, !0)
  40980. }
  40981. }, function(e, t, i) {
  40982. var r = i(42),
  40983. n = i(24),
  40984. a = i(31),
  40985. s = i(120),
  40986. o = i(121),
  40987. u = i(11),
  40988. l = i(122),
  40989. d = i(58),
  40990. c = i(6).Buffer;
  40991. e.exports = function(e, t, i) {
  40992. var h;
  40993. h = e.padding ? e.padding : i ? 1 : 4;
  40994. var f, p = r(e);
  40995. if (4 === h) f = function(e, t) {
  40996. var i = e.modulus.byteLength(),
  40997. r = t.length,
  40998. l = a("sha1").update(c.alloc(0)).digest(),
  40999. d = l.length,
  41000. h = 2 * d;
  41001. if (r > i - h - 2) throw new Error("message too long");
  41002. var f = c.alloc(i - r - h - 2),
  41003. p = i - d - 1,
  41004. m = n(d),
  41005. g = o(c.concat([l, f, c.alloc(1, 1), t], p), s(m, p)),
  41006. v = o(m, s(g, d));
  41007. return new u(c.concat([c.alloc(1), v, g], i))
  41008. }(p, t);
  41009. else if (1 === h) f = function(e, t, i) {
  41010. var r, a = t.length,
  41011. s = e.modulus.byteLength();
  41012. if (a > s - 11) throw new Error("message too long");
  41013. return r = i ? c.alloc(s - a - 3, 255) : function(e) {
  41014. for (var t, i = c.allocUnsafe(e), r = 0, a = n(2 * e), s = 0; r < e;) s === a.length && (a = n(
  41015. 2 * e), s = 0), (t = a[s++]) && (i[r++] = t);
  41016. return i
  41017. }(s - a - 3), new u(c.concat([c.from([0, i ? 1 : 2]), r, c.alloc(1), t], s))
  41018. }(p, t, i);
  41019. else {
  41020. if (3 !== h) throw new Error("unknown padding");
  41021. if ((f = new u(t)).cmp(p.modulus) >= 0) throw new Error("data too long for modulus")
  41022. }
  41023. return i ? d(f, p) : l(f, p)
  41024. }
  41025. }, function(e, t, i) {
  41026. var r = i(42),
  41027. n = i(120),
  41028. a = i(121),
  41029. s = i(11),
  41030. o = i(58),
  41031. u = i(31),
  41032. l = i(122),
  41033. d = i(6).Buffer;
  41034. e.exports = function(e, t, i) {
  41035. var c;
  41036. c = e.padding ? e.padding : i ? 1 : 4;
  41037. var h, f = r(e),
  41038. p = f.modulus.byteLength();
  41039. if (t.length > p || new s(t).cmp(f.modulus) >= 0) throw new Error("decryption error");
  41040. h = i ? l(new s(t), f) : o(t, f);
  41041. var m = d.alloc(p - h.length);
  41042. if (h = d.concat([m, h], p), 4 === c) return function(e, t) {
  41043. var i = e.modulus.byteLength(),
  41044. r = u("sha1").update(d.alloc(0)).digest(),
  41045. s = r.length;
  41046. if (0 !== t[0]) throw new Error("decryption error");
  41047. var o = t.slice(1, s + 1),
  41048. l = t.slice(s + 1),
  41049. c = a(o, n(l, s)),
  41050. h = a(l, n(c, i - s - 1));
  41051. if (function(e, t) {
  41052. e = d.from(e), t = d.from(t);
  41053. var i = 0,
  41054. r = e.length;
  41055. e.length !== t.length && (i++, r = Math.min(e.length, t.length));
  41056. for (var n = -1; ++n < r;) i += e[n] ^ t[n];
  41057. return i
  41058. }(r, h.slice(0, s))) throw new Error("decryption error");
  41059. for (var f = s; 0 === h[f];) f++;
  41060. if (1 !== h[f++]) throw new Error("decryption error");
  41061. return h.slice(f)
  41062. }(f, h);
  41063. if (1 === c) return function(e, t, i) {
  41064. for (var r = t.slice(0, 2), n = 2, a = 0; 0 !== t[n++];)
  41065. if (n >= t.length) {
  41066. a++;
  41067. break
  41068. } var s = t.slice(2, n - 1);
  41069. if (("0002" !== r.toString("hex") && !i || "0001" !== r.toString("hex") && i) && a++, s.length <
  41070. 8 && a++, a) throw new Error("decryption error");
  41071. return t.slice(n)
  41072. }(0, h, i);
  41073. if (3 === c) return h;
  41074. throw new Error("unknown padding")
  41075. }
  41076. }, function(e, t, i) {
  41077. "use strict";
  41078. (function(e, r) {
  41079. function n() {
  41080. throw new Error(
  41081. "secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11"
  41082. )
  41083. }
  41084. var a = i(6),
  41085. s = i(24),
  41086. o = a.Buffer,
  41087. u = a.kMaxLength,
  41088. l = e.crypto || e.msCrypto,
  41089. d = Math.pow(2, 32) - 1;
  41090. function c(e, t) {
  41091. if ("number" != typeof e || e != e) throw new TypeError("offset must be a number");
  41092. if (e > d || e < 0) throw new TypeError("offset must be a uint32");
  41093. if (e > u || e > t) throw new RangeError("offset out of range")
  41094. }
  41095. function h(e, t, i) {
  41096. if ("number" != typeof e || e != e) throw new TypeError("size must be a number");
  41097. if (e > d || e < 0) throw new TypeError("size must be a uint32");
  41098. if (e + t > i || e > u) throw new RangeError("buffer too small")
  41099. }
  41100. function f(e, t, i, n) {
  41101. if (r.browser) {
  41102. var a = e.buffer,
  41103. o = new Uint8Array(a, t, i);
  41104. return l.getRandomValues(o), n ? void r.nextTick(function() {
  41105. n(null, e)
  41106. }) : e
  41107. }
  41108. if (!n) return s(i).copy(e, t), e;
  41109. s(i, function(i, r) {
  41110. if (i) return n(i);
  41111. r.copy(e, t), n(null, e)
  41112. })
  41113. }
  41114. l && l.getRandomValues || !r.browser ? (t.randomFill = function(t, i, r, n) {
  41115. if (!(o.isBuffer(t) || t instanceof e.Uint8Array)) throw new TypeError(
  41116. '"buf" argument must be a Buffer or Uint8Array');
  41117. if ("function" == typeof i) n = i, i = 0, r = t.length;
  41118. else if ("function" == typeof r) n = r, r = t.length - i;
  41119. else if ("function" != typeof n) throw new TypeError('"cb" argument must be a function');
  41120. return c(i, t.length), h(r, i, t.length), f(t, i, r, n)
  41121. }, t.randomFillSync = function(t, i, r) {
  41122. if (void 0 === i && (i = 0), !(o.isBuffer(t) || t instanceof e.Uint8Array)) throw new TypeError(
  41123. '"buf" argument must be a Buffer or Uint8Array');
  41124. return c(i, t.length), void 0 === r && (r = t.length - i), h(r, i, t.length), f(t, i, r)
  41125. }) : (t.randomFill = n, t.randomFillSync = n)
  41126. }).call(this, i(13), i(9))
  41127. }, function(e, t, i) {
  41128. "use strict";
  41129. i.r(t), i(0);
  41130. var r = i(19),
  41131. n = i(43),
  41132. a = i(36),
  41133. s = i(2);
  41134. t.default = function(e) {
  41135. var t = null,
  41136. i = function(t, i) {
  41137. e.postMessage({
  41138. msg: "logcat_callback",
  41139. data: {
  41140. type: t,
  41141. logcat: i
  41142. }
  41143. })
  41144. }.bind(this);
  41145. n.a.install(), e.addEventListener("message", function(n) {
  41146. switch (n.data.cmd) {
  41147. case "init":
  41148. (t = new a.a(n.data.param[0], n.data.param[1])).on(s.a.IO_ERROR, function(t, i) {
  41149. e.postMessage({
  41150. msg: s.a.IO_ERROR,
  41151. data: {
  41152. type: t,
  41153. info: i
  41154. }
  41155. })
  41156. }.bind(this)), t.on(s.a.DEMUX_ERROR, function(t, i) {
  41157. e.postMessage({
  41158. msg: s.a.DEMUX_ERROR,
  41159. data: {
  41160. type: t,
  41161. info: i
  41162. }
  41163. })
  41164. }.bind(this)), t.on(s.a.INIT_SEGMENT, function(t, i) {
  41165. var r = {
  41166. msg: s.a.INIT_SEGMENT,
  41167. data: {
  41168. type: t,
  41169. data: i
  41170. }
  41171. };
  41172. e.postMessage(r, [i.data])
  41173. }.bind(this)), t.on(s.a.MEDIA_SEGMENT, function(t, i) {
  41174. var r = {
  41175. msg: s.a.MEDIA_SEGMENT,
  41176. data: {
  41177. type: t,
  41178. data: i
  41179. }
  41180. };
  41181. e.postMessage(r, [i.data])
  41182. }.bind(this)), t.on(s.a.LOADING_COMPLETE, function() {
  41183. var t = {
  41184. msg: s.a.LOADING_COMPLETE
  41185. };
  41186. e.postMessage(t)
  41187. }.bind(this)), t.on(s.a.RECOVERED_EARLY_EOF, function() {
  41188. var t = {
  41189. msg: s.a.RECOVERED_EARLY_EOF
  41190. };
  41191. e.postMessage(t)
  41192. }.bind(this)), t.on(s.a.MEDIA_INFO, function(t) {
  41193. var i = {
  41194. msg: s.a.MEDIA_INFO,
  41195. data: t
  41196. };
  41197. e.postMessage(i)
  41198. }.bind(this)), t.on(s.a.METADATA_ARRIVED, function(t) {
  41199. var i = {
  41200. msg: s.a.METADATA_ARRIVED,
  41201. data: t
  41202. };
  41203. e.postMessage(i)
  41204. }.bind(this)), t.on(s.a.SCRIPTDATA_ARRIVED, function(t) {
  41205. var i = {
  41206. msg: s.a.SCRIPTDATA_ARRIVED,
  41207. data: t
  41208. };
  41209. e.postMessage(i)
  41210. }.bind(this)), t.on(s.a.STATISTICS_INFO, function(t) {
  41211. var i = {
  41212. msg: s.a.STATISTICS_INFO,
  41213. data: t
  41214. };
  41215. e.postMessage(i)
  41216. }.bind(this)), t.on(s.a.RECOMMEND_SEEKPOINT, function(t) {
  41217. e.postMessage({
  41218. msg: s.a.RECOMMEND_SEEKPOINT,
  41219. data: t
  41220. })
  41221. }.bind(this));
  41222. break;
  41223. case "destroy":
  41224. t && (t.destroy(), t = null), e.postMessage({
  41225. msg: "destroyed"
  41226. });
  41227. break;
  41228. case "start":
  41229. t.start();
  41230. break;
  41231. case "stop":
  41232. t.stop();
  41233. break;
  41234. case "seek":
  41235. t.seek(n.data.param);
  41236. break;
  41237. case "pause":
  41238. t.pause();
  41239. break;
  41240. case "resume":
  41241. t.resume();
  41242. break;
  41243. case "logging_config":
  41244. var o = n.data.param;
  41245. r.a.applyConfig(o), !0 === o.enableCallback ? r.a.addLogListener(i) : r.a.removeLogListener(i)
  41246. }
  41247. })
  41248. }
  41249. }, function(e, t, i) {
  41250. "use strict";
  41251. i.r(t),
  41252. function(e, r, n, a) {
  41253. i.d(t, "EasyPlayerWasmModule", function() {
  41254. return f
  41255. }), i.d(t, "EasyLoadWasmModule", function() {
  41256. return p
  41257. }), i.d(t, "EasyModuleInitialized", function() {
  41258. return m
  41259. });
  41260. var s, o = i(1),
  41261. u = !1,
  41262. l = "",
  41263. d = void 0 !== d ? d : {};
  41264. function c() {
  41265. var t, o = {};
  41266. for (t in d) d.hasOwnProperty(t) && (o[t] = d[t]);
  41267. var u, c, h, f = [],
  41268. p = "./this.program",
  41269. m = function(e, t) {
  41270. throw t
  41271. },
  41272. g = !1,
  41273. v = !1;
  41274. if (g = "object" == typeof window, v = "function" == typeof importScripts, c = "object" == typeof e &&
  41275. "object" == typeof e.versions && "string" == typeof e.versions.node, u = c && !g && !v, h = !g && !
  41276. u && !v, d.ENVIRONMENT) throw new Error(
  41277. "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)"
  41278. );
  41279. var y, _, b, w, E = "";
  41280. if (u) E = r + "/", y = function(e, t) {
  41281. var r;
  41282. return b || (b = i(69)), w || (w = i(70)), e = w.normalize(e), r = b.readFileSync(e), t ? r : r
  41283. .toString()
  41284. }, _ = function(e) {
  41285. var t = y(e, !0);
  41286. return t.buffer || (t = new Uint8Array(t)), I(t.buffer), t
  41287. }, e.argv.length > 1 && (p = e.argv[1].replace(/\\/g, "/")), f = e.argv.slice(2), n.exports = d, e
  41288. .on("uncaughtException", function(e) {
  41289. if (!(e instanceof ui)) throw e
  41290. }), e.on("unhandledRejection", ve), m = function(t) {
  41291. e.exit(t)
  41292. }, d.inspect = function() {
  41293. return "[Emscripten Module object]"
  41294. };
  41295. else if (h) "undefined" != typeof read && (y = function(e) {
  41296. return read(e)
  41297. }), _ = function(e) {
  41298. var t;
  41299. return "function" == typeof readbuffer ? new Uint8Array(readbuffer(e)) : (I("object" == typeof(t =
  41300. read(e, "binary"))), t)
  41301. }, "undefined" != typeof scriptArgs ? f = scriptArgs : void 0 !== arguments && (f = arguments),
  41302. "function" == typeof quit && (m = function(e) {
  41303. quit(e)
  41304. }), "undefined" != typeof print && ("undefined" == typeof console && (console = {}), console.log =
  41305. print, console.warn = console.error = "undefined" != typeof printErr ? printErr : print);
  41306. else {
  41307. if (!g && !v) throw new Error("environment detection error");
  41308. v ? E = self.location.href : document.currentScript && (E = document.currentScript.src), E = 0 !== E
  41309. .indexOf("blob:") ? E.substr(0, E.lastIndexOf("/") + 1) : "", y = function(e) {
  41310. var t = new XMLHttpRequest;
  41311. return t.open("GET", e, !1), t.send(null), t.responseText
  41312. }, v && (_ = function(e) {
  41313. var t = new XMLHttpRequest;
  41314. return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t
  41315. .response)
  41316. })
  41317. }
  41318. var T = d.print || console.log.bind(console),
  41319. S = d.printErr || console.warn.bind(console);
  41320. for (t in o) o.hasOwnProperty(t) && (d[t] = o[t]);
  41321. function A(e) {
  41322. A.shown || (A.shown = {}), A.shown[e] || (A.shown[e] = 1, S(e))
  41323. }
  41324. function k(e, t) {
  41325. var i = C,
  41326. r = i.length;
  41327. try {
  41328. i.grow(1)
  41329. } catch (e) {
  41330. if (!e instanceof RangeError) throw e;
  41331. throw "Unable to grow wasm table. Use a higher value for RESERVED_FUNCTION_POINTERS or set ALLOW_TABLE_GROWTH."
  41332. }
  41333. try {
  41334. i.set(r, e)
  41335. } catch (a) {
  41336. if (!a instanceof TypeError) throw a;
  41337. I(void 0 !== t, "Missing signature argument to addFunction");
  41338. var n = function(e, t) {
  41339. var i = [1, 0, 1, 96],
  41340. r = t.slice(0, 1),
  41341. n = t.slice(1),
  41342. a = {
  41343. i: 127,
  41344. j: 126,
  41345. f: 125,
  41346. d: 124
  41347. };
  41348. i.push(n.length);
  41349. for (var s = 0; s < n.length; ++s) i.push(a[n[s]]);
  41350. "v" == r ? i.push(0) : i = i.concat([1, a[r]]), i[1] = i.length - 2;
  41351. var o = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0].concat(i, [2, 7, 1, 1, 101, 1, 102, 0, 0,
  41352. 7, 5, 1, 1, 102, 0, 0
  41353. ])),
  41354. u = new WebAssembly.Module(o);
  41355. return new WebAssembly.Instance(u, {
  41356. e: {
  41357. f: e
  41358. }
  41359. }).exports.f
  41360. }(e, t);
  41361. i.set(r, n)
  41362. }
  41363. return r
  41364. }
  41365. o = null, d.arguments && (f = d.arguments), Object.getOwnPropertyDescriptor(d, "arguments") || Object
  41366. .defineProperty(d, "arguments", {
  41367. configurable: !0,
  41368. get: function() {
  41369. ve("Module.arguments has been replaced with plain arguments_")
  41370. }
  41371. }), d.thisProgram && (p = d.thisProgram), Object.getOwnPropertyDescriptor(d, "thisProgram") ||
  41372. Object.defineProperty(d, "thisProgram", {
  41373. configurable: !0,
  41374. get: function() {
  41375. ve("Module.thisProgram has been replaced with plain thisProgram")
  41376. }
  41377. }), d.quit && (m = d.quit), Object.getOwnPropertyDescriptor(d, "quit") || Object.defineProperty(d,
  41378. "quit", {
  41379. configurable: !0,
  41380. get: function() {
  41381. ve("Module.quit has been replaced with plain quit_")
  41382. }
  41383. }), I(void 0 === d.memoryInitializerPrefixURL,
  41384. "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"), I(
  41385. void 0 === d.pthreadMainPrefixURL,
  41386. "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d
  41387. .cdInitializerPrefixURL,
  41388. "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d
  41389. .filePackagePrefixURL,
  41390. "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"), I(void 0 === d
  41391. .read, "Module.read option was removed (modify read_ in JS)"), I(void 0 === d.readAsync,
  41392. "Module.readAsync option was removed (modify readAsync in JS)"), I(void 0 === d.readBinary,
  41393. "Module.readBinary option was removed (modify readBinary in JS)"), I(void 0 === d.setWindowTitle,
  41394. "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"), Object
  41395. .getOwnPropertyDescriptor(d, "read") || Object.defineProperty(d, "read", {
  41396. configurable: !0,
  41397. get: function() {
  41398. ve("Module.read has been replaced with plain read_")
  41399. }
  41400. }), Object.getOwnPropertyDescriptor(d, "readAsync") || Object.defineProperty(d, "readAsync", {
  41401. configurable: !0,
  41402. get: function() {
  41403. ve("Module.readAsync has been replaced with plain readAsync")
  41404. }
  41405. }), Object.getOwnPropertyDescriptor(d, "readBinary") || Object.defineProperty(d, "readBinary", {
  41406. configurable: !0,
  41407. get: function() {
  41408. ve("Module.readBinary has been replaced with plain readBinary")
  41409. }
  41410. }), ai = oi = si = function() {
  41411. ve("cannot use the stack before compiled code is ready to run, and has provided stack access")
  41412. };
  41413. var R, M, O = function(e) {};
  41414. d.wasmBinary && (R = d.wasmBinary), Object.getOwnPropertyDescriptor(d, "wasmBinary") || Object
  41415. .defineProperty(d, "wasmBinary", {
  41416. configurable: !0,
  41417. get: function() {
  41418. ve("Module.wasmBinary has been replaced with plain wasmBinary")
  41419. }
  41420. }), d.noExitRuntime && (s = d.noExitRuntime), Object.getOwnPropertyDescriptor(d, "noExitRuntime") ||
  41421. Object.defineProperty(d, "noExitRuntime", {
  41422. configurable: !0,
  41423. get: function() {
  41424. ve("Module.noExitRuntime has been replaced with plain noExitRuntime")
  41425. }
  41426. }), "object" != typeof WebAssembly && ve(
  41427. "No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.");
  41428. var C = new WebAssembly.Table({
  41429. initial: 2542,
  41430. maximum: 2552,
  41431. element: "anyfunc"
  41432. }),
  41433. D = !1;
  41434. function I(e, t) {
  41435. e || ve("Assertion failed: " + t)
  41436. }
  41437. function L(e) {
  41438. var t = d["_" + e];
  41439. return I(t, "Cannot call unknown function " + e + ", make sure it is exported"), t
  41440. }
  41441. function x(e, t, i, r, n) {
  41442. var a = {
  41443. string: function(e) {
  41444. var t = 0;
  41445. if (null != e && 0 !== e) {
  41446. var i = 1 + (e.length << 2);
  41447. F(e, t = si(i), i)
  41448. }
  41449. return t
  41450. },
  41451. array: function(e) {
  41452. var t = si(e.length);
  41453. return function(e, t) {
  41454. I(e.length >= 0,
  41455. "writeArrayToMemory array must have a length (should be an array or typed array)"),
  41456. G.set(e, t)
  41457. }(e, t), t
  41458. }
  41459. },
  41460. s = L(e),
  41461. o = [],
  41462. u = 0;
  41463. if (I("array" !== t, 'Return type should not be "array".'), r)
  41464. for (var l = 0; l < r.length; l++) {
  41465. var d = a[i[l]];
  41466. d ? (0 === u && (u = ai()), o[l] = d(r[l])) : o[l] = r[l]
  41467. }
  41468. var c = s.apply(null, o);
  41469. return c = function(e) {
  41470. return "string" === t ? N(e) : "boolean" === t ? Boolean(e) : e
  41471. }(c), 0 !== u && oi(u), c
  41472. }
  41473. var P = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0;
  41474. function U(e, t, i) {
  41475. for (var r = t + i, n = t; e[n] && !(n >= r);) ++n;
  41476. if (n - t > 16 && e.subarray && P) return P.decode(e.subarray(t, n));
  41477. for (var a = ""; t < n;) {
  41478. var s = e[t++];
  41479. if (128 & s) {
  41480. var o = 63 & e[t++];
  41481. if (192 != (224 & s)) {
  41482. var u = 63 & e[t++];
  41483. if (224 == (240 & s) ? s = (15 & s) << 12 | o << 6 | u : (240 != (248 & s) && A(
  41484. "Invalid UTF-8 leading byte 0x" + s.toString(16) +
  41485. " encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"
  41486. ), s = (7 & s) << 18 | o << 12 | u << 6 | 63 & e[t++]), s < 65536) a += String
  41487. .fromCharCode(s);
  41488. else {
  41489. var l = s - 65536;
  41490. a += String.fromCharCode(55296 | l >> 10, 56320 | 1023 & l)
  41491. }
  41492. } else a += String.fromCharCode((31 & s) << 6 | o)
  41493. } else a += String.fromCharCode(s)
  41494. }
  41495. return a
  41496. }
  41497. function N(e, t) {
  41498. return e ? U(V, e, t) : ""
  41499. }
  41500. function B(e, t, i, r) {
  41501. if (!(r > 0)) return 0;
  41502. for (var n = i, a = i + r - 1, s = 0; s < e.length; ++s) {
  41503. var o = e.charCodeAt(s);
  41504. if (o >= 55296 && o <= 57343 && (o = 65536 + ((1023 & o) << 10) | 1023 & e.charCodeAt(++s)), o <=
  41505. 127) {
  41506. if (i >= a) break;
  41507. t[i++] = o
  41508. } else if (o <= 2047) {
  41509. if (i + 1 >= a) break;
  41510. t[i++] = 192 | o >> 6, t[i++] = 128 | 63 & o
  41511. } else if (o <= 65535) {
  41512. if (i + 2 >= a) break;
  41513. t[i++] = 224 | o >> 12, t[i++] = 128 | o >> 6 & 63, t[i++] = 128 | 63 & o
  41514. } else {
  41515. if (i + 3 >= a) break;
  41516. o >= 2097152 && A("Invalid Unicode code point 0x" + o.toString(16) +
  41517. " encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."
  41518. ), t[i++] = 240 | o >> 18, t[i++] = 128 | o >> 12 & 63, t[i++] = 128 | o >> 6 & 63, t[i++] =
  41519. 128 | 63 & o
  41520. }
  41521. }
  41522. return t[i] = 0, i - n
  41523. }
  41524. function F(e, t, i) {
  41525. return I("number" == typeof i,
  41526. "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"
  41527. ), B(e, V, t, i)
  41528. }
  41529. function j(e) {
  41530. for (var t = 0, i = 0; i < e.length; ++i) {
  41531. var r = e.charCodeAt(i);
  41532. r >= 55296 && r <= 57343 && (r = 65536 + ((1023 & r) << 10) | 1023 & e.charCodeAt(++i)), r <=
  41533. 127 ? ++t : t += r <= 2047 ? 2 : r <= 65535 ? 3 : 4
  41534. }
  41535. return t
  41536. }
  41537. "undefined" != typeof TextDecoder && new TextDecoder("utf-16le");
  41538. var H, G, V, W, q, X;
  41539. function z(e, t) {
  41540. return e % t > 0 && (e += t - e % t), e
  41541. }
  41542. function K(e) {
  41543. H = e, d.HEAP8 = G = new Int8Array(e), d.HEAP16 = W = new Int16Array(e), d.HEAP32 = q =
  41544. new Int32Array(e), d.HEAPU8 = V = new Uint8Array(e), d.HEAPU16 = new Uint16Array(e), d.HEAPU32 =
  41545. X = new Uint32Array(e), d.HEAPF32 = new Float32Array(e), d.HEAPF64 = new Float64Array(e)
  41546. }
  41547. var Y = 1341328;
  41548. I(!0, "stack must start aligned"), I(!0, "heap must start aligned");
  41549. var Q = 5242880;
  41550. d.TOTAL_STACK && I(Q === d.TOTAL_STACK, "the stack size can no longer be determined at runtime");
  41551. var J = d.TOTAL_MEMORY || 67108864;
  41552. function Z() {
  41553. I(0 == (3 & Y)), X[1 + (Y >> 2)] = 34821223, X[2 + (Y >> 2)] = 2310721022, q[0] = 1668509029
  41554. }
  41555. function $() {
  41556. var e = X[1 + (Y >> 2)],
  41557. t = X[2 + (Y >> 2)];
  41558. 34821223 == e && 2310721022 == t || ve(
  41559. "Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x" +
  41560. t.toString(16) + " " + e.toString(16)), 1668509029 !== q[0] && ve(
  41561. "Runtime error: The application has corrupted its heap memory area (address zero)!")
  41562. }
  41563. function ee(e) {
  41564. for (; e.length > 0;) {
  41565. var t = e.shift();
  41566. if ("function" != typeof t) {
  41567. var i = t.func;
  41568. "number" == typeof i ? void 0 === t.arg ? d.dynCall_v(i) : d.dynCall_vi(i, t.arg) : i(void 0 ===
  41569. t.arg ? null : t.arg)
  41570. } else t()
  41571. }
  41572. }
  41573. Object.getOwnPropertyDescriptor(d, "TOTAL_MEMORY") || Object.defineProperty(d, "TOTAL_MEMORY", {
  41574. configurable: !0,
  41575. get: function() {
  41576. ve("Module.TOTAL_MEMORY has been replaced with plain INITIAL_TOTAL_MEMORY")
  41577. }
  41578. }), I(J >= Q, "TOTAL_MEMORY should be larger than TOTAL_STACK, was " + J + "! (TOTAL_STACK=" + Q +
  41579. ")"), I("undefined" != typeof Int32Array && "undefined" != typeof Float64Array && void 0 !==
  41580. Int32Array.prototype.subarray && void 0 !== Int32Array.prototype.set,
  41581. "JS engine does not provide full typed array support"), (M = d.wasmMemory ? d.wasmMemory :
  41582. new WebAssembly.Memory({
  41583. initial: J / 65536
  41584. })) && (H = M.buffer), I((J = H.byteLength) % 65536 == 0), K(H), q[335292] = 6584208,
  41585. function() {
  41586. var e = new Int16Array(1),
  41587. t = new Int8Array(e.buffer);
  41588. if (e[0] = 25459, 115 !== t[0] || 99 !== t[1])
  41589. throw "Runtime error: expected the system to be little-endian!"
  41590. }();
  41591. var te = [],
  41592. ie = [],
  41593. re = [],
  41594. ne = [],
  41595. ae = !1,
  41596. se = !1;
  41597. I(Math.imul,
  41598. "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  41599. ), I(Math.fround,
  41600. "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  41601. ), I(Math.clz32,
  41602. "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  41603. ), I(Math.trunc,
  41604. "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"
  41605. );
  41606. var oe = Math.abs,
  41607. ue = Math.ceil,
  41608. le = Math.floor,
  41609. de = Math.min,
  41610. ce = 0,
  41611. he = null,
  41612. fe = null,
  41613. pe = {};
  41614. function me(e) {
  41615. ce++, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(!pe[e]), pe[e] = 1, null ===
  41616. he && "undefined" != typeof setInterval && (he = setInterval(function() {
  41617. if (D) return clearInterval(he), void(he = null);
  41618. var e = !1;
  41619. for (var t in pe) e || (e = !0, S("still waiting on run dependencies:")), S(
  41620. "dependency: " + t);
  41621. e && S("(end of list)")
  41622. }, 1e4))) : S("warning: run dependency added without ID")
  41623. }
  41624. function ge(e) {
  41625. if (ce--, d.monitorRunDependencies && d.monitorRunDependencies(ce), e ? (I(pe[e]), delete pe[e]) :
  41626. S("warning: run dependency removed without ID"), 0 == ce && (null !== he && (clearInterval(he),
  41627. he = null), fe)) {
  41628. var t = fe;
  41629. fe = null, t()
  41630. }
  41631. }
  41632. function ve(e) {
  41633. throw d.onAbort && d.onAbort(e), T(e += ""), S(e), D = !0, e = "abort(" + e + ") at " + Ae(),
  41634. new WebAssembly.RuntimeError(e)
  41635. }
  41636. d.preloadedImages = {}, d.preloadedAudios = {};
  41637. var ye = "data:application/octet-stream;base64,";
  41638. function _e(e) {
  41639. return String.prototype.startsWith ? e.startsWith(ye) : 0 === e.indexOf(ye)
  41640. }
  41641. // var be, we, Ee = l + "bigScreen/monitorWarn/EasyPlayer.wasm"
  41642. var be, we, Ee = l + "EasyPlayer.wasm";
  41643. function Te() {
  41644. try {
  41645. if (R) return new Uint8Array(R);
  41646. if (_) return _(Ee);
  41647. throw "both async and sync fetching of the wasm failed"
  41648. } catch (e) {
  41649. ve(e)
  41650. }
  41651. }
  41652. function Se(e) {
  41653. return e.replace(/\b_Z[\w\d_]+/g, function(e) {
  41654. var t = function(e) {
  41655. return A("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"), e
  41656. }(e);
  41657. return e === t ? e : t + " [" + e + "]"
  41658. })
  41659. }
  41660. function Ae() {
  41661. var e = function() {
  41662. var e = new Error;
  41663. if (!e.stack) {
  41664. try {
  41665. throw new Error(0)
  41666. } catch (t) {
  41667. e = t
  41668. }
  41669. if (!e.stack) return "(no stack trace available)"
  41670. }
  41671. return e.stack.toString()
  41672. }();
  41673. return d.extraStackTrace && (e += "\n" + d.extraStackTrace()), Se(e)
  41674. }
  41675. _e(Ee) || (Ee = function(e) {
  41676. return d.locateFile ? d.locateFile(e, E) : E + e
  41677. }(Ee)), ie.push({
  41678. func: function() {
  41679. ii()
  41680. }
  41681. });
  41682. var ke = {};
  41683. function Re(e) {
  41684. return d.___errno_location ? q[d.___errno_location() >> 2] = e : S("failed to set errno from JS"), e
  41685. }
  41686. var Me = {
  41687. splitPath: function(e) {
  41688. return /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1)
  41689. },
  41690. normalizeArray: function(e, t) {
  41691. for (var i = 0, r = e.length - 1; r >= 0; r--) {
  41692. var n = e[r];
  41693. "." === n ? e.splice(r, 1) : ".." === n ? (e.splice(r, 1), i++) : i && (e.splice(r, 1), i--)
  41694. }
  41695. if (t)
  41696. for (; i; i--) e.unshift("..");
  41697. return e
  41698. },
  41699. normalize: function(e) {
  41700. var t = "/" === e.charAt(0),
  41701. i = "/" === e.substr(-1);
  41702. return (e = Me.normalizeArray(e.split("/").filter(function(e) {
  41703. return !!e
  41704. }), !t).join("/")) || t || (e = "."), e && i && (e += "/"), (t ? "/" : "") + e
  41705. },
  41706. dirname: function(e) {
  41707. var t = Me.splitPath(e),
  41708. i = t[0],
  41709. r = t[1];
  41710. return i || r ? (r && (r = r.substr(0, r.length - 1)), i + r) : "."
  41711. },
  41712. basename: function(e) {
  41713. if ("/" === e) return "/";
  41714. var t = e.lastIndexOf("/");
  41715. return -1 === t ? e : e.substr(t + 1)
  41716. },
  41717. extname: function(e) {
  41718. return Me.splitPath(e)[3]
  41719. },
  41720. join: function() {
  41721. var e = Array.prototype.slice.call(arguments, 0);
  41722. return Me.normalize(e.join("/"))
  41723. },
  41724. join2: function(e, t) {
  41725. return Me.normalize(e + "/" + t)
  41726. }
  41727. },
  41728. Oe = {
  41729. resolve: function() {
  41730. for (var e = "", t = !1, i = arguments.length - 1; i >= -1 && !t; i--) {
  41731. var r = i >= 0 ? arguments[i] : xe.cwd();
  41732. if ("string" != typeof r) throw new TypeError("Arguments to path.resolve must be strings");
  41733. if (!r) return "";
  41734. e = r + "/" + e, t = "/" === r.charAt(0)
  41735. }
  41736. return (t ? "/" : "") + (e = Me.normalizeArray(e.split("/").filter(function(e) {
  41737. return !!e
  41738. }), !t).join("/")) || "."
  41739. },
  41740. relative: function(e, t) {
  41741. function i(e) {
  41742. for (var t = 0; t < e.length && "" === e[t]; t++);
  41743. for (var i = e.length - 1; i >= 0 && "" === e[i]; i--);
  41744. return t > i ? [] : e.slice(t, i - t + 1)
  41745. }
  41746. e = Oe.resolve(e).substr(1), t = Oe.resolve(t).substr(1);
  41747. for (var r = i(e.split("/")), n = i(t.split("/")), a = Math.min(r.length, n.length), s = a,
  41748. o = 0; o < a; o++)
  41749. if (r[o] !== n[o]) {
  41750. s = o;
  41751. break
  41752. } var u = [];
  41753. for (o = s; o < r.length; o++) u.push("..");
  41754. return (u = u.concat(n.slice(s))).join("/")
  41755. }
  41756. },
  41757. Ce = {
  41758. ttys: [],
  41759. init: function() {},
  41760. shutdown: function() {},
  41761. register: function(e, t) {
  41762. Ce.ttys[e] = {
  41763. input: [],
  41764. output: [],
  41765. ops: t
  41766. }, xe.registerDevice(e, Ce.stream_ops)
  41767. },
  41768. stream_ops: {
  41769. open: function(e) {
  41770. var t = Ce.ttys[e.node.rdev];
  41771. if (!t) throw new xe.ErrnoError(43);
  41772. e.tty = t, e.seekable = !1
  41773. },
  41774. close: function(e) {
  41775. e.tty.ops.flush(e.tty)
  41776. },
  41777. flush: function(e) {
  41778. e.tty.ops.flush(e.tty)
  41779. },
  41780. read: function(e, t, i, r, n) {
  41781. if (!e.tty || !e.tty.ops.get_char) throw new xe.ErrnoError(60);
  41782. for (var a = 0, s = 0; s < r; s++) {
  41783. var o;
  41784. try {
  41785. o = e.tty.ops.get_char(e.tty)
  41786. } catch (e) {
  41787. throw new xe.ErrnoError(29)
  41788. }
  41789. if (void 0 === o && 0 === a) throw new xe.ErrnoError(6);
  41790. if (null == o) break;
  41791. a++, t[i + s] = o
  41792. }
  41793. return a && (e.node.timestamp = Date.now()), a
  41794. },
  41795. write: function(e, t, i, r, n) {
  41796. if (!e.tty || !e.tty.ops.put_char) throw new xe.ErrnoError(60);
  41797. try {
  41798. for (var a = 0; a < r; a++) e.tty.ops.put_char(e.tty, t[i + a])
  41799. } catch (e) {
  41800. throw new xe.ErrnoError(29)
  41801. }
  41802. return r && (e.node.timestamp = Date.now()), a
  41803. }
  41804. },
  41805. default_tty_ops: {
  41806. get_char: function(t) {
  41807. if (!t.input.length) {
  41808. var i = null;
  41809. if (u) {
  41810. var r = a.alloc ? a.alloc(256) : new a(256),
  41811. n = 0;
  41812. try {
  41813. n = b.readSync(e.stdin.fd, r, 0, 256, null)
  41814. } catch (e) {
  41815. if (-1 == e.toString().indexOf("EOF")) throw e;
  41816. n = 0
  41817. }
  41818. i = n > 0 ? r.slice(0, n).toString("utf-8") : null
  41819. } else "undefined" != typeof window && "function" == typeof window.prompt ? null !== (i =
  41820. window.prompt("Input: ")) && (i += "\n") : "function" == typeof readline && null !== (
  41821. i = readline()) && (i += "\n");
  41822. if (!i) return null;
  41823. t.input = Be(i, !0)
  41824. }
  41825. return t.input.shift()
  41826. },
  41827. put_char: function(e, t) {
  41828. null === t || 10 === t ? e.output = [] : 0 != t && e.output.push(t)
  41829. },
  41830. flush: function(e) {
  41831. e.output && e.output.length > 0 && (e.output = [])
  41832. }
  41833. },
  41834. default_tty1_ops: {
  41835. put_char: function(e, t) {
  41836. null === t || 10 === t ? (S(U(e.output, 0)), e.output = []) : 0 != t && e.output.push(t)
  41837. },
  41838. flush: function(e) {
  41839. e.output && e.output.length > 0 && (S(U(e.output, 0)), e.output = [])
  41840. }
  41841. }
  41842. },
  41843. De = {
  41844. ops_table: null,
  41845. mount: function(e) {
  41846. return De.createNode(null, "/", 16895, 0)
  41847. },
  41848. createNode: function(e, t, i, r) {
  41849. if (xe.isBlkdev(i) || xe.isFIFO(i)) throw new xe.ErrnoError(63);
  41850. De.ops_table || (De.ops_table = {
  41851. dir: {
  41852. node: {
  41853. getattr: De.node_ops.getattr,
  41854. setattr: De.node_ops.setattr,
  41855. lookup: De.node_ops.lookup,
  41856. mknod: De.node_ops.mknod,
  41857. rename: De.node_ops.rename,
  41858. unlink: De.node_ops.unlink,
  41859. rmdir: De.node_ops.rmdir,
  41860. readdir: De.node_ops.readdir,
  41861. symlink: De.node_ops.symlink
  41862. },
  41863. stream: {
  41864. llseek: De.stream_ops.llseek
  41865. }
  41866. },
  41867. file: {
  41868. node: {
  41869. getattr: De.node_ops.getattr,
  41870. setattr: De.node_ops.setattr
  41871. },
  41872. stream: {
  41873. llseek: De.stream_ops.llseek,
  41874. read: De.stream_ops.read,
  41875. write: De.stream_ops.write,
  41876. allocate: De.stream_ops.allocate,
  41877. mmap: De.stream_ops.mmap,
  41878. msync: De.stream_ops.msync
  41879. }
  41880. },
  41881. link: {
  41882. node: {
  41883. getattr: De.node_ops.getattr,
  41884. setattr: De.node_ops.setattr,
  41885. readlink: De.node_ops.readlink
  41886. },
  41887. stream: {}
  41888. },
  41889. chrdev: {
  41890. node: {
  41891. getattr: De.node_ops.getattr,
  41892. setattr: De.node_ops.setattr
  41893. },
  41894. stream: xe.chrdev_stream_ops
  41895. }
  41896. });
  41897. var n = xe.createNode(e, t, i, r);
  41898. return xe.isDir(n.mode) ? (n.node_ops = De.ops_table.dir.node, n.stream_ops = De.ops_table.dir
  41899. .stream, n.contents = {}) : xe.isFile(n.mode) ? (n.node_ops = De.ops_table.file.node, n
  41900. .stream_ops = De.ops_table.file.stream, n.usedBytes = 0, n.contents = null) : xe.isLink(n
  41901. .mode) ? (n.node_ops = De.ops_table.link.node, n.stream_ops = De.ops_table.link.stream) :
  41902. xe.isChrdev(n.mode) && (n.node_ops = De.ops_table.chrdev.node, n.stream_ops = De.ops_table
  41903. .chrdev.stream), n.timestamp = Date.now(), e && (e.contents[t] = n), n
  41904. },
  41905. getFileDataAsRegularArray: function(e) {
  41906. if (e.contents && e.contents.subarray) {
  41907. for (var t = [], i = 0; i < e.usedBytes; ++i) t.push(e.contents[i]);
  41908. return t
  41909. }
  41910. return e.contents
  41911. },
  41912. getFileDataAsTypedArray: function(e) {
  41913. return e.contents ? e.contents.subarray ? e.contents.subarray(0, e.usedBytes) :
  41914. new Uint8Array(e.contents) : new Uint8Array
  41915. },
  41916. expandFileStorage: function(e, t) {
  41917. var i = e.contents ? e.contents.length : 0;
  41918. if (!(i >= t)) {
  41919. t = Math.max(t, i * (i < 1048576 ? 2 : 1.125) | 0), 0 != i && (t = Math.max(t, 256));
  41920. var r = e.contents;
  41921. e.contents = new Uint8Array(t), e.usedBytes > 0 && e.contents.set(r.subarray(0, e
  41922. .usedBytes), 0)
  41923. }
  41924. },
  41925. resizeFileStorage: function(e, t) {
  41926. if (e.usedBytes != t) {
  41927. if (0 == t) return e.contents = null, void(e.usedBytes = 0);
  41928. if (!e.contents || e.contents.subarray) {
  41929. var i = e.contents;
  41930. return e.contents = new Uint8Array(new ArrayBuffer(t)), i && e.contents.set(i.subarray(0,
  41931. Math.min(t, e.usedBytes))), void(e.usedBytes = t)
  41932. }
  41933. if (e.contents || (e.contents = []), e.contents.length > t) e.contents.length = t;
  41934. else
  41935. for (; e.contents.length < t;) e.contents.push(0);
  41936. e.usedBytes = t
  41937. }
  41938. },
  41939. node_ops: {
  41940. getattr: function(e) {
  41941. var t = {};
  41942. return t.dev = xe.isChrdev(e.mode) ? e.id : 1, t.ino = e.id, t.mode = e.mode, t.nlink = 1, t
  41943. .uid = 0, t.gid = 0, t.rdev = e.rdev, xe.isDir(e.mode) ? t.size = 4096 : xe.isFile(e
  41944. .mode) ? t.size = e.usedBytes : xe.isLink(e.mode) ? t.size = e.link.length : t.size = 0, t
  41945. .atime = new Date(e.timestamp), t.mtime = new Date(e.timestamp), t.ctime = new Date(e
  41946. .timestamp), t.blksize = 4096, t.blocks = Math.ceil(t.size / t.blksize), t
  41947. },
  41948. setattr: function(e, t) {
  41949. void 0 !== t.mode && (e.mode = t.mode), void 0 !== t.timestamp && (e.timestamp = t
  41950. .timestamp), void 0 !== t.size && De.resizeFileStorage(e, t.size)
  41951. },
  41952. lookup: function(e, t) {
  41953. throw xe.genericErrors[44]
  41954. },
  41955. mknod: function(e, t, i, r) {
  41956. return De.createNode(e, t, i, r)
  41957. },
  41958. rename: function(e, t, i) {
  41959. if (xe.isDir(e.mode)) {
  41960. var r;
  41961. try {
  41962. r = xe.lookupNode(t, i)
  41963. } catch (e) {}
  41964. if (r)
  41965. for (var n in r.contents) throw new xe.ErrnoError(55)
  41966. }
  41967. delete e.parent.contents[e.name], e.name = i, t.contents[i] = e, e.parent = t
  41968. },
  41969. unlink: function(e, t) {
  41970. delete e.contents[t]
  41971. },
  41972. rmdir: function(e, t) {
  41973. var i = xe.lookupNode(e, t);
  41974. for (var r in i.contents) throw new xe.ErrnoError(55);
  41975. delete e.contents[t]
  41976. },
  41977. readdir: function(e) {
  41978. var t = [".", ".."];
  41979. for (var i in e.contents) e.contents.hasOwnProperty(i) && t.push(i);
  41980. return t
  41981. },
  41982. symlink: function(e, t, i) {
  41983. var r = De.createNode(e, t, 41471, 0);
  41984. return r.link = i, r
  41985. },
  41986. readlink: function(e) {
  41987. if (!xe.isLink(e.mode)) throw new xe.ErrnoError(28);
  41988. return e.link
  41989. }
  41990. },
  41991. stream_ops: {
  41992. read: function(e, t, i, r, n) {
  41993. var a = e.node.contents;
  41994. if (n >= e.node.usedBytes) return 0;
  41995. var s = Math.min(e.node.usedBytes - n, r);
  41996. if (I(s >= 0), s > 8 && a.subarray) t.set(a.subarray(n, n + s), i);
  41997. else
  41998. for (var o = 0; o < s; o++) t[i + o] = a[n + o];
  41999. return s
  42000. },
  42001. write: function(e, t, i, r, n, a) {
  42002. if (a && A(
  42003. "file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)"
  42004. ), a = !1, !r) return 0;
  42005. var s = e.node;
  42006. if (s.timestamp = Date.now(), t.subarray && (!s.contents || s.contents.subarray)) {
  42007. if (a) return I(0 === n, "canOwn must imply no weird position inside the file"), s
  42008. .contents = t.subarray(i, i + r), s.usedBytes = r, r;
  42009. if (0 === s.usedBytes && 0 === n) return s.contents = new Uint8Array(t.subarray(i, i +
  42010. r)), s.usedBytes = r, r;
  42011. if (n + r <= s.usedBytes) return s.contents.set(t.subarray(i, i + r), n), r
  42012. }
  42013. if (De.expandFileStorage(s, n + r), s.contents.subarray && t.subarray) s.contents.set(t
  42014. .subarray(i, i + r), n);
  42015. else
  42016. for (var o = 0; o < r; o++) s.contents[n + o] = t[i + o];
  42017. return s.usedBytes = Math.max(s.usedBytes, n + r), r
  42018. },
  42019. llseek: function(e, t, i) {
  42020. var r = t;
  42021. if (1 === i ? r += e.position : 2 === i && xe.isFile(e.node.mode) && (r += e.node
  42022. .usedBytes), r < 0) throw new xe.ErrnoError(28);
  42023. return r
  42024. },
  42025. allocate: function(e, t, i) {
  42026. De.expandFileStorage(e.node, t + i), e.node.usedBytes = Math.max(e.node.usedBytes, t + i)
  42027. },
  42028. mmap: function(e, t, i, r, n, a, s) {
  42029. if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43);
  42030. var o, u, l = e.node.contents;
  42031. if (2 & s || l.buffer !== t && l.buffer !== t.buffer) {
  42032. (n > 0 || n + r < e.node.usedBytes) && (l = l.subarray ? l.subarray(n, n + r) : Array
  42033. .prototype.slice.call(l, n, n + r)), u = !0;
  42034. var d = t.buffer == G.buffer;
  42035. if (!(o = ri(r))) throw new xe.ErrnoError(48);
  42036. (d ? G : t).set(l, o)
  42037. } else u = !1, o = l.byteOffset;
  42038. return {
  42039. ptr: o,
  42040. allocated: u
  42041. }
  42042. },
  42043. msync: function(e, t, i, r, n) {
  42044. if (!xe.isFile(e.node.mode)) throw new xe.ErrnoError(43);
  42045. return 2 & n ? 0 : (De.stream_ops.write(e, t, 0, r, i, !1), 0)
  42046. }
  42047. }
  42048. },
  42049. Ie = {
  42050. 0: "Success",
  42051. 1: "Arg list too long",
  42052. 2: "Permission denied",
  42053. 3: "Address already in use",
  42054. 4: "Address not available",
  42055. 5: "Address family not supported by protocol family",
  42056. 6: "No more processes",
  42057. 7: "Socket already connected",
  42058. 8: "Bad file number",
  42059. 9: "Trying to read unreadable message",
  42060. 10: "Mount device busy",
  42061. 11: "Operation canceled",
  42062. 12: "No children",
  42063. 13: "Connection aborted",
  42064. 14: "Connection refused",
  42065. 15: "Connection reset by peer",
  42066. 16: "File locking deadlock error",
  42067. 17: "Destination address required",
  42068. 18: "Math arg out of domain of func",
  42069. 19: "Quota exceeded",
  42070. 20: "File exists",
  42071. 21: "Bad address",
  42072. 22: "File too large",
  42073. 23: "Host is unreachable",
  42074. 24: "Identifier removed",
  42075. 25: "Illegal byte sequence",
  42076. 26: "Connection already in progress",
  42077. 27: "Interrupted system call",
  42078. 28: "Invalid argument",
  42079. 29: "I/O error",
  42080. 30: "Socket is already connected",
  42081. 31: "Is a directory",
  42082. 32: "Too many symbolic links",
  42083. 33: "Too many open files",
  42084. 34: "Too many links",
  42085. 35: "Message too long",
  42086. 36: "Multihop attempted",
  42087. 37: "File or path name too long",
  42088. 38: "Network interface is not configured",
  42089. 39: "Connection reset by network",
  42090. 40: "Network is unreachable",
  42091. 41: "Too many open files in system",
  42092. 42: "No buffer space available",
  42093. 43: "No such device",
  42094. 44: "No such file or directory",
  42095. 45: "Exec format error",
  42096. 46: "No record locks available",
  42097. 47: "The link has been severed",
  42098. 48: "Not enough core",
  42099. 49: "No message of desired type",
  42100. 50: "Protocol not available",
  42101. 51: "No space left on device",
  42102. 52: "Function not implemented",
  42103. 53: "Socket is not connected",
  42104. 54: "Not a directory",
  42105. 55: "Directory not empty",
  42106. 56: "State not recoverable",
  42107. 57: "Socket operation on non-socket",
  42108. 59: "Not a typewriter",
  42109. 60: "No such device or address",
  42110. 61: "Value too large for defined data type",
  42111. 62: "Previous owner died",
  42112. 63: "Not super-user",
  42113. 64: "Broken pipe",
  42114. 65: "Protocol error",
  42115. 66: "Unknown protocol",
  42116. 67: "Protocol wrong type for socket",
  42117. 68: "Math result not representable",
  42118. 69: "Read only file system",
  42119. 70: "Illegal seek",
  42120. 71: "No such process",
  42121. 72: "Stale file handle",
  42122. 73: "Connection timed out",
  42123. 74: "Text file busy",
  42124. 75: "Cross-device link",
  42125. 100: "Device not a stream",
  42126. 101: "Bad font file fmt",
  42127. 102: "Invalid slot",
  42128. 103: "Invalid request code",
  42129. 104: "No anode",
  42130. 105: "Block device required",
  42131. 106: "Channel number out of range",
  42132. 107: "Level 3 halted",
  42133. 108: "Level 3 reset",
  42134. 109: "Link number out of range",
  42135. 110: "Protocol driver not attached",
  42136. 111: "No CSI structure available",
  42137. 112: "Level 2 halted",
  42138. 113: "Invalid exchange",
  42139. 114: "Invalid request descriptor",
  42140. 115: "Exchange full",
  42141. 116: "No data (for no delay io)",
  42142. 117: "Timer expired",
  42143. 118: "Out of streams resources",
  42144. 119: "Machine is not on the network",
  42145. 120: "Package not installed",
  42146. 121: "The object is remote",
  42147. 122: "Advertise error",
  42148. 123: "Srmount error",
  42149. 124: "Communication error on send",
  42150. 125: "Cross mount point (not really error)",
  42151. 126: "Given log. name not unique",
  42152. 127: "f.d. invalid for this operation",
  42153. 128: "Remote address changed",
  42154. 129: "Can access a needed shared lib",
  42155. 130: "Accessing a corrupted shared lib",
  42156. 131: ".lib section in a.out corrupted",
  42157. 132: "Attempting to link in too many libs",
  42158. 133: "Attempting to exec a shared library",
  42159. 135: "Streams pipe error",
  42160. 136: "Too many users",
  42161. 137: "Socket type not supported",
  42162. 138: "Not supported",
  42163. 139: "Protocol family not supported",
  42164. 140: "Can't send after socket shutdown",
  42165. 141: "Too many references",
  42166. 142: "Host is down",
  42167. 148: "No medium (in tape drive)",
  42168. 156: "Level 2 not synchronized"
  42169. },
  42170. Le = {
  42171. EPERM: 63,
  42172. ENOENT: 44,
  42173. ESRCH: 71,
  42174. EINTR: 27,
  42175. EIO: 29,
  42176. ENXIO: 60,
  42177. E2BIG: 1,
  42178. ENOEXEC: 45,
  42179. EBADF: 8,
  42180. ECHILD: 12,
  42181. EAGAIN: 6,
  42182. EWOULDBLOCK: 6,
  42183. ENOMEM: 48,
  42184. EACCES: 2,
  42185. EFAULT: 21,
  42186. ENOTBLK: 105,
  42187. EBUSY: 10,
  42188. EEXIST: 20,
  42189. EXDEV: 75,
  42190. ENODEV: 43,
  42191. ENOTDIR: 54,
  42192. EISDIR: 31,
  42193. EINVAL: 28,
  42194. ENFILE: 41,
  42195. EMFILE: 33,
  42196. ENOTTY: 59,
  42197. ETXTBSY: 74,
  42198. EFBIG: 22,
  42199. ENOSPC: 51,
  42200. ESPIPE: 70,
  42201. EROFS: 69,
  42202. EMLINK: 34,
  42203. EPIPE: 64,
  42204. EDOM: 18,
  42205. ERANGE: 68,
  42206. ENOMSG: 49,
  42207. EIDRM: 24,
  42208. ECHRNG: 106,
  42209. EL2NSYNC: 156,
  42210. EL3HLT: 107,
  42211. EL3RST: 108,
  42212. ELNRNG: 109,
  42213. EUNATCH: 110,
  42214. ENOCSI: 111,
  42215. EL2HLT: 112,
  42216. EDEADLK: 16,
  42217. ENOLCK: 46,
  42218. EBADE: 113,
  42219. EBADR: 114,
  42220. EXFULL: 115,
  42221. ENOANO: 104,
  42222. EBADRQC: 103,
  42223. EBADSLT: 102,
  42224. EDEADLOCK: 16,
  42225. EBFONT: 101,
  42226. ENOSTR: 100,
  42227. ENODATA: 116,
  42228. ETIME: 117,
  42229. ENOSR: 118,
  42230. ENONET: 119,
  42231. ENOPKG: 120,
  42232. EREMOTE: 121,
  42233. ENOLINK: 47,
  42234. EADV: 122,
  42235. ESRMNT: 123,
  42236. ECOMM: 124,
  42237. EPROTO: 65,
  42238. EMULTIHOP: 36,
  42239. EDOTDOT: 125,
  42240. EBADMSG: 9,
  42241. ENOTUNIQ: 126,
  42242. EBADFD: 127,
  42243. EREMCHG: 128,
  42244. ELIBACC: 129,
  42245. ELIBBAD: 130,
  42246. ELIBSCN: 131,
  42247. ELIBMAX: 132,
  42248. ELIBEXEC: 133,
  42249. ENOSYS: 52,
  42250. ENOTEMPTY: 55,
  42251. ENAMETOOLONG: 37,
  42252. ELOOP: 32,
  42253. EOPNOTSUPP: 138,
  42254. EPFNOSUPPORT: 139,
  42255. ECONNRESET: 15,
  42256. ENOBUFS: 42,
  42257. EAFNOSUPPORT: 5,
  42258. EPROTOTYPE: 67,
  42259. ENOTSOCK: 57,
  42260. ENOPROTOOPT: 50,
  42261. ESHUTDOWN: 140,
  42262. ECONNREFUSED: 14,
  42263. EADDRINUSE: 3,
  42264. ECONNABORTED: 13,
  42265. ENETUNREACH: 40,
  42266. ENETDOWN: 38,
  42267. ETIMEDOUT: 73,
  42268. EHOSTDOWN: 142,
  42269. EHOSTUNREACH: 23,
  42270. EINPROGRESS: 26,
  42271. EALREADY: 7,
  42272. EDESTADDRREQ: 17,
  42273. EMSGSIZE: 35,
  42274. EPROTONOSUPPORT: 66,
  42275. ESOCKTNOSUPPORT: 137,
  42276. EADDRNOTAVAIL: 4,
  42277. ENETRESET: 39,
  42278. EISCONN: 30,
  42279. ENOTCONN: 53,
  42280. ETOOMANYREFS: 141,
  42281. EUSERS: 136,
  42282. EDQUOT: 19,
  42283. ESTALE: 72,
  42284. ENOTSUP: 138,
  42285. ENOMEDIUM: 148,
  42286. EILSEQ: 25,
  42287. EOVERFLOW: 61,
  42288. ECANCELED: 11,
  42289. ENOTRECOVERABLE: 56,
  42290. EOWNERDEAD: 62,
  42291. ESTRPIPE: 135
  42292. },
  42293. xe = {
  42294. root: null,
  42295. mounts: [],
  42296. devices: {},
  42297. streams: [],
  42298. nextInode: 1,
  42299. nameTable: null,
  42300. currentPath: "/",
  42301. initialized: !1,
  42302. ignorePermissions: !0,
  42303. trackingDelegate: {},
  42304. tracking: {
  42305. openFlags: {
  42306. READ: 1,
  42307. WRITE: 2
  42308. }
  42309. },
  42310. ErrnoError: null,
  42311. genericErrors: {},
  42312. filesystems: null,
  42313. syncFSRequests: 0,
  42314. handleFSError: function(e) {
  42315. if (!(e instanceof xe.ErrnoError)) throw e + " : " + Ae();
  42316. return Re(e.errno)
  42317. },
  42318. lookupPath: function(e, t) {
  42319. if (t = t || {}, !(e = Oe.resolve(xe.cwd(), e))) return {
  42320. path: "",
  42321. node: null
  42322. };
  42323. var i = {
  42324. follow_mount: !0,
  42325. recurse_count: 0
  42326. };
  42327. for (var r in i) void 0 === t[r] && (t[r] = i[r]);
  42328. if (t.recurse_count > 8) throw new xe.ErrnoError(32);
  42329. for (var n = Me.normalizeArray(e.split("/").filter(function(e) {
  42330. return !!e
  42331. }), !1), a = xe.root, s = "/", o = 0; o < n.length; o++) {
  42332. var u = o === n.length - 1;
  42333. if (u && t.parent) break;
  42334. if (a = xe.lookupNode(a, n[o]), s = Me.join2(s, n[o]), xe.isMountpoint(a) && (!u || u && t
  42335. .follow_mount) && (a = a.mounted.root), !u || t.follow)
  42336. for (var l = 0; xe.isLink(a.mode);) {
  42337. var d = xe.readlink(s);
  42338. if (s = Oe.resolve(Me.dirname(s), d), a = xe.lookupPath(s, {
  42339. recurse_count: t.recurse_count
  42340. }).node, l++ > 40) throw new xe.ErrnoError(32)
  42341. }
  42342. }
  42343. return {
  42344. path: s,
  42345. node: a
  42346. }
  42347. },
  42348. getPath: function(e) {
  42349. for (var t;;) {
  42350. if (xe.isRoot(e)) {
  42351. var i = e.mount.mountpoint;
  42352. return t ? "/" !== i[i.length - 1] ? i + "/" + t : i + t : i
  42353. }
  42354. t = t ? e.name + "/" + t : e.name, e = e.parent
  42355. }
  42356. },
  42357. hashName: function(e, t) {
  42358. for (var i = 0, r = 0; r < t.length; r++) i = (i << 5) - i + t.charCodeAt(r) | 0;
  42359. return (e + i >>> 0) % xe.nameTable.length
  42360. },
  42361. hashAddNode: function(e) {
  42362. var t = xe.hashName(e.parent.id, e.name);
  42363. e.name_next = xe.nameTable[t], xe.nameTable[t] = e
  42364. },
  42365. hashRemoveNode: function(e) {
  42366. var t = xe.hashName(e.parent.id, e.name);
  42367. if (xe.nameTable[t] === e) xe.nameTable[t] = e.name_next;
  42368. else
  42369. for (var i = xe.nameTable[t]; i;) {
  42370. if (i.name_next === e) {
  42371. i.name_next = e.name_next;
  42372. break
  42373. }
  42374. i = i.name_next
  42375. }
  42376. },
  42377. lookupNode: function(e, t) {
  42378. var i = xe.mayLookup(e);
  42379. if (i) throw new xe.ErrnoError(i, e);
  42380. for (var r = xe.hashName(e.id, t), n = xe.nameTable[r]; n; n = n.name_next) {
  42381. var a = n.name;
  42382. if (n.parent.id === e.id && a === t) return n
  42383. }
  42384. return xe.lookup(e, t)
  42385. },
  42386. createNode: function(e, t, i, r) {
  42387. xe.FSNode || (xe.FSNode = function(e, t, i, r) {
  42388. e || (e = this), this.parent = e, this.mount = e.mount, this.mounted = null, this.id =
  42389. xe.nextInode++, this.name = t, this.mode = i, this.node_ops = {}, this
  42390. .stream_ops = {}, this.rdev = r
  42391. }, xe.FSNode.prototype = {}, Object.defineProperties(xe.FSNode.prototype, {
  42392. read: {
  42393. get: function() {
  42394. return 365 == (365 & this.mode)
  42395. },
  42396. set: function(e) {
  42397. e ? this.mode |= 365 : this.mode &= -366
  42398. }
  42399. },
  42400. write: {
  42401. get: function() {
  42402. return 146 == (146 & this.mode)
  42403. },
  42404. set: function(e) {
  42405. e ? this.mode |= 146 : this.mode &= -147
  42406. }
  42407. },
  42408. isFolder: {
  42409. get: function() {
  42410. return xe.isDir(this.mode)
  42411. }
  42412. },
  42413. isDevice: {
  42414. get: function() {
  42415. return xe.isChrdev(this.mode)
  42416. }
  42417. }
  42418. }));
  42419. var n = new xe.FSNode(e, t, i, r);
  42420. return xe.hashAddNode(n), n
  42421. },
  42422. destroyNode: function(e) {
  42423. xe.hashRemoveNode(e)
  42424. },
  42425. isRoot: function(e) {
  42426. return e === e.parent
  42427. },
  42428. isMountpoint: function(e) {
  42429. return !!e.mounted
  42430. },
  42431. isFile: function(e) {
  42432. return 32768 == (61440 & e)
  42433. },
  42434. isDir: function(e) {
  42435. return 16384 == (61440 & e)
  42436. },
  42437. isLink: function(e) {
  42438. return 40960 == (61440 & e)
  42439. },
  42440. isChrdev: function(e) {
  42441. return 8192 == (61440 & e)
  42442. },
  42443. isBlkdev: function(e) {
  42444. return 24576 == (61440 & e)
  42445. },
  42446. isFIFO: function(e) {
  42447. return 4096 == (61440 & e)
  42448. },
  42449. isSocket: function(e) {
  42450. return 49152 == (49152 & e)
  42451. },
  42452. flagModes: {
  42453. r: 0,
  42454. rs: 1052672,
  42455. "r+": 2,
  42456. w: 577,
  42457. wx: 705,
  42458. xw: 705,
  42459. "w+": 578,
  42460. "wx+": 706,
  42461. "xw+": 706,
  42462. a: 1089,
  42463. ax: 1217,
  42464. xa: 1217,
  42465. "a+": 1090,
  42466. "ax+": 1218,
  42467. "xa+": 1218
  42468. },
  42469. modeStringToFlags: function(e) {
  42470. var t = xe.flagModes[e];
  42471. if (void 0 === t) throw new Error("Unknown file open mode: " + e);
  42472. return t
  42473. },
  42474. flagsToPermissionString: function(e) {
  42475. var t = ["r", "w", "rw"][3 & e];
  42476. return 512 & e && (t += "w"), t
  42477. },
  42478. nodePermissions: function(e, t) {
  42479. return xe.ignorePermissions || (-1 === t.indexOf("r") || 292 & e.mode) && (-1 === t.indexOf(
  42480. "w") || 146 & e.mode) && (-1 === t.indexOf("x") || 73 & e.mode) ? 0 : 2
  42481. },
  42482. mayLookup: function(e) {
  42483. return xe.nodePermissions(e, "x") || (e.node_ops.lookup ? 0 : 2)
  42484. },
  42485. mayCreate: function(e, t) {
  42486. try {
  42487. return xe.lookupNode(e, t), 20
  42488. } catch (e) {}
  42489. return xe.nodePermissions(e, "wx")
  42490. },
  42491. mayDelete: function(e, t, i) {
  42492. var r;
  42493. try {
  42494. r = xe.lookupNode(e, t)
  42495. } catch (e) {
  42496. return e.errno
  42497. }
  42498. var n = xe.nodePermissions(e, "wx");
  42499. if (n) return n;
  42500. if (i) {
  42501. if (!xe.isDir(r.mode)) return 54;
  42502. if (xe.isRoot(r) || xe.getPath(r) === xe.cwd()) return 10
  42503. } else if (xe.isDir(r.mode)) return 31;
  42504. return 0
  42505. },
  42506. mayOpen: function(e, t) {
  42507. return e ? xe.isLink(e.mode) ? 32 : xe.isDir(e.mode) && ("r" !== xe.flagsToPermissionString(
  42508. t) || 512 & t) ? 31 : xe.nodePermissions(e, xe.flagsToPermissionString(t)) : 44
  42509. },
  42510. MAX_OPEN_FDS: 4096,
  42511. nextfd: function(e, t) {
  42512. e = e || 0, t = t || xe.MAX_OPEN_FDS;
  42513. for (var i = e; i <= t; i++)
  42514. if (!xe.streams[i]) return i;
  42515. throw new xe.ErrnoError(33)
  42516. },
  42517. getStream: function(e) {
  42518. return xe.streams[e]
  42519. },
  42520. createStream: function(e, t, i) {
  42521. xe.FSStream || (xe.FSStream = function() {}, xe.FSStream.prototype = {}, Object
  42522. .defineProperties(xe.FSStream.prototype, {
  42523. object: {
  42524. get: function() {
  42525. return this.node
  42526. },
  42527. set: function(e) {
  42528. this.node = e
  42529. }
  42530. },
  42531. isRead: {
  42532. get: function() {
  42533. return 1 != (2097155 & this.flags)
  42534. }
  42535. },
  42536. isWrite: {
  42537. get: function() {
  42538. return 0 != (2097155 & this.flags)
  42539. }
  42540. },
  42541. isAppend: {
  42542. get: function() {
  42543. return 1024 & this.flags
  42544. }
  42545. }
  42546. }));
  42547. var r = new xe.FSStream;
  42548. for (var n in e) r[n] = e[n];
  42549. e = r;
  42550. var a = xe.nextfd(t, i);
  42551. return e.fd = a, xe.streams[a] = e, e
  42552. },
  42553. closeStream: function(e) {
  42554. xe.streams[e] = null
  42555. },
  42556. chrdev_stream_ops: {
  42557. open: function(e) {
  42558. var t = xe.getDevice(e.node.rdev);
  42559. e.stream_ops = t.stream_ops, e.stream_ops.open && e.stream_ops.open(e)
  42560. },
  42561. llseek: function() {
  42562. throw new xe.ErrnoError(70)
  42563. }
  42564. },
  42565. major: function(e) {
  42566. return e >> 8
  42567. },
  42568. minor: function(e) {
  42569. return 255 & e
  42570. },
  42571. makedev: function(e, t) {
  42572. return e << 8 | t
  42573. },
  42574. registerDevice: function(e, t) {
  42575. xe.devices[e] = {
  42576. stream_ops: t
  42577. }
  42578. },
  42579. getDevice: function(e) {
  42580. return xe.devices[e]
  42581. },
  42582. getMounts: function(e) {
  42583. for (var t = [], i = [e]; i.length;) {
  42584. var r = i.pop();
  42585. t.push(r), i.push.apply(i, r.mounts)
  42586. }
  42587. return t
  42588. },
  42589. syncfs: function(e, t) {
  42590. "function" == typeof e && (t = e, e = !1), xe.syncFSRequests++, xe.syncFSRequests > 1 &&
  42591. console.log("warning: " + xe.syncFSRequests +
  42592. " FS.syncfs operations in flight at once, probably just doing extra work");
  42593. var i = xe.getMounts(xe.root.mount),
  42594. r = 0;
  42595. function n(e) {
  42596. return I(xe.syncFSRequests > 0), xe.syncFSRequests--, t(e)
  42597. }
  42598. function a(e) {
  42599. if (e) return a.errored ? void 0 : (a.errored = !0, n(e));
  42600. ++r >= i.length && n(null)
  42601. }
  42602. i.forEach(function(t) {
  42603. if (!t.type.syncfs) return a(null);
  42604. t.type.syncfs(t, e, a)
  42605. })
  42606. },
  42607. mount: function(e, t, i) {
  42608. if ("string" == typeof e) throw e;
  42609. var r, n = "/" === i,
  42610. a = !i;
  42611. if (n && xe.root) throw new xe.ErrnoError(10);
  42612. if (!n && !a) {
  42613. var s = xe.lookupPath(i, {
  42614. follow_mount: !1
  42615. });
  42616. if (i = s.path, r = s.node, xe.isMountpoint(r)) throw new xe.ErrnoError(10);
  42617. if (!xe.isDir(r.mode)) throw new xe.ErrnoError(54)
  42618. }
  42619. var o = {
  42620. type: e,
  42621. opts: t,
  42622. mountpoint: i,
  42623. mounts: []
  42624. },
  42625. u = e.mount(o);
  42626. return u.mount = o, o.root = u, n ? xe.root = u : r && (r.mounted = o, r.mount && r.mount
  42627. .mounts.push(o)), u
  42628. },
  42629. unmount: function(e) {
  42630. var t = xe.lookupPath(e, {
  42631. follow_mount: !1
  42632. });
  42633. if (!xe.isMountpoint(t.node)) throw new xe.ErrnoError(28);
  42634. var i = t.node,
  42635. r = i.mounted,
  42636. n = xe.getMounts(r);
  42637. Object.keys(xe.nameTable).forEach(function(e) {
  42638. for (var t = xe.nameTable[e]; t;) {
  42639. var i = t.name_next; - 1 !== n.indexOf(t.mount) && xe.destroyNode(t), t = i
  42640. }
  42641. }), i.mounted = null;
  42642. var a = i.mount.mounts.indexOf(r);
  42643. I(-1 !== a), i.mount.mounts.splice(a, 1)
  42644. },
  42645. lookup: function(e, t) {
  42646. return e.node_ops.lookup(e, t)
  42647. },
  42648. mknod: function(e, t, i) {
  42649. var r = xe.lookupPath(e, {
  42650. parent: !0
  42651. }).node,
  42652. n = Me.basename(e);
  42653. if (!n || "." === n || ".." === n) throw new xe.ErrnoError(28);
  42654. var a = xe.mayCreate(r, n);
  42655. if (a) throw new xe.ErrnoError(a);
  42656. if (!r.node_ops.mknod) throw new xe.ErrnoError(63);
  42657. return r.node_ops.mknod(r, n, t, i)
  42658. },
  42659. create: function(e, t) {
  42660. return t = void 0 !== t ? t : 438, t &= 4095, t |= 32768, xe.mknod(e, t, 0)
  42661. },
  42662. mkdir: function(e, t) {
  42663. return t = void 0 !== t ? t : 511, t &= 1023, t |= 16384, xe.mknod(e, t, 0)
  42664. },
  42665. mkdirTree: function(e, t) {
  42666. for (var i = e.split("/"), r = "", n = 0; n < i.length; ++n)
  42667. if (i[n]) {
  42668. r += "/" + i[n];
  42669. try {
  42670. xe.mkdir(r, t)
  42671. } catch (e) {
  42672. if (20 != e.errno) throw e
  42673. }
  42674. }
  42675. },
  42676. mkdev: function(e, t, i) {
  42677. return void 0 === i && (i = t, t = 438), t |= 8192, xe.mknod(e, t, i)
  42678. },
  42679. symlink: function(e, t) {
  42680. if (!Oe.resolve(e)) throw new xe.ErrnoError(44);
  42681. var i = xe.lookupPath(t, {
  42682. parent: !0
  42683. }).node;
  42684. if (!i) throw new xe.ErrnoError(44);
  42685. var r = Me.basename(t),
  42686. n = xe.mayCreate(i, r);
  42687. if (n) throw new xe.ErrnoError(n);
  42688. if (!i.node_ops.symlink) throw new xe.ErrnoError(63);
  42689. return i.node_ops.symlink(i, r, e)
  42690. },
  42691. rename: function(e, t) {
  42692. var i, r, n = Me.dirname(e),
  42693. a = Me.dirname(t),
  42694. s = Me.basename(e),
  42695. o = Me.basename(t);
  42696. try {
  42697. i = xe.lookupPath(e, {
  42698. parent: !0
  42699. }).node, r = xe.lookupPath(t, {
  42700. parent: !0
  42701. }).node
  42702. } catch (e) {
  42703. throw new xe.ErrnoError(10)
  42704. }
  42705. if (!i || !r) throw new xe.ErrnoError(44);
  42706. if (i.mount !== r.mount) throw new xe.ErrnoError(75);
  42707. var u, l = xe.lookupNode(i, s),
  42708. d = Oe.relative(e, a);
  42709. if ("." !== d.charAt(0)) throw new xe.ErrnoError(28);
  42710. if ("." !== (d = Oe.relative(t, n)).charAt(0)) throw new xe.ErrnoError(55);
  42711. try {
  42712. u = xe.lookupNode(r, o)
  42713. } catch (e) {}
  42714. if (l !== u) {
  42715. var c = xe.isDir(l.mode),
  42716. h = xe.mayDelete(i, s, c);
  42717. if (h) throw new xe.ErrnoError(h);
  42718. if (h = u ? xe.mayDelete(r, o, c) : xe.mayCreate(r, o)) throw new xe.ErrnoError(h);
  42719. if (!i.node_ops.rename) throw new xe.ErrnoError(63);
  42720. if (xe.isMountpoint(l) || u && xe.isMountpoint(u)) throw new xe.ErrnoError(10);
  42721. if (r !== i && (h = xe.nodePermissions(i, "w"))) throw new xe.ErrnoError(h);
  42722. try {
  42723. xe.trackingDelegate.willMovePath && xe.trackingDelegate.willMovePath(e, t)
  42724. } catch (i) {
  42725. console.log("FS.trackingDelegate['willMovePath']('" + e + "', '" + t +
  42726. "') threw an exception: " + i.message)
  42727. }
  42728. xe.hashRemoveNode(l);
  42729. try {
  42730. i.node_ops.rename(l, r, o)
  42731. } catch (e) {
  42732. throw e
  42733. } finally {
  42734. xe.hashAddNode(l)
  42735. }
  42736. try {
  42737. xe.trackingDelegate.onMovePath && xe.trackingDelegate.onMovePath(e, t)
  42738. } catch (i) {
  42739. console.log("FS.trackingDelegate['onMovePath']('" + e + "', '" + t +
  42740. "') threw an exception: " + i.message)
  42741. }
  42742. }
  42743. },
  42744. rmdir: function(e) {
  42745. var t = xe.lookupPath(e, {
  42746. parent: !0
  42747. }).node,
  42748. i = Me.basename(e),
  42749. r = xe.lookupNode(t, i),
  42750. n = xe.mayDelete(t, i, !0);
  42751. if (n) throw new xe.ErrnoError(n);
  42752. if (!t.node_ops.rmdir) throw new xe.ErrnoError(63);
  42753. if (xe.isMountpoint(r)) throw new xe.ErrnoError(10);
  42754. try {
  42755. xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e)
  42756. } catch (t) {
  42757. console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t
  42758. .message)
  42759. }
  42760. t.node_ops.rmdir(t, i), xe.destroyNode(r);
  42761. try {
  42762. xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e)
  42763. } catch (t) {
  42764. console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t
  42765. .message)
  42766. }
  42767. },
  42768. readdir: function(e) {
  42769. var t = xe.lookupPath(e, {
  42770. follow: !0
  42771. }).node;
  42772. if (!t.node_ops.readdir) throw new xe.ErrnoError(54);
  42773. return t.node_ops.readdir(t)
  42774. },
  42775. unlink: function(e) {
  42776. var t = xe.lookupPath(e, {
  42777. parent: !0
  42778. }).node,
  42779. i = Me.basename(e),
  42780. r = xe.lookupNode(t, i),
  42781. n = xe.mayDelete(t, i, !1);
  42782. if (n) throw new xe.ErrnoError(n);
  42783. if (!t.node_ops.unlink) throw new xe.ErrnoError(63);
  42784. if (xe.isMountpoint(r)) throw new xe.ErrnoError(10);
  42785. try {
  42786. xe.trackingDelegate.willDeletePath && xe.trackingDelegate.willDeletePath(e)
  42787. } catch (t) {
  42788. console.log("FS.trackingDelegate['willDeletePath']('" + e + "') threw an exception: " + t
  42789. .message)
  42790. }
  42791. t.node_ops.unlink(t, i), xe.destroyNode(r);
  42792. try {
  42793. xe.trackingDelegate.onDeletePath && xe.trackingDelegate.onDeletePath(e)
  42794. } catch (t) {
  42795. console.log("FS.trackingDelegate['onDeletePath']('" + e + "') threw an exception: " + t
  42796. .message)
  42797. }
  42798. },
  42799. readlink: function(e) {
  42800. var t = xe.lookupPath(e).node;
  42801. if (!t) throw new xe.ErrnoError(44);
  42802. if (!t.node_ops.readlink) throw new xe.ErrnoError(28);
  42803. return Oe.resolve(xe.getPath(t.parent), t.node_ops.readlink(t))
  42804. },
  42805. stat: function(e, t) {
  42806. var i = xe.lookupPath(e, {
  42807. follow: !t
  42808. }).node;
  42809. if (!i) throw new xe.ErrnoError(44);
  42810. if (!i.node_ops.getattr) throw new xe.ErrnoError(63);
  42811. return i.node_ops.getattr(i)
  42812. },
  42813. lstat: function(e) {
  42814. return xe.stat(e, !0)
  42815. },
  42816. chmod: function(e, t, i) {
  42817. var r;
  42818. if (!(r = "string" == typeof e ? xe.lookupPath(e, {
  42819. follow: !i
  42820. }).node : e).node_ops.setattr) throw new xe.ErrnoError(63);
  42821. r.node_ops.setattr(r, {
  42822. mode: 4095 & t | -4096 & r.mode,
  42823. timestamp: Date.now()
  42824. })
  42825. },
  42826. lchmod: function(e, t) {
  42827. xe.chmod(e, t, !0)
  42828. },
  42829. fchmod: function(e, t) {
  42830. var i = xe.getStream(e);
  42831. if (!i) throw new xe.ErrnoError(8);
  42832. xe.chmod(i.node, t)
  42833. },
  42834. chown: function(e, t, i, r) {
  42835. var n;
  42836. if (!(n = "string" == typeof e ? xe.lookupPath(e, {
  42837. follow: !r
  42838. }).node : e).node_ops.setattr) throw new xe.ErrnoError(63);
  42839. n.node_ops.setattr(n, {
  42840. timestamp: Date.now()
  42841. })
  42842. },
  42843. lchown: function(e, t, i) {
  42844. xe.chown(e, t, i, !0)
  42845. },
  42846. fchown: function(e, t, i) {
  42847. var r = xe.getStream(e);
  42848. if (!r) throw new xe.ErrnoError(8);
  42849. xe.chown(r.node, t, i)
  42850. },
  42851. truncate: function(e, t) {
  42852. if (t < 0) throw new xe.ErrnoError(28);
  42853. var i;
  42854. if (!(i = "string" == typeof e ? xe.lookupPath(e, {
  42855. follow: !0
  42856. }).node : e).node_ops.setattr) throw new xe.ErrnoError(63);
  42857. if (xe.isDir(i.mode)) throw new xe.ErrnoError(31);
  42858. if (!xe.isFile(i.mode)) throw new xe.ErrnoError(28);
  42859. var r = xe.nodePermissions(i, "w");
  42860. if (r) throw new xe.ErrnoError(r);
  42861. i.node_ops.setattr(i, {
  42862. size: t,
  42863. timestamp: Date.now()
  42864. })
  42865. },
  42866. ftruncate: function(e, t) {
  42867. var i = xe.getStream(e);
  42868. if (!i) throw new xe.ErrnoError(8);
  42869. if (0 == (2097155 & i.flags)) throw new xe.ErrnoError(28);
  42870. xe.truncate(i.node, t)
  42871. },
  42872. utime: function(e, t, i) {
  42873. var r = xe.lookupPath(e, {
  42874. follow: !0
  42875. }).node;
  42876. r.node_ops.setattr(r, {
  42877. timestamp: Math.max(t, i)
  42878. })
  42879. },
  42880. open: function(e, t, i, r, n) {
  42881. if ("" === e) throw new xe.ErrnoError(44);
  42882. var a;
  42883. if (i = void 0 === i ? 438 : i, i = 64 & (t = "string" == typeof t ? xe.modeStringToFlags(t) :
  42884. t) ? 4095 & i | 32768 : 0, "object" == typeof e) a = e;
  42885. else {
  42886. e = Me.normalize(e);
  42887. try {
  42888. a = xe.lookupPath(e, {
  42889. follow: !(131072 & t)
  42890. }).node
  42891. } catch (e) {}
  42892. }
  42893. var s = !1;
  42894. if (64 & t)
  42895. if (a) {
  42896. if (128 & t) throw new xe.ErrnoError(20)
  42897. } else a = xe.mknod(e, i, 0), s = !0;
  42898. if (!a) throw new xe.ErrnoError(44);
  42899. if (xe.isChrdev(a.mode) && (t &= -513), 65536 & t && !xe.isDir(a.mode)) throw new xe
  42900. .ErrnoError(54);
  42901. if (!s) {
  42902. var o = xe.mayOpen(a, t);
  42903. if (o) throw new xe.ErrnoError(o)
  42904. }
  42905. 512 & t && xe.truncate(a, 0), t &= -641;
  42906. var u = xe.createStream({
  42907. node: a,
  42908. path: xe.getPath(a),
  42909. flags: t,
  42910. seekable: !0,
  42911. position: 0,
  42912. stream_ops: a.stream_ops,
  42913. ungotten: [],
  42914. error: !1
  42915. }, r, n);
  42916. u.stream_ops.open && u.stream_ops.open(u), !d.logReadFiles || 1 & t || (xe.readFiles || (xe
  42917. .readFiles = {}), e in xe.readFiles || (xe.readFiles[e] = 1, console.log(
  42918. "FS.trackingDelegate error on read file: " + e)));
  42919. try {
  42920. if (xe.trackingDelegate.onOpenFile) {
  42921. var l = 0;
  42922. 1 != (2097155 & t) && (l |= xe.tracking.openFlags.READ), 0 != (2097155 & t) && (l |= xe
  42923. .tracking.openFlags.WRITE), xe.trackingDelegate.onOpenFile(e, l)
  42924. }
  42925. } catch (t) {
  42926. console.log("FS.trackingDelegate['onOpenFile']('" + e + "', flags) threw an exception: " + t
  42927. .message)
  42928. }
  42929. return u
  42930. },
  42931. close: function(e) {
  42932. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  42933. e.getdents && (e.getdents = null);
  42934. try {
  42935. e.stream_ops.close && e.stream_ops.close(e)
  42936. } catch (e) {
  42937. throw e
  42938. } finally {
  42939. xe.closeStream(e.fd)
  42940. }
  42941. e.fd = null
  42942. },
  42943. isClosed: function(e) {
  42944. return null === e.fd
  42945. },
  42946. llseek: function(e, t, i) {
  42947. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  42948. if (!e.seekable || !e.stream_ops.llseek) throw new xe.ErrnoError(70);
  42949. if (0 != i && 1 != i && 2 != i) throw new xe.ErrnoError(28);
  42950. return e.position = e.stream_ops.llseek(e, t, i), e.ungotten = [], e.position
  42951. },
  42952. read: function(e, t, i, r, n) {
  42953. if (r < 0 || n < 0) throw new xe.ErrnoError(28);
  42954. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  42955. if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(8);
  42956. if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31);
  42957. if (!e.stream_ops.read) throw new xe.ErrnoError(28);
  42958. var a = void 0 !== n;
  42959. if (a) {
  42960. if (!e.seekable) throw new xe.ErrnoError(70)
  42961. } else n = e.position;
  42962. var s = e.stream_ops.read(e, t, i, r, n);
  42963. return a || (e.position += s), s
  42964. },
  42965. write: function(e, t, i, r, n, a) {
  42966. if (r < 0 || n < 0) throw new xe.ErrnoError(28);
  42967. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  42968. if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8);
  42969. if (xe.isDir(e.node.mode)) throw new xe.ErrnoError(31);
  42970. if (!e.stream_ops.write) throw new xe.ErrnoError(28);
  42971. 1024 & e.flags && xe.llseek(e, 0, 2);
  42972. var s = void 0 !== n;
  42973. if (s) {
  42974. if (!e.seekable) throw new xe.ErrnoError(70)
  42975. } else n = e.position;
  42976. var o = e.stream_ops.write(e, t, i, r, n, a);
  42977. s || (e.position += o);
  42978. try {
  42979. e.path && xe.trackingDelegate.onWriteToFile && xe.trackingDelegate.onWriteToFile(e.path)
  42980. } catch (t) {
  42981. console.log("FS.trackingDelegate['onWriteToFile']('" + e.path + "') threw an exception: " +
  42982. t.message)
  42983. }
  42984. return o
  42985. },
  42986. allocate: function(e, t, i) {
  42987. if (xe.isClosed(e)) throw new xe.ErrnoError(8);
  42988. if (t < 0 || i <= 0) throw new xe.ErrnoError(28);
  42989. if (0 == (2097155 & e.flags)) throw new xe.ErrnoError(8);
  42990. if (!xe.isFile(e.node.mode) && !xe.isDir(e.node.mode)) throw new xe.ErrnoError(43);
  42991. if (!e.stream_ops.allocate) throw new xe.ErrnoError(138);
  42992. e.stream_ops.allocate(e, t, i)
  42993. },
  42994. mmap: function(e, t, i, r, n, a, s) {
  42995. if (0 != (2 & a) && 0 == (2 & s) && 2 != (2097155 & e.flags)) throw new xe.ErrnoError(2);
  42996. if (1 == (2097155 & e.flags)) throw new xe.ErrnoError(2);
  42997. if (!e.stream_ops.mmap) throw new xe.ErrnoError(43);
  42998. return e.stream_ops.mmap(e, t, i, r, n, a, s)
  42999. },
  43000. msync: function(e, t, i, r, n) {
  43001. return e && e.stream_ops.msync ? e.stream_ops.msync(e, t, i, r, n) : 0
  43002. },
  43003. munmap: function(e) {
  43004. return 0
  43005. },
  43006. ioctl: function(e, t, i) {
  43007. if (!e.stream_ops.ioctl) throw new xe.ErrnoError(59);
  43008. return e.stream_ops.ioctl(e, t, i)
  43009. },
  43010. readFile: function(e, t) {
  43011. if ((t = t || {}).flags = t.flags || "r", t.encoding = t.encoding || "binary", "utf8" !== t
  43012. .encoding && "binary" !== t.encoding) throw new Error('Invalid encoding type "' + t
  43013. .encoding + '"');
  43014. var i, r = xe.open(e, t.flags),
  43015. n = xe.stat(e).size,
  43016. a = new Uint8Array(n);
  43017. return xe.read(r, a, 0, n, 0), "utf8" === t.encoding ? i = U(a, 0) : "binary" === t
  43018. .encoding && (i = a), xe.close(r), i
  43019. },
  43020. writeFile: function(e, t, i) {
  43021. (i = i || {}).flags = i.flags || "w";
  43022. var r = xe.open(e, i.flags, i.mode);
  43023. if ("string" == typeof t) {
  43024. var n = new Uint8Array(j(t) + 1),
  43025. a = B(t, n, 0, n.length);
  43026. xe.write(r, n, 0, a, void 0, i.canOwn)
  43027. } else {
  43028. if (!ArrayBuffer.isView(t)) throw new Error("Unsupported data type");
  43029. xe.write(r, t, 0, t.byteLength, void 0, i.canOwn)
  43030. }
  43031. xe.close(r)
  43032. },
  43033. cwd: function() {
  43034. return xe.currentPath
  43035. },
  43036. chdir: function(e) {
  43037. var t = xe.lookupPath(e, {
  43038. follow: !0
  43039. });
  43040. if (null === t.node) throw new xe.ErrnoError(44);
  43041. if (!xe.isDir(t.node.mode)) throw new xe.ErrnoError(54);
  43042. var i = xe.nodePermissions(t.node, "x");
  43043. if (i) throw new xe.ErrnoError(i);
  43044. xe.currentPath = t.path
  43045. },
  43046. createDefaultDirectories: function() {
  43047. xe.mkdir("/tmp"), xe.mkdir("/home"), xe.mkdir("/home/web_user")
  43048. },
  43049. createDefaultDevices: function() {
  43050. var e;
  43051. if (xe.mkdir("/dev"), xe.registerDevice(xe.makedev(1, 3), {
  43052. read: function() {
  43053. return 0
  43054. },
  43055. write: function(e, t, i, r, n) {
  43056. return r
  43057. }
  43058. }), xe.mkdev("/dev/null", xe.makedev(1, 3)), Ce.register(xe.makedev(5, 0), Ce
  43059. .default_tty_ops), Ce.register(xe.makedev(6, 0), Ce.default_tty1_ops), xe.mkdev(
  43060. "/dev/tty", xe.makedev(5, 0)), xe.mkdev("/dev/tty1", xe.makedev(6, 0)), "object" ==
  43061. typeof crypto && "function" == typeof crypto.getRandomValues) {
  43062. var t = new Uint8Array(1);
  43063. e = function() {
  43064. return crypto.getRandomValues(t), t[0]
  43065. }
  43066. } else if (u) try {
  43067. var r = i(71);
  43068. e = function() {
  43069. return r.randomBytes(1)[0]
  43070. }
  43071. } catch (e) {}
  43072. e || (e = function() {
  43073. ve(
  43074. "no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")
  43075. }), xe.createDevice("/dev", "random", e), xe.createDevice("/dev", "urandom", e), xe.mkdir(
  43076. "/dev/shm"), xe.mkdir("/dev/shm/tmp")
  43077. },
  43078. createSpecialDirectories: function() {
  43079. xe.mkdir("/proc"), xe.mkdir("/proc/self"), xe.mkdir("/proc/self/fd"), xe.mount({
  43080. mount: function() {
  43081. var e = xe.createNode("/proc/self", "fd", 16895, 73);
  43082. return e.node_ops = {
  43083. lookup: function(e, t) {
  43084. var i = +t,
  43085. r = xe.getStream(i);
  43086. if (!r) throw new xe.ErrnoError(8);
  43087. var n = {
  43088. parent: null,
  43089. mount: {
  43090. mountpoint: "fake"
  43091. },
  43092. node_ops: {
  43093. readlink: function() {
  43094. return r.path
  43095. }
  43096. }
  43097. };
  43098. return n.parent = n, n
  43099. }
  43100. }, e
  43101. }
  43102. }, {}, "/proc/self/fd")
  43103. },
  43104. createStandardStreams: function() {
  43105. d.stdin ? xe.createDevice("/dev", "stdin", d.stdin) : xe.symlink("/dev/tty", "/dev/stdin"), d
  43106. .stdout ? xe.createDevice("/dev", "stdout", null, d.stdout) : xe.symlink("/dev/tty",
  43107. "/dev/stdout"), d.stderr ? xe.createDevice("/dev", "stderr", null, d.stderr) : xe.symlink(
  43108. "/dev/tty1", "/dev/stderr");
  43109. var e = xe.open("/dev/stdin", "r"),
  43110. t = xe.open("/dev/stdout", "w"),
  43111. i = xe.open("/dev/stderr", "w");
  43112. I(0 === e.fd, "invalid handle for stdin (" + e.fd + ")"), I(1 === t.fd,
  43113. "invalid handle for stdout (" + t.fd + ")"), I(2 === i.fd, "invalid handle for stderr (" +
  43114. i.fd + ")")
  43115. },
  43116. ensureErrnoError: function() {
  43117. xe.ErrnoError || (xe.ErrnoError = function(e, t) {
  43118. this.node = t, this.setErrno = function(e) {
  43119. for (var t in this.errno = e, Le)
  43120. if (Le[t] === e) {
  43121. this.code = t;
  43122. break
  43123. }
  43124. }, this.setErrno(e), this.message = Ie[e], this.stack && (Object.defineProperty(this,
  43125. "stack", {
  43126. value: (new Error).stack,
  43127. writable: !0
  43128. }), this.stack = Se(this.stack))
  43129. }, xe.ErrnoError.prototype = new Error, xe.ErrnoError.prototype.constructor = xe
  43130. .ErrnoError, [44].forEach(function(e) {
  43131. xe.genericErrors[e] = new xe.ErrnoError(e), xe.genericErrors[e].stack =
  43132. "<generic error, no stack>"
  43133. }))
  43134. },
  43135. staticInit: function() {
  43136. xe.ensureErrnoError(), xe.nameTable = new Array(4096), xe.mount(De, {}, "/"), xe
  43137. .createDefaultDirectories(), xe.createDefaultDevices(), xe.createSpecialDirectories(), xe
  43138. .filesystems = {
  43139. MEMFS: De
  43140. }
  43141. },
  43142. init: function(e, t, i) {
  43143. I(!xe.init.initialized,
  43144. "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"
  43145. ), xe.init.initialized = !0, xe.ensureErrnoError(), d.stdin = e || d.stdin, d.stdout =
  43146. t || d.stdout, d.stderr = i || d.stderr, xe.createStandardStreams()
  43147. },
  43148. quit: function() {
  43149. xe.init.initialized = !1;
  43150. var e = d._fflush;
  43151. e && e(0);
  43152. for (var t = 0; t < xe.streams.length; t++) {
  43153. var i = xe.streams[t];
  43154. i && xe.close(i)
  43155. }
  43156. },
  43157. getMode: function(e, t) {
  43158. var i = 0;
  43159. return e && (i |= 365), t && (i |= 146), i
  43160. },
  43161. joinPath: function(e, t) {
  43162. var i = Me.join.apply(null, e);
  43163. return t && "/" == i[0] && (i = i.substr(1)), i
  43164. },
  43165. absolutePath: function(e, t) {
  43166. return Oe.resolve(t, e)
  43167. },
  43168. standardizePath: function(e) {
  43169. return Me.normalize(e)
  43170. },
  43171. findObject: function(e, t) {
  43172. var i = xe.analyzePath(e, t);
  43173. return i.exists ? i.object : (Re(i.error), null)
  43174. },
  43175. analyzePath: function(e, t) {
  43176. try {
  43177. e = (r = xe.lookupPath(e, {
  43178. follow: !t
  43179. })).path
  43180. } catch (e) {}
  43181. var i = {
  43182. isRoot: !1,
  43183. exists: !1,
  43184. error: 0,
  43185. name: null,
  43186. path: null,
  43187. object: null,
  43188. parentExists: !1,
  43189. parentPath: null,
  43190. parentObject: null
  43191. };
  43192. try {
  43193. var r = xe.lookupPath(e, {
  43194. parent: !0
  43195. });
  43196. i.parentExists = !0, i.parentPath = r.path, i.parentObject = r.node, i.name = Me.basename(
  43197. e), r = xe.lookupPath(e, {
  43198. follow: !t
  43199. }), i.exists = !0, i.path = r.path, i.object = r.node, i.name = r.node.name, i.isRoot =
  43200. "/" === r.path
  43201. } catch (e) {
  43202. i.error = e.errno
  43203. }
  43204. return i
  43205. },
  43206. createFolder: function(e, t, i, r) {
  43207. var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t),
  43208. a = xe.getMode(i, r);
  43209. return xe.mkdir(n, a)
  43210. },
  43211. createPath: function(e, t, i, r) {
  43212. e = "string" == typeof e ? e : xe.getPath(e);
  43213. for (var n = t.split("/").reverse(); n.length;) {
  43214. var a = n.pop();
  43215. if (a) {
  43216. var s = Me.join2(e, a);
  43217. try {
  43218. xe.mkdir(s)
  43219. } catch (e) {}
  43220. e = s
  43221. }
  43222. }
  43223. return s
  43224. },
  43225. createFile: function(e, t, i, r, n) {
  43226. var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t),
  43227. s = xe.getMode(r, n);
  43228. return xe.create(a, s)
  43229. },
  43230. createDataFile: function(e, t, i, r, n, a) {
  43231. var s = t ? Me.join2("string" == typeof e ? e : xe.getPath(e), t) : e,
  43232. o = xe.getMode(r, n),
  43233. u = xe.create(s, o);
  43234. if (i) {
  43235. if ("string" == typeof i) {
  43236. for (var l = new Array(i.length), d = 0, c = i.length; d < c; ++d) l[d] = i.charCodeAt(d);
  43237. i = l
  43238. }
  43239. xe.chmod(u, 146 | o);
  43240. var h = xe.open(u, "w");
  43241. xe.write(h, i, 0, i.length, 0, a), xe.close(h), xe.chmod(u, o)
  43242. }
  43243. return u
  43244. },
  43245. createDevice: function(e, t, i, r) {
  43246. var n = Me.join2("string" == typeof e ? e : xe.getPath(e), t),
  43247. a = xe.getMode(!!i, !!r);
  43248. xe.createDevice.major || (xe.createDevice.major = 64);
  43249. var s = xe.makedev(xe.createDevice.major++, 0);
  43250. return xe.registerDevice(s, {
  43251. open: function(e) {
  43252. e.seekable = !1
  43253. },
  43254. close: function(e) {
  43255. r && r.buffer && r.buffer.length && r(10)
  43256. },
  43257. read: function(e, t, r, n, a) {
  43258. for (var s = 0, o = 0; o < n; o++) {
  43259. var u;
  43260. try {
  43261. u = i()
  43262. } catch (e) {
  43263. throw new xe.ErrnoError(29)
  43264. }
  43265. if (void 0 === u && 0 === s) throw new xe.ErrnoError(6);
  43266. if (null == u) break;
  43267. s++, t[r + o] = u
  43268. }
  43269. return s && (e.node.timestamp = Date.now()), s
  43270. },
  43271. write: function(e, t, i, n, a) {
  43272. for (var s = 0; s < n; s++) try {
  43273. r(t[i + s])
  43274. } catch (e) {
  43275. throw new xe.ErrnoError(29)
  43276. }
  43277. return n && (e.node.timestamp = Date.now()), s
  43278. }
  43279. }), xe.mkdev(n, a, s)
  43280. },
  43281. createLink: function(e, t, i, r, n) {
  43282. var a = Me.join2("string" == typeof e ? e : xe.getPath(e), t);
  43283. return xe.symlink(i, a)
  43284. },
  43285. forceLoadFile: function(e) {
  43286. if (e.isDevice || e.isFolder || e.link || e.contents) return !0;
  43287. var t = !0;
  43288. if ("undefined" != typeof XMLHttpRequest) throw new Error(
  43289. "Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread."
  43290. );
  43291. if (!y) throw new Error("Cannot load without read() or XMLHttpRequest.");
  43292. try {
  43293. e.contents = Be(y(e.url), !0), e.usedBytes = e.contents.length
  43294. } catch (e) {
  43295. t = !1
  43296. }
  43297. return t || Re(29), t
  43298. },
  43299. createLazyFile: function(e, t, i, r, n) {
  43300. function a() {
  43301. this.lengthKnown = !1, this.chunks = []
  43302. }
  43303. if (a.prototype.get = function(e) {
  43304. if (!(e > this.length - 1 || e < 0)) {
  43305. var t = e % this.chunkSize,
  43306. i = e / this.chunkSize | 0;
  43307. return this.getter(i)[t]
  43308. }
  43309. }, a.prototype.setDataGetter = function(e) {
  43310. this.getter = e
  43311. }, a.prototype.cacheLength = function() {
  43312. var e = new XMLHttpRequest;
  43313. if (e.open("HEAD", i, !1), e.send(null), !(e.status >= 200 && e.status < 300 || 304 === e
  43314. .status)) throw new Error("Couldn't load " + i + ". Status: " + e.status);
  43315. var t, r = Number(e.getResponseHeader("Content-length")),
  43316. n = (t = e.getResponseHeader("Accept-Ranges")) && "bytes" === t,
  43317. a = (t = e.getResponseHeader("Content-Encoding")) && "gzip" === t,
  43318. s = 1048576;
  43319. n || (s = r);
  43320. var o = this;
  43321. o.setDataGetter(function(e) {
  43322. var t = e * s,
  43323. n = (e + 1) * s - 1;
  43324. if (n = Math.min(n, r - 1), void 0 === o.chunks[e] && (o.chunks[e] = function(e,
  43325. t) {
  43326. if (e > t) throw new Error("invalid range (" + e + ", " + t +
  43327. ") or no bytes requested!");
  43328. if (t > r - 1) throw new Error("only " + r +
  43329. " bytes available! programmer error!");
  43330. var n = new XMLHttpRequest;
  43331. if (n.open("GET", i, !1), r !== s && n.setRequestHeader("Range", "bytes=" +
  43332. e + "-" + t), "undefined" != typeof Uint8Array && (n.responseType =
  43333. "arraybuffer"), n.overrideMimeType && n.overrideMimeType(
  43334. "text/plain; charset=x-user-defined"), n.send(null), !(n.status >= 200 &&
  43335. n.status < 300 || 304 === n.status)) throw new Error("Couldn't load " +
  43336. i + ". Status: " + n.status);
  43337. return void 0 !== n.response ? new Uint8Array(n.response || []) : Be(n
  43338. .responseText || "", !0)
  43339. }(t, n)), void 0 === o.chunks[e]) throw new Error("doXHR failed!");
  43340. return o.chunks[e]
  43341. }), !a && r || (s = r = 1, r = this.getter(0).length, s = r, console.log(
  43342. "LazyFiles on gzip forces download of the whole file when length is accessed")), this
  43343. ._length = r, this._chunkSize = s, this.lengthKnown = !0
  43344. }, "undefined" != typeof XMLHttpRequest) {
  43345. if (!v)
  43346. throw "Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";
  43347. var s = new a;
  43348. Object.defineProperties(s, {
  43349. length: {
  43350. get: function() {
  43351. return this.lengthKnown || this.cacheLength(), this._length
  43352. }
  43353. },
  43354. chunkSize: {
  43355. get: function() {
  43356. return this.lengthKnown || this.cacheLength(), this._chunkSize
  43357. }
  43358. }
  43359. });
  43360. var o = {
  43361. isDevice: !1,
  43362. contents: s
  43363. }
  43364. } else o = {
  43365. isDevice: !1,
  43366. url: i
  43367. };
  43368. var u = xe.createFile(e, t, o, r, n);
  43369. o.contents ? u.contents = o.contents : o.url && (u.contents = null, u.url = o.url), Object
  43370. .defineProperties(u, {
  43371. usedBytes: {
  43372. get: function() {
  43373. return this.contents.length
  43374. }
  43375. }
  43376. });
  43377. var l = {};
  43378. return Object.keys(u.stream_ops).forEach(function(e) {
  43379. var t = u.stream_ops[e];
  43380. l[e] = function() {
  43381. if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29);
  43382. return t.apply(null, arguments)
  43383. }
  43384. }), l.read = function(e, t, i, r, n) {
  43385. if (!xe.forceLoadFile(u)) throw new xe.ErrnoError(29);
  43386. var a = e.node.contents;
  43387. if (n >= a.length) return 0;
  43388. var s = Math.min(a.length - n, r);
  43389. if (I(s >= 0), a.slice)
  43390. for (var o = 0; o < s; o++) t[i + o] = a[n + o];
  43391. else
  43392. for (o = 0; o < s; o++) t[i + o] = a.get(n + o);
  43393. return s
  43394. }, u.stream_ops = l, u
  43395. },
  43396. createPreloadedFile: function(e, t, i, r, n, a, s, o, u, l) {
  43397. Browser.init();
  43398. var c = t ? Oe.resolve(Me.join2(e, t)) : e,
  43399. h = function(e) {
  43400. for (var t = e;;) {
  43401. if (!pe[e]) return e;
  43402. e = t + Math.random()
  43403. }
  43404. return e
  43405. }("cp " + c);
  43406. function f(i) {
  43407. function f(i) {
  43408. l && l(), o || xe.createDataFile(e, t, i, r, n, u), a && a(), ge(h)
  43409. }
  43410. var p = !1;
  43411. d.preloadPlugins.forEach(function(e) {
  43412. p || e.canHandle(c) && (e.handle(i, c, f, function() {
  43413. s && s(), ge(h)
  43414. }), p = !0)
  43415. }), p || f(i)
  43416. }
  43417. me(h), "string" == typeof i ? Browser.asyncLoad(i, function(e) {
  43418. f(e)
  43419. }, s) : f(i)
  43420. },
  43421. indexedDB: function() {
  43422. return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB
  43423. },
  43424. DB_NAME: function() {
  43425. return "EM_FS_" + window.location.pathname
  43426. },
  43427. DB_VERSION: 20,
  43428. DB_STORE_NAME: "FILE_DATA",
  43429. saveFilesToDB: function(e, t, i) {
  43430. t = t || function() {}, i = i || function() {};
  43431. var r = xe.indexedDB();
  43432. try {
  43433. var n = r.open(xe.DB_NAME(), xe.DB_VERSION)
  43434. } catch (e) {
  43435. return i(e)
  43436. }
  43437. n.onupgradeneeded = function() {
  43438. console.log("creating db"), n.result.createObjectStore(xe.DB_STORE_NAME)
  43439. }, n.onsuccess = function() {
  43440. var r = n.result.transaction([xe.DB_STORE_NAME], "readwrite"),
  43441. a = r.objectStore(xe.DB_STORE_NAME),
  43442. s = 0,
  43443. o = 0,
  43444. u = e.length;
  43445. function l() {
  43446. 0 == o ? t() : i()
  43447. }
  43448. e.forEach(function(e) {
  43449. var t = a.put(xe.analyzePath(e).object.contents, e);
  43450. t.onsuccess = function() {
  43451. ++s + o == u && l()
  43452. }, t.onerror = function() {
  43453. s + ++o == u && l()
  43454. }
  43455. }), r.onerror = i
  43456. }, n.onerror = i
  43457. },
  43458. loadFilesFromDB: function(e, t, i) {
  43459. t = t || function() {}, i = i || function() {};
  43460. var r = xe.indexedDB();
  43461. try {
  43462. var n = r.open(xe.DB_NAME(), xe.DB_VERSION)
  43463. } catch (e) {
  43464. return i(e)
  43465. }
  43466. n.onupgradeneeded = i, n.onsuccess = function() {
  43467. var r = n.result;
  43468. try {
  43469. var a = r.transaction([xe.DB_STORE_NAME], "readonly")
  43470. } catch (e) {
  43471. return void i(e)
  43472. }
  43473. var s = a.objectStore(xe.DB_STORE_NAME),
  43474. o = 0,
  43475. u = 0,
  43476. l = e.length;
  43477. function d() {
  43478. 0 == u ? t() : i()
  43479. }
  43480. e.forEach(function(e) {
  43481. var t = s.get(e);
  43482. t.onsuccess = function() {
  43483. xe.analyzePath(e).exists && xe.unlink(e), xe.createDataFile(Me.dirname(e), Me
  43484. .basename(e), t.result, !0, !0, !0), ++o + u == l && d()
  43485. }, t.onerror = function() {
  43486. o + ++u == l && d()
  43487. }
  43488. }), a.onerror = i
  43489. }, n.onerror = i
  43490. }
  43491. },
  43492. Pe = {
  43493. DEFAULT_POLLMASK: 5,
  43494. mappings: {},
  43495. umask: 511,
  43496. calculateAt: function(e, t) {
  43497. if ("/" !== t[0]) {
  43498. var i;
  43499. if (-100 === e) i = xe.cwd();
  43500. else {
  43501. var r = xe.getStream(e);
  43502. if (!r) throw new xe.ErrnoError(8);
  43503. i = r.path
  43504. }
  43505. t = Me.join2(i, t)
  43506. }
  43507. return t
  43508. },
  43509. doStat: function(e, t, i) {
  43510. try {
  43511. var r = e(t)
  43512. } catch (e) {
  43513. if (e && e.node && Me.normalize(t) !== Me.normalize(xe.getPath(e.node))) return -54;
  43514. throw e
  43515. }
  43516. return q[i >> 2] = r.dev, q[i + 4 >> 2] = 0, q[i + 8 >> 2] = r.ino, q[i + 12 >> 2] = r.mode,
  43517. q[i + 16 >> 2] = r.nlink, q[i + 20 >> 2] = r.uid, q[i + 24 >> 2] = r.gid, q[i + 28 >> 2] = r
  43518. .rdev, q[i + 32 >> 2] = 0, we = [r.size >>> 0, (be = r.size, +oe(be) >= 1 ? be > 0 ? (0 |
  43519. de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) /
  43520. 4294967296) >>> 0 : 0)], q[i + 40 >> 2] = we[0], q[i + 44 >> 2] = we[1], q[i + 48 >> 2] =
  43521. 4096, q[i + 52 >> 2] = r.blocks, q[i + 56 >> 2] = r.atime.getTime() / 1e3 | 0, q[i + 60 >>
  43522. 2] = 0, q[i + 64 >> 2] = r.mtime.getTime() / 1e3 | 0, q[i + 68 >> 2] = 0, q[i + 72 >> 2] =
  43523. r.ctime.getTime() / 1e3 | 0, q[i + 76 >> 2] = 0, we = [r.ino >>> 0, (be = r.ino, +oe(be) >=
  43524. 1 ? be > 0 ? (0 | de(+le(be / 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>>
  43525. 0)) / 4294967296) >>> 0 : 0)], q[i + 80 >> 2] = we[0], q[i + 84 >> 2] = we[1], 0
  43526. },
  43527. doMsync: function(e, t, i, r) {
  43528. var n = new Uint8Array(V.subarray(e, e + i));
  43529. xe.msync(t, n, 0, i, r)
  43530. },
  43531. doMkdir: function(e, t) {
  43532. return "/" === (e = Me.normalize(e))[e.length - 1] && (e = e.substr(0, e.length - 1)), xe
  43533. .mkdir(e, t, 0), 0
  43534. },
  43535. doMknod: function(e, t, i) {
  43536. switch (61440 & t) {
  43537. case 32768:
  43538. case 8192:
  43539. case 24576:
  43540. case 4096:
  43541. case 49152:
  43542. break;
  43543. default:
  43544. return -28
  43545. }
  43546. return xe.mknod(e, t, i), 0
  43547. },
  43548. doReadlink: function(e, t, i) {
  43549. if (i <= 0) return -28;
  43550. var r = xe.readlink(e),
  43551. n = Math.min(i, j(r)),
  43552. a = G[t + n];
  43553. return F(r, t, i + 1), G[t + n] = a, n
  43554. },
  43555. doAccess: function(e, t) {
  43556. if (-8 & t) return -28;
  43557. var i;
  43558. if (!(i = xe.lookupPath(e, {
  43559. follow: !0
  43560. }).node)) return -44;
  43561. var r = "";
  43562. return 4 & t && (r += "r"), 2 & t && (r += "w"), 1 & t && (r += "x"), r && xe.nodePermissions(
  43563. i, r) ? -2 : 0
  43564. },
  43565. doDup: function(e, t, i) {
  43566. var r = xe.getStream(i);
  43567. return r && xe.close(r), xe.open(e, t, 0, i, i).fd
  43568. },
  43569. doReadv: function(e, t, i, r) {
  43570. for (var n = 0, a = 0; a < i; a++) {
  43571. var s = q[t + 8 * a >> 2],
  43572. o = q[t + (8 * a + 4) >> 2],
  43573. u = xe.read(e, G, s, o, r);
  43574. if (u < 0) return -1;
  43575. if (n += u, u < o) break
  43576. }
  43577. return n
  43578. },
  43579. doWritev: function(e, t, i, r) {
  43580. for (var n = 0, a = 0; a < i; a++) {
  43581. var s = q[t + 8 * a >> 2],
  43582. o = q[t + (8 * a + 4) >> 2],
  43583. u = xe.write(e, G, s, o, r);
  43584. if (u < 0) return -1;
  43585. n += u
  43586. }
  43587. return n
  43588. },
  43589. varargs: 0,
  43590. get: function(e) {
  43591. return Pe.varargs += 4, q[Pe.varargs - 4 >> 2]
  43592. },
  43593. getStr: function() {
  43594. return N(Pe.get())
  43595. },
  43596. getStreamFromFD: function(e) {
  43597. void 0 === e && (e = Pe.get());
  43598. var t = xe.getStream(e);
  43599. if (!t) throw new xe.ErrnoError(8);
  43600. return t
  43601. },
  43602. get64: function() {
  43603. var e = Pe.get(),
  43604. t = Pe.get();
  43605. return I(e >= 0 ? 0 === t : -1 === t), e
  43606. },
  43607. getZero: function() {
  43608. I(0 === Pe.get())
  43609. }
  43610. };
  43611. var Ue = {};
  43612. function Ne() {
  43613. if (!Ne.strings) {
  43614. var e = {
  43615. USER: "web_user",
  43616. LOGNAME: "web_user",
  43617. PATH: "/",
  43618. PWD: "/",
  43619. HOME: "/home/web_user",
  43620. LANG: ("object" == typeof navigator && navigator.languages && navigator.languages[0] || "C")
  43621. .replace("-", "_") + ".UTF-8",
  43622. _: p
  43623. };
  43624. for (var t in Ue) e[t] = Ue[t];
  43625. var i = [];
  43626. for (var t in e) i.push(t + "=" + e[t]);
  43627. Ne.strings = i
  43628. }
  43629. return Ne.strings
  43630. }
  43631. function Be(e, t, i) {
  43632. var r = i > 0 ? i : j(e) + 1,
  43633. n = new Array(r),
  43634. a = B(e, n, 0, n.length);
  43635. return t && (n.length = a), n
  43636. }
  43637. F("GMT", 1341232, 4), xe.staticInit();
  43638. var Fe = {
  43639. __cxa_allocate_exception: function(e) {
  43640. return ri(e)
  43641. },
  43642. __cxa_throw: function(e, t, i) {
  43643. throw ke[e] = {
  43644. ptr: e,
  43645. adjusted: [e],
  43646. type: t,
  43647. destructor: i,
  43648. refcount: 0,
  43649. caught: !1,
  43650. rethrown: !1
  43651. }, "uncaught_exception" in ni ? ni.uncaught_exceptions++ : ni.uncaught_exceptions = 1, e +
  43652. " - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."
  43653. },
  43654. __lock: function() {},
  43655. __syscall221: function(e, t) {
  43656. Pe.varargs = t;
  43657. try {
  43658. var i = Pe.getStreamFromFD();
  43659. switch (Pe.get()) {
  43660. case 0:
  43661. return (r = Pe.get()) < 0 ? -28 : xe.open(i.path, i.flags, 0, r).fd;
  43662. case 1:
  43663. case 2:
  43664. return 0;
  43665. case 3:
  43666. return i.flags;
  43667. case 4:
  43668. var r = Pe.get();
  43669. return i.flags |= r, 0;
  43670. case 12:
  43671. return r = Pe.get(), W[r + 0 >> 1] = 2, 0;
  43672. case 13:
  43673. case 14:
  43674. return 0;
  43675. case 16:
  43676. case 8:
  43677. return -28;
  43678. case 9:
  43679. return Re(28), -1;
  43680. default:
  43681. return -28
  43682. }
  43683. } catch (e) {
  43684. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno
  43685. }
  43686. },
  43687. __syscall3: function(e, t) {
  43688. Pe.varargs = t;
  43689. try {
  43690. var i = Pe.getStreamFromFD(),
  43691. r = Pe.get(),
  43692. n = Pe.get();
  43693. return xe.read(i, G, r, n)
  43694. } catch (e) {
  43695. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno
  43696. }
  43697. },
  43698. __syscall5: function(e, t) {
  43699. Pe.varargs = t;
  43700. try {
  43701. var i = Pe.getStr(),
  43702. r = Pe.get(),
  43703. n = Pe.get();
  43704. return xe.open(i, r, n).fd
  43705. } catch (e) {
  43706. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), -e.errno
  43707. }
  43708. },
  43709. __unlock: function() {},
  43710. abort: function() {
  43711. ve()
  43712. },
  43713. clock: function e() {
  43714. return void 0 === e.start && (e.start = Date.now()), 1e3 * (Date.now() - e.start) | 0
  43715. },
  43716. emscripten_memcpy_big: function(e, t, i) {
  43717. V.set(V.subarray(t, t + i), e)
  43718. },
  43719. emscripten_resize_heap: function(e) {
  43720. var t = G.length;
  43721. if (I(e > t), e > 2147418112) return S("Cannot enlarge memory, asked to go up to " + e +
  43722. " bytes, but the limit is 2147418112 bytes!"), !1;
  43723. for (var i = Math.max(t, 16777216); i < e;)(i = i <= 536870912 ? z(2 * i, 65536) : Math.min(z(
  43724. (3 * i + 2147483648) / 4, 65536), 2147418112)) === t && A(
  43725. "Cannot ask for more memory since we reached the practical limit in browsers (which is just below 2GB), so the request would have failed. Requesting only " +
  43726. G.length);
  43727. return !! function(e) {
  43728. try {
  43729. return M.grow(e - H.byteLength + 65535 >> 16), K(M.buffer), 1
  43730. } catch (t) {
  43731. console.error("emscripten_realloc_buffer: Attempted to grow heap from " + H.byteLength +
  43732. " bytes to " + e + " bytes, but got error: " + t)
  43733. }
  43734. }(i) || (S("Failed to grow the heap from " + t + " bytes to " + i +
  43735. " bytes, not enough memory!"), !1)
  43736. },
  43737. environ_get: function(e, t) {
  43738. var i = 0;
  43739. return Ne().forEach(function(r, n) {
  43740. var a = t + i;
  43741. q[e + 4 * n >> 2] = a,
  43742. function(e, t, i) {
  43743. for (var r = 0; r < e.length; ++r) I(e.charCodeAt(r) == e.charCodeAt(r) & 255), G[
  43744. t++ >> 0] = e.charCodeAt(r);
  43745. i || (G[t >> 0] = 0)
  43746. }(r, a), i += r.length + 1
  43747. }), 0
  43748. },
  43749. environ_sizes_get: function(e, t) {
  43750. var i = Ne();
  43751. q[e >> 2] = i.length;
  43752. var r = 0;
  43753. return i.forEach(function(e) {
  43754. r += e.length + 1
  43755. }), q[t >> 2] = r, 0
  43756. },
  43757. fd_close: function(e) {
  43758. try {
  43759. var t = Pe.getStreamFromFD(e);
  43760. return xe.close(t), 0
  43761. } catch (e) {
  43762. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  43763. }
  43764. },
  43765. fd_fdstat_get: function(e, t) {
  43766. try {
  43767. var i = Pe.getStreamFromFD(e),
  43768. r = i.tty ? 2 : xe.isDir(i.mode) ? 3 : xe.isLink(i.mode) ? 7 : 4;
  43769. return G[t >> 0] = r, 0
  43770. } catch (e) {
  43771. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  43772. }
  43773. },
  43774. fd_seek: function(e, t, i, r, n) {
  43775. try {
  43776. var a = Pe.getStreamFromFD(e),
  43777. s = 4294967296 * i + (t >>> 0);
  43778. return s <= -9007199254740992 || s >= 9007199254740992 ? -61 : (xe.llseek(a, s, r), we = [a
  43779. .position >>> 0, (be = a.position, +oe(be) >= 1 ? be > 0 ? (0 | de(+le(be /
  43780. 4294967296), 4294967295)) >>> 0 : ~~+ue((be - +(~~be >>> 0)) / 4294967296) >>> 0 :
  43781. 0)
  43782. ], q[n >> 2] = we[0], q[n + 4 >> 2] = we[1], a.getdents && 0 === s && 0 === r && (a
  43783. .getdents = null), 0)
  43784. } catch (e) {
  43785. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  43786. }
  43787. },
  43788. fd_write: function(e, t, i, r) {
  43789. try {
  43790. var n = Pe.getStreamFromFD(e),
  43791. a = Pe.doWritev(n, t, i);
  43792. return q[r >> 2] = a, 0
  43793. } catch (e) {
  43794. return void 0 !== xe && e instanceof xe.ErrnoError || ve(e), e.errno
  43795. }
  43796. },
  43797. gettimeofday: function(e) {
  43798. var t = Date.now();
  43799. return q[e >> 2] = t / 1e3 | 0, q[e + 4 >> 2] = t % 1e3 * 1e3 | 0, 0
  43800. },
  43801. memory: M,
  43802. round: function(e) {
  43803. return (e = +e) >= 0 ? +le(e + .5) : +ue(e - .5)
  43804. },
  43805. setTempRet0: function(e) {
  43806. O(0 | e)
  43807. },
  43808. table: C,
  43809. time: function(e) {
  43810. var t = Date.now() / 1e3 | 0;
  43811. return e && (q[e >> 2] = t), t
  43812. }
  43813. },
  43814. je = function() {
  43815. var e = {
  43816. env: Fe,
  43817. wasi_unstable: Fe
  43818. };
  43819. function t(e, t) {
  43820. var i = e.exports;
  43821. d.asm = i, ge("wasm-instantiate")
  43822. }
  43823. me("wasm-instantiate");
  43824. var i = d;
  43825. function r(e) {
  43826. I(d === i,
  43827. "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"
  43828. ), i = null, t(e.instance)
  43829. }
  43830. function n(t) {
  43831. return (R || !g && !v || "function" != typeof fetch ? new Promise(function(e, t) {
  43832. e(Te())
  43833. }) : fetch(Ee, {
  43834. credentials: "same-origin"
  43835. }).then(function(e) {
  43836. if (!e.ok) throw "failed to load wasm binary file at '" + Ee + "'";
  43837. return e.arrayBuffer()
  43838. }).catch(function() {
  43839. return Te()
  43840. })).then(function(t) {
  43841. return WebAssembly.instantiate(t, e)
  43842. }).then(t, function(e) {
  43843. S("failed to asynchronously prepare wasm: " + e), ve(e)
  43844. })
  43845. }
  43846. if (d.instantiateWasm) try {
  43847. return d.instantiateWasm(e, t)
  43848. } catch (e) {
  43849. return S("Module.instantiateWasm callback failed with error: " + e), !1
  43850. }
  43851. return function() {
  43852. if (R || "function" != typeof WebAssembly.instantiateStreaming || _e(Ee) || "function" !=
  43853. typeof fetch) return n(r);
  43854. fetch(Ee, {
  43855. credentials: "same-origin"
  43856. }).then(function(t) {
  43857. return WebAssembly.instantiateStreaming(t, e).then(r, function(e) {
  43858. S("wasm streaming compile failed: " + e), S(
  43859. "falling back to ArrayBuffer instantiation"), n(r)
  43860. })
  43861. })
  43862. }(), {}
  43863. }(),
  43864. He = je.__wasm_call_ctors;
  43865. je.__wasm_call_ctors = function() {
  43866. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43867. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), He
  43868. .apply(null, arguments)
  43869. };
  43870. var Ge = je.WasmDecoder_Check;
  43871. je.WasmDecoder_Check = function() {
  43872. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43873. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ge
  43874. .apply(null, arguments)
  43875. };
  43876. var Ve = je.WasmDecoder_Init;
  43877. je.WasmDecoder_Init = function() {
  43878. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43879. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ve
  43880. .apply(null, arguments)
  43881. };
  43882. var We = je.WasmDecoder_Deinit;
  43883. je.WasmDecoder_Deinit = function() {
  43884. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43885. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), We
  43886. .apply(null, arguments)
  43887. };
  43888. var qe = je.WasmDecoder_OpenChannel;
  43889. je.WasmDecoder_OpenChannel = function() {
  43890. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43891. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qe
  43892. .apply(null, arguments)
  43893. };
  43894. var Xe = je.WasmDecoder_InputFlvStream;
  43895. je.WasmDecoder_InputFlvStream = function() {
  43896. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43897. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xe
  43898. .apply(null, arguments)
  43899. };
  43900. var ze = je.WasmDecoder_GetFlvDecodeData;
  43901. je.WasmDecoder_GetFlvDecodeData = function() {
  43902. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43903. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ze
  43904. .apply(null, arguments)
  43905. };
  43906. var Ke = je.WasmDecoder_InputFlvStreamAndDecode;
  43907. je.WasmDecoder_InputFlvStreamAndDecode = function() {
  43908. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43909. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ke
  43910. .apply(null, arguments)
  43911. };
  43912. var Ye = je.WasmDecoder_OpenVideoDecoder;
  43913. je.WasmDecoder_OpenVideoDecoder = function() {
  43914. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43915. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ye
  43916. .apply(null, arguments)
  43917. };
  43918. var Qe = je.WasmDecoder_OpenAudioDecoder;
  43919. je.WasmDecoder_OpenAudioDecoder = function() {
  43920. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43921. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qe
  43922. .apply(null, arguments)
  43923. };
  43924. var Je = je.WasmDecoder_DecodeVideoFrame;
  43925. je.WasmDecoder_DecodeVideoFrame = function() {
  43926. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43927. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Je
  43928. .apply(null, arguments)
  43929. };
  43930. var Ze = je.WasmDecoder_DecodeAudioFrame;
  43931. je.WasmDecoder_DecodeAudioFrame = function() {
  43932. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43933. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ze
  43934. .apply(null, arguments)
  43935. };
  43936. var $e = je.WasmDecoder_CloseChannel;
  43937. je.WasmDecoder_CloseChannel = function() {
  43938. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43939. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $e
  43940. .apply(null, arguments)
  43941. };
  43942. var et = je.WasmDecoder_ConvertFrame2Image;
  43943. je.WasmDecoder_ConvertFrame2Image = function() {
  43944. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43945. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), et
  43946. .apply(null, arguments)
  43947. };
  43948. var tt = je.WasmDecoder_ReleaseImageData;
  43949. je.WasmDecoder_ReleaseImageData = function() {
  43950. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43951. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), tt
  43952. .apply(null, arguments)
  43953. };
  43954. var it = je.WasmDecoder_CreateMP4File;
  43955. je.WasmDecoder_CreateMP4File = function() {
  43956. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43957. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), it
  43958. .apply(null, arguments)
  43959. };
  43960. var rt = je.WasmDecoder_WriteData;
  43961. je.WasmDecoder_WriteData = function() {
  43962. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43963. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), rt
  43964. .apply(null, arguments)
  43965. };
  43966. var nt = je.WasmDecoder_ReleaseMP4File;
  43967. je.WasmDecoder_ReleaseMP4File = function() {
  43968. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43969. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), nt
  43970. .apply(null, arguments)
  43971. };
  43972. var at = je.main;
  43973. je.main = function() {
  43974. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43975. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), at
  43976. .apply(null, arguments)
  43977. };
  43978. var st = je.free;
  43979. je.free = function() {
  43980. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43981. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), st
  43982. .apply(null, arguments)
  43983. };
  43984. var ot = je.malloc;
  43985. je.malloc = function() {
  43986. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43987. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ot
  43988. .apply(null, arguments)
  43989. };
  43990. var ut = je.__errno_location;
  43991. je.__errno_location = function() {
  43992. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43993. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ut
  43994. .apply(null, arguments)
  43995. };
  43996. var lt = je.fflush;
  43997. je.fflush = function() {
  43998. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  43999. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), lt
  44000. .apply(null, arguments)
  44001. };
  44002. var dt = je._get_tzname;
  44003. je._get_tzname = function() {
  44004. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44005. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), dt
  44006. .apply(null, arguments)
  44007. };
  44008. var ct = je._get_daylight;
  44009. je._get_daylight = function() {
  44010. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44011. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ct
  44012. .apply(null, arguments)
  44013. };
  44014. var ht = je._get_timezone;
  44015. je._get_timezone = function() {
  44016. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44017. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ht
  44018. .apply(null, arguments)
  44019. };
  44020. var ft = je.setThrew;
  44021. je.setThrew = function() {
  44022. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44023. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ft
  44024. .apply(null, arguments)
  44025. };
  44026. var pt = je._ZSt18uncaught_exceptionv;
  44027. je._ZSt18uncaught_exceptionv = function() {
  44028. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44029. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), pt
  44030. .apply(null, arguments)
  44031. };
  44032. var mt = je.stackSave;
  44033. je.stackSave = function() {
  44034. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44035. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), mt
  44036. .apply(null, arguments)
  44037. };
  44038. var gt = je.stackAlloc;
  44039. je.stackAlloc = function() {
  44040. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44041. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), gt
  44042. .apply(null, arguments)
  44043. };
  44044. var vt = je.stackRestore;
  44045. je.stackRestore = function() {
  44046. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44047. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), vt
  44048. .apply(null, arguments)
  44049. };
  44050. var yt = je.__growWasmMemory;
  44051. je.__growWasmMemory = function() {
  44052. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44053. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), yt
  44054. .apply(null, arguments)
  44055. };
  44056. var _t = je.dynCall_ii;
  44057. je.dynCall_ii = function() {
  44058. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44059. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), _t
  44060. .apply(null, arguments)
  44061. };
  44062. var bt = je.dynCall_viiiii;
  44063. je.dynCall_viiiii = function() {
  44064. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44065. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), bt
  44066. .apply(null, arguments)
  44067. };
  44068. var wt = je.dynCall_viiiiiifi;
  44069. je.dynCall_viiiiiifi = function() {
  44070. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44071. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), wt
  44072. .apply(null, arguments)
  44073. };
  44074. var Et = je.dynCall_viiii;
  44075. je.dynCall_viiii = function() {
  44076. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44077. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Et
  44078. .apply(null, arguments)
  44079. };
  44080. var Tt = je.dynCall_viii;
  44081. je.dynCall_viii = function() {
  44082. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44083. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Tt
  44084. .apply(null, arguments)
  44085. };
  44086. var St = je.dynCall_iiiiiii;
  44087. je.dynCall_iiiiiii = function() {
  44088. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44089. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), St
  44090. .apply(null, arguments)
  44091. };
  44092. var At = je.dynCall_iiiiii;
  44093. je.dynCall_iiiiii = function() {
  44094. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44095. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), At
  44096. .apply(null, arguments)
  44097. };
  44098. var kt = je.dynCall_vii;
  44099. je.dynCall_vii = function() {
  44100. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44101. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), kt
  44102. .apply(null, arguments)
  44103. };
  44104. var Rt = je.dynCall_iii;
  44105. je.dynCall_iii = function() {
  44106. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44107. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Rt
  44108. .apply(null, arguments)
  44109. };
  44110. var Mt = je.dynCall_iiii;
  44111. je.dynCall_iiii = function() {
  44112. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44113. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Mt
  44114. .apply(null, arguments)
  44115. };
  44116. var Ot = je.dynCall_viiiiii;
  44117. je.dynCall_viiiiii = function() {
  44118. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44119. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ot
  44120. .apply(null, arguments)
  44121. };
  44122. var Ct = je.dynCall_viiiiiiiii;
  44123. je.dynCall_viiiiiiiii = function() {
  44124. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44125. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ct
  44126. .apply(null, arguments)
  44127. };
  44128. var Dt = je.dynCall_viiiiiiii;
  44129. je.dynCall_viiiiiiii = function() {
  44130. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44131. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Dt
  44132. .apply(null, arguments)
  44133. };
  44134. var It = je.dynCall_iiiii;
  44135. je.dynCall_iiiii = function() {
  44136. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44137. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), It
  44138. .apply(null, arguments)
  44139. };
  44140. var Lt = je.dynCall_viiiiiiiiiiiiii;
  44141. je.dynCall_viiiiiiiiiiiiii = function() {
  44142. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44143. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Lt
  44144. .apply(null, arguments)
  44145. };
  44146. var xt = je.dynCall_viiiiiiiiiii;
  44147. je.dynCall_viiiiiiiiiii = function() {
  44148. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44149. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), xt
  44150. .apply(null, arguments)
  44151. };
  44152. var Pt = je.dynCall_viiiiiii;
  44153. je.dynCall_viiiiiii = function() {
  44154. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44155. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Pt
  44156. .apply(null, arguments)
  44157. };
  44158. var Ut = je.dynCall_viiiiiiiiiiii;
  44159. je.dynCall_viiiiiiiiiiii = function() {
  44160. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44161. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ut
  44162. .apply(null, arguments)
  44163. };
  44164. var Nt = je.dynCall_vi;
  44165. je.dynCall_vi = function() {
  44166. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44167. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Nt
  44168. .apply(null, arguments)
  44169. };
  44170. var Bt = je.dynCall_iiiiiiiii;
  44171. je.dynCall_iiiiiiiii = function() {
  44172. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44173. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Bt
  44174. .apply(null, arguments)
  44175. };
  44176. var Ft = je.dynCall_viiiifii;
  44177. je.dynCall_viiiifii = function() {
  44178. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44179. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ft
  44180. .apply(null, arguments)
  44181. };
  44182. var jt = je.dynCall_fii;
  44183. je.dynCall_fii = function() {
  44184. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44185. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), jt
  44186. .apply(null, arguments)
  44187. };
  44188. var Ht = je.dynCall_viiiiiiiiii;
  44189. je.dynCall_viiiiiiiiii = function() {
  44190. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44191. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Ht
  44192. .apply(null, arguments)
  44193. };
  44194. var Gt = je.dynCall_dd;
  44195. je.dynCall_dd = function() {
  44196. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44197. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Gt
  44198. .apply(null, arguments)
  44199. };
  44200. var Vt = je.dynCall_viifi;
  44201. je.dynCall_viifi = function() {
  44202. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44203. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Vt
  44204. .apply(null, arguments)
  44205. };
  44206. var Wt = je.dynCall_fiii;
  44207. je.dynCall_fiii = function() {
  44208. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44209. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Wt
  44210. .apply(null, arguments)
  44211. };
  44212. var qt = je.dynCall_viidi;
  44213. je.dynCall_viidi = function() {
  44214. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44215. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), qt
  44216. .apply(null, arguments)
  44217. };
  44218. var Xt = je.dynCall_iiiiiiii;
  44219. je.dynCall_iiiiiiii = function() {
  44220. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44221. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Xt
  44222. .apply(null, arguments)
  44223. };
  44224. var zt = je.dynCall_did;
  44225. je.dynCall_did = function() {
  44226. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44227. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), zt
  44228. .apply(null, arguments)
  44229. };
  44230. var Kt = je.dynCall_v;
  44231. je.dynCall_v = function() {
  44232. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44233. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Kt
  44234. .apply(null, arguments)
  44235. };
  44236. var Yt = je.dynCall_viiijj;
  44237. je.dynCall_viiijj = function() {
  44238. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44239. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Yt
  44240. .apply(null, arguments)
  44241. };
  44242. var Qt = je.dynCall_iiiiiiidiiddii;
  44243. je.dynCall_iiiiiiidiiddii = function() {
  44244. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44245. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Qt
  44246. .apply(null, arguments)
  44247. };
  44248. var Jt = je.dynCall_jij;
  44249. je.dynCall_jij = function() {
  44250. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44251. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Jt
  44252. .apply(null, arguments)
  44253. };
  44254. var Zt = je.dynCall_jii;
  44255. je.dynCall_jii = function() {
  44256. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44257. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), Zt
  44258. .apply(null, arguments)
  44259. };
  44260. var $t = je.dynCall_jiji;
  44261. je.dynCall_jiji = function() {
  44262. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44263. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), $t
  44264. .apply(null, arguments)
  44265. };
  44266. var ei = je.dynCall_iidiiii;
  44267. je.dynCall_iidiiii = function() {
  44268. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44269. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), ei
  44270. .apply(null, arguments)
  44271. }, d.asm = je;
  44272. var ti, ii = d.___wasm_call_ctors = function() {
  44273. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44274. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44275. .asm.__wasm_call_ctors.apply(null, arguments)
  44276. },
  44277. ri = (d._WasmDecoder_Check = function() {
  44278. return I(ae,
  44279. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44280. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44281. .WasmDecoder_Check.apply(null, arguments)
  44282. }, d._WasmDecoder_Init = function() {
  44283. return I(ae,
  44284. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44285. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44286. .WasmDecoder_Init.apply(null, arguments)
  44287. }, d._WasmDecoder_Deinit = function() {
  44288. return I(ae,
  44289. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44290. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44291. .WasmDecoder_Deinit.apply(null, arguments)
  44292. }, d._WasmDecoder_OpenChannel = function() {
  44293. return I(ae,
  44294. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44295. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44296. .WasmDecoder_OpenChannel.apply(null, arguments)
  44297. }, d._WasmDecoder_InputFlvStream = function() {
  44298. return I(ae,
  44299. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44300. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44301. .WasmDecoder_InputFlvStream.apply(null, arguments)
  44302. }, d._WasmDecoder_GetFlvDecodeData = function() {
  44303. return I(ae,
  44304. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44305. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44306. .WasmDecoder_GetFlvDecodeData.apply(null, arguments)
  44307. }, d._WasmDecoder_InputFlvStreamAndDecode = function() {
  44308. return I(ae,
  44309. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44310. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44311. .WasmDecoder_InputFlvStreamAndDecode.apply(null, arguments)
  44312. }, d._WasmDecoder_OpenVideoDecoder = function() {
  44313. return I(ae,
  44314. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44315. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44316. .WasmDecoder_OpenVideoDecoder.apply(null, arguments)
  44317. }, d._WasmDecoder_OpenAudioDecoder = function() {
  44318. return I(ae,
  44319. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44320. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44321. .WasmDecoder_OpenAudioDecoder.apply(null, arguments)
  44322. }, d._WasmDecoder_DecodeVideoFrame = function() {
  44323. return I(ae,
  44324. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44325. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44326. .WasmDecoder_DecodeVideoFrame.apply(null, arguments)
  44327. }, d._WasmDecoder_DecodeAudioFrame = function() {
  44328. return I(ae,
  44329. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44330. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44331. .WasmDecoder_DecodeAudioFrame.apply(null, arguments)
  44332. }, d._WasmDecoder_CloseChannel = function() {
  44333. return I(ae,
  44334. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44335. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44336. .WasmDecoder_CloseChannel.apply(null, arguments)
  44337. }, d._WasmDecoder_ConvertFrame2Image = function() {
  44338. return I(ae,
  44339. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44340. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44341. .WasmDecoder_ConvertFrame2Image.apply(null, arguments)
  44342. }, d._WasmDecoder_ReleaseImageData = function() {
  44343. return I(ae,
  44344. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44345. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44346. .WasmDecoder_ReleaseImageData.apply(null, arguments)
  44347. }, d._WasmDecoder_CreateMP4File = function() {
  44348. return I(ae,
  44349. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44350. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44351. .WasmDecoder_CreateMP4File.apply(null, arguments)
  44352. }, d._WasmDecoder_WriteData = function() {
  44353. return I(ae,
  44354. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44355. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44356. .WasmDecoder_WriteData.apply(null, arguments)
  44357. }, d._WasmDecoder_ReleaseMP4File = function() {
  44358. return I(ae,
  44359. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44360. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44361. .WasmDecoder_ReleaseMP4File.apply(null, arguments)
  44362. }, d._main = function() {
  44363. return I(ae,
  44364. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44365. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44366. .main.apply(null, arguments)
  44367. }, d._free = function() {
  44368. return I(ae,
  44369. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44370. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44371. .free.apply(null, arguments)
  44372. }, d._malloc = function() {
  44373. return I(ae,
  44374. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44375. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44376. .malloc.apply(null, arguments)
  44377. }),
  44378. ni = (d.___errno_location = function() {
  44379. return I(ae,
  44380. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44381. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44382. .__errno_location.apply(null, arguments)
  44383. }, d._fflush = function() {
  44384. return I(ae,
  44385. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44386. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44387. .fflush.apply(null, arguments)
  44388. }, d.__get_tzname = function() {
  44389. return I(ae,
  44390. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44391. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44392. ._get_tzname.apply(null, arguments)
  44393. }, d.__get_daylight = function() {
  44394. return I(ae,
  44395. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44396. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44397. ._get_daylight.apply(null, arguments)
  44398. }, d.__get_timezone = function() {
  44399. return I(ae,
  44400. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44401. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44402. ._get_timezone.apply(null, arguments)
  44403. }, d._setThrew = function() {
  44404. return I(ae,
  44405. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44406. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44407. .setThrew.apply(null, arguments)
  44408. }, d.__ZSt18uncaught_exceptionv = function() {
  44409. return I(ae,
  44410. "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"), I(!se,
  44411. "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d.asm
  44412. ._ZSt18uncaught_exceptionv.apply(null, arguments)
  44413. }),
  44414. ai = d.stackSave = function() {
  44415. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44416. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44417. .asm.stackSave.apply(null, arguments)
  44418. },
  44419. si = d.stackAlloc = function() {
  44420. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44421. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44422. .asm.stackAlloc.apply(null, arguments)
  44423. },
  44424. oi = d.stackRestore = function() {
  44425. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44426. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44427. .asm.stackRestore.apply(null, arguments)
  44428. };
  44429. function ui(e) {
  44430. this.name = "ExitStatus", this.message = "Program terminated with exit(" + e + ")", this.status = e
  44431. }
  44432. function li(e) {
  44433. I(0 == ce,
  44434. 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])'),
  44435. I(0 == te.length, "cannot call main when preRun functions remain to be called");
  44436. var t = d._main;
  44437. try {
  44438. ! function(e, t) {
  44439. (function() {
  44440. var e = T,
  44441. t = S,
  44442. i = !1;
  44443. T = S = function(e) {
  44444. i = !0
  44445. };
  44446. try {
  44447. var r = d._fflush;
  44448. r && r(0), ["stdout", "stderr"].forEach(function(e) {
  44449. var t = xe.analyzePath("/dev/" + e);
  44450. if (t) {
  44451. var r = t.object.rdev,
  44452. n = Ce.ttys[r];
  44453. n && n.output && n.output.length && (i = !0)
  44454. }
  44455. })
  44456. } catch (e) {}
  44457. T = e, S = t, i && A(
  44458. "stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc."
  44459. )
  44460. })(), t && s && 0 === e || (s ? t || S("program exited (with status: " + e +
  44461. "), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)"
  44462. ) : (D = !0, $(), se = !0, d.onExit && d.onExit(e)), m(e, new ui(e)))
  44463. }(t(0, 0), !0)
  44464. } catch (e) {
  44465. if (e instanceof ui) return;
  44466. if ("SimulateInfiniteLoop" == e) return void(s = !0);
  44467. var i = e;
  44468. e && "object" == typeof e && e.stack && (i = [e, e.stack]), S("exception thrown: " + i), m(1, e)
  44469. }
  44470. }
  44471. function di(e) {
  44472. function t() {
  44473. ti || (ti = !0, D || ($(), I(!ae), ae = !0, d.noFSInit || xe.init.initialized || xe.init(), Ce
  44474. .init(), ee(ie), $(), xe.ignorePermissions = !1, ee(re), d.onRuntimeInitialized && d
  44475. .onRuntimeInitialized(), ci && li(),
  44476. function() {
  44477. if ($(), d.postRun)
  44478. for ("function" == typeof d.postRun && (d.postRun = [d.postRun]); d.postRun.length;) e =
  44479. d.postRun.shift(), ne.unshift(e);
  44480. var e;
  44481. ee(ne)
  44482. }()))
  44483. }
  44484. e = e || f, ce > 0 || (Z(), function() {
  44485. if (d.preRun)
  44486. for ("function" == typeof d.preRun && (d.preRun = [d.preRun]); d.preRun.length;) e = d
  44487. .preRun.shift(), te.unshift(e);
  44488. var e;
  44489. ee(te)
  44490. }(), ce > 0 || (d.setStatus ? (d.setStatus("Running..."), setTimeout(function() {
  44491. setTimeout(function() {
  44492. d.setStatus("")
  44493. }, 1), t()
  44494. }, 1)) : t(), $()))
  44495. }
  44496. if (d.__growWasmMemory = function() {
  44497. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44498. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44499. .asm.__growWasmMemory.apply(null, arguments)
  44500. }, d.dynCall_ii = function() {
  44501. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44502. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44503. .asm.dynCall_ii.apply(null, arguments)
  44504. }, d.dynCall_viiiii = function() {
  44505. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44506. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44507. .asm.dynCall_viiiii.apply(null, arguments)
  44508. }, d.dynCall_viiiiiifi = function() {
  44509. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44510. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44511. .asm.dynCall_viiiiiifi.apply(null, arguments)
  44512. }, d.dynCall_viiii = function() {
  44513. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44514. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44515. .asm.dynCall_viiii.apply(null, arguments)
  44516. }, d.dynCall_viii = function() {
  44517. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44518. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44519. .asm.dynCall_viii.apply(null, arguments)
  44520. }, d.dynCall_iiiiiii = function() {
  44521. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44522. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44523. .asm.dynCall_iiiiiii.apply(null, arguments)
  44524. }, d.dynCall_iiiiii = function() {
  44525. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44526. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44527. .asm.dynCall_iiiiii.apply(null, arguments)
  44528. }, d.dynCall_vii = function() {
  44529. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44530. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44531. .asm.dynCall_vii.apply(null, arguments)
  44532. }, d.dynCall_iii = function() {
  44533. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44534. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44535. .asm.dynCall_iii.apply(null, arguments)
  44536. }, d.dynCall_iiii = function() {
  44537. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44538. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44539. .asm.dynCall_iiii.apply(null, arguments)
  44540. }, d.dynCall_viiiiii = function() {
  44541. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44542. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44543. .asm.dynCall_viiiiii.apply(null, arguments)
  44544. }, d.dynCall_viiiiiiiii = function() {
  44545. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44546. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44547. .asm.dynCall_viiiiiiiii.apply(null, arguments)
  44548. }, d.dynCall_viiiiiiii = function() {
  44549. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44550. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44551. .asm.dynCall_viiiiiiii.apply(null, arguments)
  44552. }, d.dynCall_iiiii = function() {
  44553. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44554. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44555. .asm.dynCall_iiiii.apply(null, arguments)
  44556. }, d.dynCall_viiiiiiiiiiiiii = function() {
  44557. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44558. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44559. .asm.dynCall_viiiiiiiiiiiiii.apply(null, arguments)
  44560. }, d.dynCall_viiiiiiiiiii = function() {
  44561. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44562. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44563. .asm.dynCall_viiiiiiiiiii.apply(null, arguments)
  44564. }, d.dynCall_viiiiiii = function() {
  44565. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44566. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44567. .asm.dynCall_viiiiiii.apply(null, arguments)
  44568. }, d.dynCall_viiiiiiiiiiii = function() {
  44569. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44570. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44571. .asm.dynCall_viiiiiiiiiiii.apply(null, arguments)
  44572. }, d.dynCall_vi = function() {
  44573. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44574. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44575. .asm.dynCall_vi.apply(null, arguments)
  44576. }, d.dynCall_iiiiiiiii = function() {
  44577. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44578. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44579. .asm.dynCall_iiiiiiiii.apply(null, arguments)
  44580. }, d.dynCall_viiiifii = function() {
  44581. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44582. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44583. .asm.dynCall_viiiifii.apply(null, arguments)
  44584. }, d.dynCall_fii = function() {
  44585. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44586. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44587. .asm.dynCall_fii.apply(null, arguments)
  44588. }, d.dynCall_viiiiiiiiii = function() {
  44589. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44590. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44591. .asm.dynCall_viiiiiiiiii.apply(null, arguments)
  44592. }, d.dynCall_dd = function() {
  44593. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44594. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44595. .asm.dynCall_dd.apply(null, arguments)
  44596. }, d.dynCall_viifi = function() {
  44597. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44598. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44599. .asm.dynCall_viifi.apply(null, arguments)
  44600. }, d.dynCall_fiii = function() {
  44601. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44602. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44603. .asm.dynCall_fiii.apply(null, arguments)
  44604. }, d.dynCall_viidi = function() {
  44605. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44606. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44607. .asm.dynCall_viidi.apply(null, arguments)
  44608. }, d.dynCall_iiiiiiii = function() {
  44609. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44610. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44611. .asm.dynCall_iiiiiiii.apply(null, arguments)
  44612. }, d.dynCall_did = function() {
  44613. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44614. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44615. .asm.dynCall_did.apply(null, arguments)
  44616. }, d.dynCall_v = function() {
  44617. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44618. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44619. .asm.dynCall_v.apply(null, arguments)
  44620. }, d.dynCall_viiijj = function() {
  44621. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44622. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44623. .asm.dynCall_viiijj.apply(null, arguments)
  44624. }, d.dynCall_iiiiiiidiiddii = function() {
  44625. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44626. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44627. .asm.dynCall_iiiiiiidiiddii.apply(null, arguments)
  44628. }, d.dynCall_jij = function() {
  44629. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44630. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44631. .asm.dynCall_jij.apply(null, arguments)
  44632. }, d.dynCall_jii = function() {
  44633. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44634. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44635. .asm.dynCall_jii.apply(null, arguments)
  44636. }, d.dynCall_jiji = function() {
  44637. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44638. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44639. .asm.dynCall_jiji.apply(null, arguments)
  44640. }, d.dynCall_iidiiii = function() {
  44641. return I(ae, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)"),
  44642. I(!se, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)"), d
  44643. .asm.dynCall_iidiiii.apply(null, arguments)
  44644. }, d.asm = je, Object.getOwnPropertyDescriptor(d, "intArrayFromString") || (d.intArrayFromString =
  44645. function() {
  44646. ve(
  44647. "'intArrayFromString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44648. }), Object.getOwnPropertyDescriptor(d, "intArrayToString") || (d.intArrayToString = function() {
  44649. ve(
  44650. "'intArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44651. }), d.ccall = x, d.cwrap = function(e, t, i, r) {
  44652. return function() {
  44653. return x(e, t, i, arguments)
  44654. }
  44655. }, Object.getOwnPropertyDescriptor(d, "setValue") || (d.setValue = function() {
  44656. ve("'setValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44657. }), Object.getOwnPropertyDescriptor(d, "getValue") || (d.getValue = function() {
  44658. ve("'getValue' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44659. }), Object.getOwnPropertyDescriptor(d, "allocate") || (d.allocate = function() {
  44660. ve("'allocate' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44661. }), Object.getOwnPropertyDescriptor(d, "getMemory") || (d.getMemory = function() {
  44662. ve(
  44663. "'getMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44664. }), Object.getOwnPropertyDescriptor(d, "AsciiToString") || (d.AsciiToString = function() {
  44665. ve("'AsciiToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44666. }), Object.getOwnPropertyDescriptor(d, "stringToAscii") || (d.stringToAscii = function() {
  44667. ve("'stringToAscii' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44668. }), Object.getOwnPropertyDescriptor(d, "UTF8ArrayToString") || (d.UTF8ArrayToString = function() {
  44669. ve(
  44670. "'UTF8ArrayToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44671. }), Object.getOwnPropertyDescriptor(d, "UTF8ToString") || (d.UTF8ToString = function() {
  44672. ve("'UTF8ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44673. }), Object.getOwnPropertyDescriptor(d, "stringToUTF8Array") || (d.stringToUTF8Array = function() {
  44674. ve(
  44675. "'stringToUTF8Array' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44676. }), Object.getOwnPropertyDescriptor(d, "stringToUTF8") || (d.stringToUTF8 = function() {
  44677. ve("'stringToUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44678. }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF8") || (d.lengthBytesUTF8 = function() {
  44679. ve("'lengthBytesUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44680. }), Object.getOwnPropertyDescriptor(d, "UTF16ToString") || (d.UTF16ToString = function() {
  44681. ve("'UTF16ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44682. }), Object.getOwnPropertyDescriptor(d, "stringToUTF16") || (d.stringToUTF16 = function() {
  44683. ve("'stringToUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44684. }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF16") || (d.lengthBytesUTF16 = function() {
  44685. ve(
  44686. "'lengthBytesUTF16' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44687. }), Object.getOwnPropertyDescriptor(d, "UTF32ToString") || (d.UTF32ToString = function() {
  44688. ve("'UTF32ToString' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44689. }), Object.getOwnPropertyDescriptor(d, "stringToUTF32") || (d.stringToUTF32 = function() {
  44690. ve("'stringToUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44691. }), Object.getOwnPropertyDescriptor(d, "lengthBytesUTF32") || (d.lengthBytesUTF32 = function() {
  44692. ve(
  44693. "'lengthBytesUTF32' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44694. }), Object.getOwnPropertyDescriptor(d, "allocateUTF8") || (d.allocateUTF8 = function() {
  44695. ve("'allocateUTF8' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44696. }), Object.getOwnPropertyDescriptor(d, "stackTrace") || (d.stackTrace = function() {
  44697. ve("'stackTrace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44698. }), Object.getOwnPropertyDescriptor(d, "addOnPreRun") || (d.addOnPreRun = function() {
  44699. ve("'addOnPreRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44700. }), Object.getOwnPropertyDescriptor(d, "addOnInit") || (d.addOnInit = function() {
  44701. ve("'addOnInit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44702. }), Object.getOwnPropertyDescriptor(d, "addOnPreMain") || (d.addOnPreMain = function() {
  44703. ve("'addOnPreMain' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44704. }), Object.getOwnPropertyDescriptor(d, "addOnExit") || (d.addOnExit = function() {
  44705. ve("'addOnExit' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44706. }), Object.getOwnPropertyDescriptor(d, "addOnPostRun") || (d.addOnPostRun = function() {
  44707. ve("'addOnPostRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44708. }), Object.getOwnPropertyDescriptor(d, "writeStringToMemory") || (d.writeStringToMemory =
  44709. function() {
  44710. ve(
  44711. "'writeStringToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44712. }), Object.getOwnPropertyDescriptor(d, "writeArrayToMemory") || (d.writeArrayToMemory = function() {
  44713. ve(
  44714. "'writeArrayToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44715. }), Object.getOwnPropertyDescriptor(d, "writeAsciiToMemory") || (d.writeAsciiToMemory = function() {
  44716. ve(
  44717. "'writeAsciiToMemory' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44718. }), Object.getOwnPropertyDescriptor(d, "addRunDependency") || (d.addRunDependency = function() {
  44719. ve(
  44720. "'addRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44721. }), Object.getOwnPropertyDescriptor(d, "removeRunDependency") || (d.removeRunDependency =
  44722. function() {
  44723. ve(
  44724. "'removeRunDependency' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44725. }), Object.getOwnPropertyDescriptor(d, "ENV") || (d.ENV = function() {
  44726. ve("'ENV' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44727. }), Object.getOwnPropertyDescriptor(d, "FS") || (d.FS = function() {
  44728. ve("'FS' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44729. }), Object.getOwnPropertyDescriptor(d, "FS_createFolder") || (d.FS_createFolder = function() {
  44730. ve(
  44731. "'FS_createFolder' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44732. }), Object.getOwnPropertyDescriptor(d, "FS_createPath") || (d.FS_createPath = function() {
  44733. ve(
  44734. "'FS_createPath' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44735. }), Object.getOwnPropertyDescriptor(d, "FS_createDataFile") || (d.FS_createDataFile = function() {
  44736. ve(
  44737. "'FS_createDataFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44738. }), Object.getOwnPropertyDescriptor(d, "FS_createPreloadedFile") || (d.FS_createPreloadedFile =
  44739. function() {
  44740. ve(
  44741. "'FS_createPreloadedFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44742. }), Object.getOwnPropertyDescriptor(d, "FS_createLazyFile") || (d.FS_createLazyFile = function() {
  44743. ve(
  44744. "'FS_createLazyFile' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44745. }), Object.getOwnPropertyDescriptor(d, "FS_createLink") || (d.FS_createLink = function() {
  44746. ve(
  44747. "'FS_createLink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44748. }), Object.getOwnPropertyDescriptor(d, "FS_createDevice") || (d.FS_createDevice = function() {
  44749. ve(
  44750. "'FS_createDevice' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44751. }), Object.getOwnPropertyDescriptor(d, "FS_unlink") || (d.FS_unlink = function() {
  44752. ve(
  44753. "'FS_unlink' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44754. }), Object.getOwnPropertyDescriptor(d, "GL") || (d.GL = function() {
  44755. ve("'GL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44756. }), Object.getOwnPropertyDescriptor(d, "dynamicAlloc") || (d.dynamicAlloc = function() {
  44757. ve("'dynamicAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44758. }), Object.getOwnPropertyDescriptor(d, "loadDynamicLibrary") || (d.loadDynamicLibrary = function() {
  44759. ve(
  44760. "'loadDynamicLibrary' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44761. }), Object.getOwnPropertyDescriptor(d, "loadWebAssemblyModule") || (d.loadWebAssemblyModule =
  44762. function() {
  44763. ve(
  44764. "'loadWebAssemblyModule' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44765. }), Object.getOwnPropertyDescriptor(d, "getLEB") || (d.getLEB = function() {
  44766. ve("'getLEB' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44767. }), Object.getOwnPropertyDescriptor(d, "getFunctionTables") || (d.getFunctionTables = function() {
  44768. ve(
  44769. "'getFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44770. }), Object.getOwnPropertyDescriptor(d, "alignFunctionTables") || (d.alignFunctionTables =
  44771. function() {
  44772. ve(
  44773. "'alignFunctionTables' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44774. }), Object.getOwnPropertyDescriptor(d, "registerFunctions") || (d.registerFunctions = function() {
  44775. ve(
  44776. "'registerFunctions' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44777. }), d.addFunction = function(e, t) {
  44778. return I(void 0 !== e), k(e, t)
  44779. }, Object.getOwnPropertyDescriptor(d, "removeFunction") || (d.removeFunction = function() {
  44780. ve("'removeFunction' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44781. }), Object.getOwnPropertyDescriptor(d, "getFuncWrapper") || (d.getFuncWrapper = function() {
  44782. ve("'getFuncWrapper' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44783. }), Object.getOwnPropertyDescriptor(d, "prettyPrint") || (d.prettyPrint = function() {
  44784. ve("'prettyPrint' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44785. }), Object.getOwnPropertyDescriptor(d, "makeBigInt") || (d.makeBigInt = function() {
  44786. ve("'makeBigInt' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44787. }), Object.getOwnPropertyDescriptor(d, "dynCall") || (d.dynCall = function() {
  44788. ve("'dynCall' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44789. }), Object.getOwnPropertyDescriptor(d, "getCompilerSetting") || (d.getCompilerSetting = function() {
  44790. ve(
  44791. "'getCompilerSetting' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44792. }), Object.getOwnPropertyDescriptor(d, "stackSave") || (d.stackSave = function() {
  44793. ve("'stackSave' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44794. }), Object.getOwnPropertyDescriptor(d, "stackRestore") || (d.stackRestore = function() {
  44795. ve("'stackRestore' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44796. }), Object.getOwnPropertyDescriptor(d, "stackAlloc") || (d.stackAlloc = function() {
  44797. ve("'stackAlloc' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44798. }), Object.getOwnPropertyDescriptor(d, "establishStackSpace") || (d.establishStackSpace =
  44799. function() {
  44800. ve(
  44801. "'establishStackSpace' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44802. }), Object.getOwnPropertyDescriptor(d, "print") || (d.print = function() {
  44803. ve("'print' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44804. }), Object.getOwnPropertyDescriptor(d, "printErr") || (d.printErr = function() {
  44805. ve("'printErr' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44806. }), Object.getOwnPropertyDescriptor(d, "getTempRet0") || (d.getTempRet0 = function() {
  44807. ve("'getTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44808. }), Object.getOwnPropertyDescriptor(d, "setTempRet0") || (d.setTempRet0 = function() {
  44809. ve("'setTempRet0' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44810. }), d.callMain = li, Object.getOwnPropertyDescriptor(d, "abort") || (d.abort = function() {
  44811. ve("'abort' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44812. }), Object.getOwnPropertyDescriptor(d, "Pointer_stringify") || (d.Pointer_stringify = function() {
  44813. ve(
  44814. "'Pointer_stringify' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44815. }), Object.getOwnPropertyDescriptor(d, "warnOnce") || (d.warnOnce = function() {
  44816. ve("'warnOnce' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44817. }), d.writeStackCookie = Z, d.checkStackCookie = $, d.abortStackOverflow = function(e) {
  44818. ve("Stack overflow! Attempted to allocate " + e + " bytes on the stack, but stack has only " + (
  44819. Y - ai() + e) + " bytes available!")
  44820. }, Object.getOwnPropertyDescriptor(d, "ALLOC_NORMAL") || Object.defineProperty(d, "ALLOC_NORMAL", {
  44821. configurable: !0,
  44822. get: function() {
  44823. ve(
  44824. "'ALLOC_NORMAL' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44825. }
  44826. }), Object.getOwnPropertyDescriptor(d, "ALLOC_STACK") || Object.defineProperty(d, "ALLOC_STACK", {
  44827. configurable: !0,
  44828. get: function() {
  44829. ve("'ALLOC_STACK' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44830. }
  44831. }), Object.getOwnPropertyDescriptor(d, "ALLOC_DYNAMIC") || Object.defineProperty(d,
  44832. "ALLOC_DYNAMIC", {
  44833. configurable: !0,
  44834. get: function() {
  44835. ve(
  44836. "'ALLOC_DYNAMIC' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44837. }
  44838. }), Object.getOwnPropertyDescriptor(d, "ALLOC_NONE") || Object.defineProperty(d, "ALLOC_NONE", {
  44839. configurable: !0,
  44840. get: function() {
  44841. ve("'ALLOC_NONE' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ)")
  44842. }
  44843. }), Object.getOwnPropertyDescriptor(d, "calledRun") || Object.defineProperty(d, "calledRun", {
  44844. configurable: !0,
  44845. get: function() {
  44846. ve(
  44847. "'calledRun' was not exported. add it to EXTRA_EXPORTED_RUNTIME_METHODS (see the FAQ). Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you")
  44848. }
  44849. }), fe = function e() {
  44850. ti || di(), ti || (fe = e)
  44851. }, d.run = di, d.preInit)
  44852. for ("function" == typeof d.preInit && (d.preInit = [d.preInit]); d.preInit.length > 0;) d.preInit
  44853. .pop()();
  44854. var ci = !0;
  44855. d.noInitialRun && (ci = !1), s = !0, di()
  44856. }
  44857. var h = function(e) {
  44858. e.isFlvStream = !0, e.enableAudio = !1, e.pause = !1, e.exitFlag = !1, e.needMoreData = !1, e
  44859. .wasmDecoderId = -1, e.wasmInitVideoDecoder = !1, e.wasmInitAudioDecoder = !1, e.videoQueue = [],
  44860. e.audioQueue = [], e.videoFrameNum = 0, e.videoRawData = null, e.audioRawData = null, e
  44861. .videoPacketData = null, e.audioPacketData = null, e.findKeyFrame = !0, e.videoIntervalHandle = -
  44862. 1, e.videoIntervalValue = 39, e.audioIntervalHandle = -1, e.audioIntervalValue = 80, e.lastPTS =
  44863. 0, e.ptsCount = 0, e.maxCacheFrameNum = 0, e.calcDelayFlag = !0, e.procVideoFlag = !1, e
  44864. .procAudioFlag = !1;
  44865. var t = function() {
  44866. null == e.videoRawData && (e.videoRawData = d._malloc(16588800)), null == e.audioRawData && (e
  44867. .audioRawData = d._malloc(16384)), null == e.videoPacketData && (e.videoPacketData = d
  44868. ._malloc(1048576)), null == e.audioPacketData && (e.audioPacketData = d._malloc(2048)), e
  44869. .wasmDecoderId < 0 && (e.wasmDecoderId = d._WasmDecoder_OpenChannel())
  44870. },
  44871. i = function(t, i, r, n, a, s, u, l, c, h) {
  44872. if (e.procVideoFlag) return -1;
  44873. e.procVideoFlag = !0, d.HEAPU8.set(l, e.videoPacketData);
  44874. var f, p = o.G,
  44875. m = 0;
  44876. p == o.G ? m = 0 : p == o.E ? m = 2 : p == o.F && (m = 26), 1 == t && e.videoFrameNum > 0 && (e
  44877. .videoFrameNum -= 1), 1 == t && !e.wasmInitVideoDecoder && r ? 0 == d
  44878. ._WasmDecoder_OpenVideoDecoder(e.wasmDecoderId, i, 0, 0, m) && (e.wasmInitVideoDecoder = !0) :
  44879. 2 != t || e.wasmInitAudioDecoder || 0 == d._WasmDecoder_OpenAudioDecoder(e.wasmDecoderId, i,
  44880. a, u, s) && (e.wasmInitAudioDecoder = !0);
  44881. var g = null;
  44882. if (1 == t && e.wasmInitVideoDecoder ? g = d._WasmDecoder_DecodeVideoFrame(e.wasmDecoderId, e
  44883. .videoPacketData, c, 0, 0, e.videoRawData, 0) : 2 == t && e.wasmInitAudioDecoder && e
  44884. .enableAudio && (g = d._WasmDecoder_DecodeAudioFrame(e.wasmDecoderId, e.videoPacketData, c, e
  44885. .audioRawData, 0)), 0 != g && null != g) {
  44886. var v = d.HEAPU32[g / 4],
  44887. y = (d.HEAPU32[g / 4 + 1], d.HEAPU32[g / 4 + 2]),
  44888. _ = (d.HEAPU32[g / 4 + 3], d.HEAPU32[g / 4 + 4]),
  44889. b = d.HEAPU32[g / 4 + 5],
  44890. w = (d.HEAPU32[g / 4 + 6], d.HEAPU32[g / 4 + 7]),
  44891. E = d.HEAPU32[g / 4 + 8],
  44892. T = d.HEAPU32[g / 4 + 9],
  44893. S = d.HEAPU32[g / 4 + 10],
  44894. A = d.HEAPU32[g / 4 + 11],
  44895. k = (d.HEAPU32[g / 4 + 12], d.HEAPU32[g / 4 + 13]);
  44896. if (y < 1) return void(e.procVideoFlag = !1);
  44897. if (1 == v) {
  44898. 0 == m ? f = _ * b * 3 / 2 : 2 == m ? f = _ * b * 3 : (25 == m || 26 == m) && (f = _ * b *
  44899. 4);
  44900. var R = d.HEAPU8.subarray(e.videoRawData, e.videoRawData + f),
  44901. M = new Uint8Array(R),
  44902. O = {
  44903. cmd: o.q,
  44904. workerId: o.a,
  44905. mediaType: 1,
  44906. ts: k,
  44907. width: _,
  44908. height: b,
  44909. framesize: c,
  44910. rawsize: f,
  44911. fps: w,
  44912. interval: E,
  44913. playTimeSec: n,
  44914. frameNum: e.videoFrameNum,
  44915. dat: M,
  44916. sei: h
  44917. };
  44918. if (e.postMessage(O, [O.dat.buffer]), _ >= 1920 && b >= 720) return e.procVideoFlag = !1, 1
  44919. } else if (2 == v) {
  44920. R = d.HEAPU8.subarray(e.audioRawData, e.audioRawData + y), M = new Uint8Array(R);
  44921. var C = 0;
  44922. 8 == A ? C = 0 : 16 == A ? C = 1 : 32 == A && (C = 2), O = {
  44923. cmd: o.q,
  44924. workerId: o.a,
  44925. mediaType: 2,
  44926. fmt: C,
  44927. ch: T,
  44928. samplerate: S,
  44929. ts: k,
  44930. framesize: y,
  44931. dat: M
  44932. }, e.postMessage(O, [O.dat.buffer])
  44933. }
  44934. }
  44935. return e.procVideoFlag = !1, 0
  44936. },
  44937. r = function(t, i, r, n, a, s) {
  44938. d.HEAPU8.set(a, e.audioPacketData), e.wasmInitAudioDecoder || 0 == d
  44939. ._WasmDecoder_OpenAudioDecoder(e.wasmDecoderId, t, i, n, r) && (e.wasmInitAudioDecoder = !0);
  44940. var u = null;
  44941. if (e.wasmInitAudioDecoder && e.enableAudio && (u = d._WasmDecoder_DecodeAudioFrame(e
  44942. .wasmDecoderId, e.audioPacketData, s, e.audioRawData, 0)), 0 != u && null != u) {
  44943. d.HEAPU32[u / 4], d.HEAPU32[u / 4 + 1];
  44944. var l = d.HEAPU32[u / 4 + 2],
  44945. c = (d.HEAPU32[u / 4 + 3], d.HEAPU32[u / 4 + 4], d.HEAPU32[u / 4 + 5], d.HEAPU32[u / 4 + 6],
  44946. d.HEAPU32[u / 4 + 7], d.HEAPU32[u / 4 + 8], d.HEAPU32[u / 4 + 9]),
  44947. h = d.HEAPU32[u / 4 + 10],
  44948. f = d.HEAPU32[u / 4 + 11],
  44949. p = (d.HEAPU32[u / 4 + 12], d.HEAPU32[u / 4 + 13]);
  44950. if (l < 1) return;
  44951. var m = d.HEAPU8.subarray(e.audioRawData, e.audioRawData + l),
  44952. g = new Uint8Array(m),
  44953. v = 0;
  44954. 8 == f ? v = 0 : 16 == f ? v = 1 : 32 == f && (v = 2);
  44955. var y = {
  44956. cmd: o.q,
  44957. workerId: o.a,
  44958. mediaType: 2,
  44959. fmt: v,
  44960. ch: c,
  44961. samplerate: h,
  44962. ts: p,
  44963. framesize: l,
  44964. dat: g
  44965. };
  44966. e.postMessage(y, [y.dat.buffer])
  44967. }
  44968. },
  44969. n = function() {
  44970. if (e.wasmDecoderId < 0 && t(), e.wasmDecoderId > 0 && e.videoQueue.length > 0 && !e.pause) {
  44971. var r = null,
  44972. n = -1;
  44973. if (e.isFlvStream) {
  44974. if (e.findKeyFrame)
  44975. for (; e.videoQueue.length > 0;) {
  44976. if ((r = e.videoQueue[0]).frameType && e.videoQueue.length < 120) {
  44977. e.findKeyFrame = !1;
  44978. break
  44979. }
  44980. e.videoQueue.shift()
  44981. } else e.videoQueue.length > 120 && (console.log("videoQueue.length: " + e.videoQueue
  44982. .length), e.findKeyFrame = !0);
  44983. e.videoQueue.length > 0 && (null == r && (r = e.videoQueue[0]), n = i(r.mediaType, r
  44984. .codecId, r.frameType, r.playTimeSec, r.samplerate, r.channelNum, r.bitPerSample, r
  44985. .dat, r.dat.length, r.sei))
  44986. } else r = e.videoQueue[0], n = i(r.mediaType, r.codecId, r.frameType, r.playTimeSec, r
  44987. .samplerate, r.channelNum, r.bitPerSample, r.dat, r.dat.length);
  44988. n >= 0 && e.videoQueue.shift(), e.videoQueue.length > e.maxCacheFrameNum && e.videoQueue
  44989. .length
  44990. }
  44991. },
  44992. a = function() {
  44993. if (!(e.wasmDecoderId < 0) && e.wasmDecoderId > 0)
  44994. for (; e.audioQueue.length > 0 && !e.pause;)
  44995. if (!e.pause) {
  44996. var t = e.audioQueue[0];
  44997. e.enableAudio && r(t.codecId, t.samplerate, t.channelNum, t.bitPerSample, t.dat, t.dat
  44998. .length), e.audioQueue.shift()
  44999. }
  45000. };
  45001. d.onRuntimeInitialized = function() {
  45002. e.videoIntervalHandle < 0 && (e.videoIntervalHandle = setInterval(n, e.videoIntervalValue)), e
  45003. .audioIntervalHandle < 0 && (e.audioIntervalHandle = setInterval(a, e.audioIntervalValue));
  45004. var t = {
  45005. cmd: o.n
  45006. };
  45007. e.postMessage(t), u = !0
  45008. }, d.onExit = function() {};
  45009. var f = function(t) {
  45010. if (t > e.lastPTS)
  45011. if (e.lastPTS > 0) {
  45012. if (e.videoQueue.length % 5 == 0) {
  45013. var i = e.ptsCount / 5;
  45014. e.videoQueue.length <= e.maxCacheFrameNum && function(t) {
  45015. if (u) {
  45016. var i = t;
  45017. (i < 5 || i > 500) && (i = 40), i != e.videoIntervalValue && (e
  45018. .videoIntervalHandle >= 0 && (clearInterval(e.videoIntervalHandle), e
  45019. .videoIntervalHandle = -1), e.videoIntervalValue = Math.floor(i), e
  45020. .videoIntervalHandle = setInterval(n, e.videoIntervalValue))
  45021. }
  45022. }(i), e.ptsCount = t - e.lastPTS
  45023. } else e.ptsCount += t - e.lastPTS;
  45024. e.lastPTS = t
  45025. } else e.lastPTS = t, e.ptsCount = 40;
  45026. else e.lastPTS = t, e.ptsCount = 40
  45027. };
  45028. e.addEventListener("message", function(i) {
  45029. var r = i.data;
  45030. switch (r.cmd) {
  45031. case o.w:
  45032. l = r.url, e.isFlvStream = r.isFlv, u || c();
  45033. break;
  45034. case o.l:
  45035. e.exitFlag = !0, h = null, e.videoIntervalHandle >= 0 && (clearInterval(e
  45036. .videoIntervalHandle), e.videoIntervalHandle = -1), e.audioIntervalHandle >= 0 && (
  45037. clearInterval(e.audioIntervalHandle), e.audioIntervalHandle = -1), e.wasmDecoderId >
  45038. 0 && (d._WasmDecoder_CloseChannel(e.wasmDecoderId), e.wasmDecoderId = -1), null != e
  45039. .videoRawData && (d._free(e.videoRawData), e.videoRawData = null), null != e
  45040. .audioRawData && (d._free(e.audioRawData), e.audioRawData = null), null != e
  45041. .videoPacketData && (d._free(e.videoPacketData), e.videoPacketData = null), null != e
  45042. .audioPacketData && (d._free(e.audioPacketData), e.audioPacketData = null), e.videoQueue
  45043. .clear, e.videoQueue = [], e.videoQueue.length = 0, e.videoFrameNum = 0, e.audioQueue
  45044. .clear, e.audioQueue = [], e.audioQueue.length = 0, delete d.HEAP8, delete d.HEAP16,
  45045. delete d.HEAP32, delete d.HEAPF32, delete d.HEAPF64, delete d.HEAPU8, delete d.HEAPU16,
  45046. delete d.HEAPU32, delete d.buffer, d.HEAP8 = null, d.HEAP16 = null, d.HEAP32 = null, d
  45047. .HEAPF32 = null, d.HEAPF64 = null, d.HEAPU8 = null, d.HEAPU16 = null, d.HEAPU32 = null,
  45048. d.buffer = null, s = !1, d.callMain("exit"), d = null;
  45049. var n = {
  45050. cmd: o.l,
  45051. workerId: o.a
  45052. };
  45053. e.postMessage(n), close();
  45054. break;
  45055. case o.v:
  45056. e.enableAudio = !0;
  45057. break;
  45058. case o.k:
  45059. e.enableAudio = !1;
  45060. break;
  45061. case o.x:
  45062. e.pause = !0;
  45063. break;
  45064. case o.A:
  45065. e.pause = !1;
  45066. break;
  45067. case o.B:
  45068. e.videoQueue.clear, e.videoQueue = [], e.videoQueue.length = 0, e.videoFrameNum = 0, e
  45069. .audioQueue.clear, e.audioQueue = [], e.audioQueue.length = 0;
  45070. break;
  45071. case o.D:
  45072. e.updateIntervalTime(r.interval);
  45073. break;
  45074. case o.q:
  45075. if (e.exitFlag) break;
  45076. u ? e.isFlvStream ? (e.wasmDecoderId < 0 && t(), e.wasmDecoderId > 0 ? 1 == r.mediaType ?
  45077. e.videoIntervalHandle >= 0 && (e.videoQueue.push(r), e.maxCacheFrameNum = 5) : 2 == r
  45078. .mediaType && e.audioIntervalHandle >= 0 && !e.findKeyFrame && e.audioQueue.push(r) :
  45079. e.videoQueue.length < 100 && 1 == r.mediaType && r.frameType && e
  45080. .videoIntervalHandle >= 0 && (e.videoQueue.push(r), e.videoQueue.length >= 5 && e
  45081. .videoQueue.shift())) : (1 == r.mediaType ? e.videoIntervalHandle >= 0 && (e
  45082. .videoQueue.push(r), f(r.samplerate), e.videoFrameNum += 1, e.calcDelayFlag && e
  45083. .maxCacheFrameNum < e.videoQueue.length ? e.maxCacheFrameNum = e.videoQueue.length :
  45084. e.calcDelayFlag && (e.calcDelayFlag = !1)) : 2 == r.mediaType && e
  45085. .audioIntervalHandle >= 0 && e.audioQueue.push(r), e.needMoreData = !1) : e
  45086. .isFlvStream && e.videoQueue.length < 5 ? 1 == r.mediaType && r.frameType && e
  45087. .videoIntervalHandle >= 0 && (e.videoQueue.push(r), e.videoQueue.length >= 5 && e
  45088. .videoQueue.shift()) : !e.isFlvStream && e.videoQueue.length < 1e3 && (1 == r
  45089. .mediaType ? e.videoIntervalHandle >= 0 && (e.videoQueue.push(r), f(r.samplerate), e
  45090. .videoFrameNum += 1, e.calcDelayFlag && e.maxCacheFrameNum < e.videoQueue.length ? e
  45091. .maxCacheFrameNum = e.videoQueue.length : e.calcDelayFlag && (e.calcDelayFlag = !1)
  45092. ) : 2 == r.mediaType && e.audioIntervalHandle >= 0 && e.audioQueue.push(r))
  45093. }
  45094. })
  45095. };
  45096. t.default = h;
  45097. var f = d,
  45098. p = c,
  45099. m = u
  45100. }.call(this, i(9), "/", i(68)(e), i(10).Buffer)
  45101. }, function(e, t, i) {
  45102. "use strict";
  45103. i.r(t);
  45104. var r = i(43),
  45105. n = i(37),
  45106. a = {
  45107. enableWorker: !1,
  45108. enableStashBuffer: !0,
  45109. stashInitialSize: void 0,
  45110. isLive: !1,
  45111. lazyLoad: !0,
  45112. lazyLoadMaxDuration: 180,
  45113. lazyLoadRecoverDuration: 30,
  45114. deferLoadAfterSourceOpen: !0,
  45115. autoCleanupMaxBackwardDuration: 180,
  45116. autoCleanupMinBackwardDuration: 120,
  45117. statisticsInfoReportInterval: 600,
  45118. fixAudioTimestampGap: !0,
  45119. accurateSeek: !1,
  45120. seekType: "range",
  45121. seekParamStart: "bstart",
  45122. seekParamEnd: "bend",
  45123. rangeLoadZeroStart: !1,
  45124. customSeekHandler: void 0,
  45125. reuseRedirectedURL: !1,
  45126. headers: void 0,
  45127. customLoader: void 0
  45128. };
  45129. function s() {
  45130. return Object.assign({}, a)
  45131. }
  45132. var o = function() {
  45133. function e() {}
  45134. return e.supportMSEH264Playback = function() {
  45135. return window.MediaSource && window.MediaSource.isTypeSupported(
  45136. 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"')
  45137. }, e.supportNetworkStreamIO = function() {
  45138. var e = new n.a({}, s()),
  45139. t = e.loaderType;
  45140. return e.destroy(), "fetch-stream-loader" == t || "xhr-moz-chunked-loader" == t
  45141. }, e.getNetworkLoaderTypeName = function() {
  45142. var e = new n.a({}, s()),
  45143. t = e.loaderType;
  45144. return e.destroy(), t
  45145. }, e.supportNativeMediaPlayback = function(t) {
  45146. null == e.videoElement && (e.videoElement = window.document.createElement("video"));
  45147. var i = e.videoElement.canPlayType(t);
  45148. return "probably" === i || "maybe" == i
  45149. }, e.getFeatureList = function() {
  45150. var t = {
  45151. mseFlvPlayback: !1,
  45152. mseLiveFlvPlayback: !1,
  45153. networkStreamIO: !1,
  45154. networkLoaderName: "",
  45155. nativeMP4H264Playback: !1,
  45156. nativeWebmVP8Playback: !1,
  45157. nativeWebmVP9Playback: !1
  45158. };
  45159. return t.mseFlvPlayback = e.supportMSEH264Playback(), t.networkStreamIO = e
  45160. .supportNetworkStreamIO(), t.networkLoaderName = e.getNetworkLoaderTypeName(), t
  45161. .mseLiveFlvPlayback = t.mseFlvPlayback && t.networkStreamIO, t.nativeMP4H264Playback = e
  45162. .supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"'), t
  45163. .nativeWebmVP8Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"'), t
  45164. .nativeWebmVP9Playback = e.supportNativeMediaPlayback('video/webm; codecs="vp9"'), t
  45165. }, e
  45166. }(),
  45167. u = i(3),
  45168. l = (i(128), i(8)),
  45169. d = i.n(l),
  45170. c = i(0),
  45171. h = i(7),
  45172. f = {
  45173. ERROR: "error",
  45174. LOADING_COMPLETE: "loading_complete",
  45175. RECOVERED_EARLY_EOF: "recovered_early_eof",
  45176. MEDIA_INFO: "media_info",
  45177. METADATA_ARRIVED: "metadata_arrived",
  45178. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  45179. STATISTICS_INFO: "statistics_info"
  45180. },
  45181. p = i(21),
  45182. m = i.n(p),
  45183. g = i(19),
  45184. v = i(36),
  45185. y = i(2),
  45186. _ = i(17),
  45187. b = i(1),
  45188. w = {
  45189. ERROR: "error",
  45190. SOURCE_OPEN: "source_open",
  45191. UPDATE_END: "update_end",
  45192. BUFFER_FULL: "buffer_full",
  45193. UPDATE_PLAY_INFO: "update_play_info",
  45194. CHANGE_SPEED: "change_speed",
  45195. SOURCE_ENDED: "source_ended",
  45196. RECORDING_END: "recording_end"
  45197. },
  45198. E = function() {
  45199. function e(e) {
  45200. this.gl = e, this.texture = null
  45201. }
  45202. var t = e.prototype;
  45203. return t.create = function() {
  45204. var e = this.gl;
  45205. this.texture = e.createTexture(), this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture), this.gl
  45206. .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR), this.gl
  45207. .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR), this.gl
  45208. .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE), this.gl
  45209. .texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE)
  45210. }, t.bind = function(e, t, i) {
  45211. this.gl.activeTexture([this.gl.TEXTURE0, this.gl.TEXTURE1, this.gl.TEXTURE2, this.gl.TEXTURE3][e]),
  45212. this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture), this.gl.uniform1i(this.gl
  45213. .getUniformLocation(t, i), e)
  45214. }, t.fill = function(e, t, i) {
  45215. this.gl.bindTexture(this.gl.TEXTURE_2D, this.texture), this.gl.texImage2D(this.gl.TEXTURE_2D, 0,
  45216. this.gl.LUMINANCE, e, t, 0, this.gl.LUMINANCE, this.gl.UNSIGNED_BYTE, i)
  45217. }, e
  45218. }(),
  45219. T = function() {
  45220. function e(e) {
  45221. this.enableTextTexture = 0, this.canvas = e, this.gl = null, this.program = null, this.gl = e
  45222. .getContext("webgl") || e.getContext("experimental-webgl"), this.yuv_vertex_shader_source = [
  45223. "attribute highp vec4 aVertexPosition;", "attribute vec2 aTextureCoord;",
  45224. "varying highp vec2 vTextureCoord;", "void main(void) {", " gl_Position = aVertexPosition;",
  45225. " vTextureCoord = aTextureCoord;", "}"
  45226. ], this.yuv_fragment_shader_source = ["precision highp float;", "varying lowp vec2 vTextureCoord;",
  45227. "uniform sampler2D YTexture;", "uniform sampler2D UTexture;", "uniform sampler2D VTexture;",
  45228. "uniform sampler2D TTexture;", "const mat4 YUV2RGB = mat4", "(",
  45229. " 1.1643828125, 0, 1.59602734375, -.87078515625,",
  45230. " 1.1643828125, -.39176171875, -.81296875, .52959375,",
  45231. " 1.1643828125, 2.017234375, 0, -1.081390625,", " 0, 0, 0, 1", ");", "void main(void) {",
  45232. " gl_FragColor = mix(vec4( texture2D(YTexture, vTextureCoord).x, texture2D(UTexture, vTextureCoord).x, texture2D(VTexture, vTextureCoord).x, 1) * YUV2RGB, texture2D(TTexture, vTextureCoord), 0.1);",
  45233. "}"
  45234. ], this.vertex_shader_source =
  45235. "\n attribute vec4 apos;\n void main(){\n gl_Position = apos;\n }",
  45236. this.frag_shader_source =
  45237. "\n void main(){\n gl_FragColor = vec4(0,0,1,1);\n }", this
  45238. .yuv_program = null, this.sei_program = null, this.index = 0
  45239. }
  45240. var t = e.prototype;
  45241. return t.initSEIProgram = function() {
  45242. var e = this.gl,
  45243. t = e.createShader(e.VERTEX_SHADER),
  45244. i = e.createShader(e.FRAGMENT_SHADER);
  45245. e.shaderSource(t, this.vertex_shader_source), e.shaderSource(i, this.frag_shader_source), e
  45246. .compileShader(t), e.compileShader(i), this.sei_program = e.createProgram(), e.attachShader(this
  45247. .sei_program, t), e.attachShader(this.sei_program, i), e.linkProgram(this.sei_program)
  45248. }, t.drawSEI = function(e) {
  45249. var t = this.gl,
  45250. i = [];
  45251. if ("string" == typeof e && (e = JSON.parse(e)), e && e.length) {
  45252. e.forEach(function(e) {
  45253. var t = parseFloat((2 * e.x1 - 1).toFixed(2)),
  45254. r = parseFloat((1 - 2 * e.y1).toFixed(2)),
  45255. n = parseFloat((2 * e.x2 - 1).toFixed(2)),
  45256. a = parseFloat((1 - 2 * e.y2).toFixed(2));
  45257. i = [].concat(i, [t, r, t, a, n, a, n, r])
  45258. });
  45259. var r = new Float32Array(i);
  45260. if (r.length) {
  45261. t.useProgram(this.sei_program);
  45262. var n = t.getAttribLocation(this.sei_program, "apos"),
  45263. a = t.createBuffer();
  45264. t.bindBuffer(t.ARRAY_BUFFER, a), t.bufferData(t.ARRAY_BUFFER, r, t.STATIC_DRAW), t
  45265. .vertexAttribPointer(n, 2, t.FLOAT, !1, 0, 0), t.enableVertexAttribArray(n);
  45266. for (var s = 0; s < r.length / 2; s += 4) t.drawArrays(t.LINE_LOOP, s, 4)
  45267. }
  45268. }
  45269. }, t.initYUVProgram = function() {
  45270. var e = this.gl;
  45271. if (!this.gl) return console.log("[ER] WebGL not supported.");
  45272. e.pixelStorei(e.UNPACK_ALIGNMENT, 1), this.yuv_program = e.createProgram();
  45273. var t = e.createShader(e.VERTEX_SHADER),
  45274. i = e.createShader(e.FRAGMENT_SHADER);
  45275. e.shaderSource(t, this.yuv_vertex_shader_source.join("\n")), e.shaderSource(i, this
  45276. .yuv_fragment_shader_source.join("\n")), e.compileShader(t), e.compileShader(i), e.attachShader(
  45277. this.yuv_program, t), e.attachShader(this.yuv_program, i), e.linkProgram(this.yuv_program)
  45278. }, t.drawYUV = function(e, t, i, r, n) {
  45279. var a = this.gl;
  45280. if (a.useProgram(this.yuv_program), !a.getProgramParameter(this.yuv_program, a.LINK_STATUS))
  45281. return console.log("[ER] Shader link failed.");
  45282. var s = a.getAttribLocation(this.yuv_program, "aVertexPosition");
  45283. a.enableVertexAttribArray(s);
  45284. var o = a.getAttribLocation(this.yuv_program, "aTextureCoord");
  45285. a.enableVertexAttribArray(o);
  45286. var u = a.createBuffer();
  45287. a.bindBuffer(a.ARRAY_BUFFER, u), a.bufferData(a.ARRAY_BUFFER, new Float32Array([1, 1, 0, -1, 1, 0,
  45288. 1, -1, 0, -1, -1, 0
  45289. ]), a.STATIC_DRAW), a.vertexAttribPointer(s, 3, a.FLOAT, !1, 0, 0);
  45290. var l = a.createBuffer();
  45291. a.bindBuffer(a.ARRAY_BUFFER, l), a.bufferData(a.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0,
  45292. 1
  45293. ]), a.STATIC_DRAW), a.vertexAttribPointer(o, 2, a.FLOAT, !1, 0, 0), a.y = new E(a), a.y.create(0,
  45294. null), a.u = new E(a), a.u.create(0, null), a.v = new E(a), a.v.create(0, null), a.y.bind(0,
  45295. this.yuv_program, "YTexture"), a.u.bind(1, this.yuv_program, "UTexture"), a.v.bind(2, this
  45296. .yuv_program, "VTexture"), a.y.fill(t, i, e.subarray(0, r)), a.u.fill(t >> 1, i >> 1, e
  45297. .subarray(r, r + n)), a.v.fill(t >> 1, i >> 1, e.subarray(r + n, e.length)), a.drawArrays(a
  45298. .TRIANGLE_STRIP, 0, 4)
  45299. }, t.initGL = function() {
  45300. this.initYUVProgram(), this.initSEIProgram()
  45301. }, t.renderFrame = function(e, t, i, r, n, a) {
  45302. if (!this.gl) return console.log("[ER] Render frame failed due to WebGL not supported.");
  45303. var s = this.gl;
  45304. s.viewport(0, 0, s.canvas.width, s.canvas.height), s.clearColor(0, 0, 0, 0), s.clear(s
  45305. .COLOR_BUFFER_BIT), e && (this.drawYUV(e, t, i, r, n), this.drawSEI(a))
  45306. }, t.renderVideoFrame = function(e, t, i, r) {
  45307. if (this.gl && e)
  45308. if (t < 1 || i < 1) {
  45309. var n = this.gl,
  45310. a = new Uint8Array(n.canvas.width * n.canvas.height * 3 / 2),
  45311. s = 0,
  45312. o = n.canvas.width * n.canvas.height,
  45313. u = n.canvas.width * n.canvas.height * 5 / 4,
  45314. l = a.byteLength;
  45315. for (s = o; s < u; s++) a[s] = 128;
  45316. for (s = u; s < l; s++) a[s] = 128;
  45317. var d = n.canvas.width * n.canvas.height,
  45318. c = n.canvas.width / 2 * (n.canvas.height / 2);
  45319. this.renderFrame(a, n.canvas.width, n.canvas.height, d, c, r)
  45320. } else {
  45321. var h = t * i,
  45322. f = t / 2 * (i / 2);
  45323. this.renderFrame(e, t, i, h, f, r)
  45324. }
  45325. }, t.destroy = function() {
  45326. this.gl && (this.gl.deleteTexture(this.gl.y.texture), this.gl.deleteTexture(this.gl.u.texture), this
  45327. .gl.deleteTexture(this.gl.v.texture), this.yuv_program = null, this.sei_program = null, this
  45328. .gl = null)
  45329. }, e
  45330. }(),
  45331. S = function() {
  45332. function e() {
  45333. this._pause = !1, this.stopFlag = !1, this.bufferSourcePtr = null
  45334. }
  45335. var t = e.prototype;
  45336. return t.destroy = function() {
  45337. this.interval && clearInterval(this.interval), this.samples = null, this.audioCtx.close(), this
  45338. .audioCtx = null
  45339. }, t.init = function(e) {
  45340. this.option = Object.assign({}, {
  45341. encoding: "16bitInt",
  45342. channels: 2,
  45343. sampleRate: 8e3,
  45344. flushingTime: 1e3
  45345. }, e, {
  45346. sampleRate: 8e3 === e.sampleRate ? 16e3 : e.sampleRate
  45347. }), this.samples = new Float32Array, this.flush = this.flush.bind(this), this.interval =
  45348. setInterval(this.flush, this.option.flushingTime), this.maxValue = this.getMaxValue(), this
  45349. .typedArray = this.getTypedArray(), this.createContext()
  45350. }, t.getMaxValue = function() {
  45351. var e = {
  45352. "8bitInt": 128,
  45353. "16bitInt": 32768,
  45354. "32bitInt": 2147483648,
  45355. "32bitFloat": 1
  45356. };
  45357. return e[this.option.encoding] ? e[this.option.encoding] : e["16bitInt"]
  45358. }, t.getTypedArray = function() {
  45359. var e = {
  45360. "8bitInt": Int8Array,
  45361. "16bitInt": Int16Array,
  45362. "32bitInt": Int32Array,
  45363. "32bitFloat": Float32Array
  45364. };
  45365. return e[this.option.encoding] ? e[this.option.encoding] : e["16bitInt"]
  45366. }, t.createContext = function() {
  45367. this.audioCtx = new(window.AudioContext || window.webkitAudioContext), this.gainNode = this.audioCtx
  45368. .createGain(), this.gainNode.gain.value = 1, this.gainNode.connect(this.audioCtx.destination),
  45369. this.startTime = this.audioCtx.currentTime
  45370. }, t.isTypedArray = function(e) {
  45371. return e.byteLength && e.buffer && e.buffer.constructor == ArrayBuffer
  45372. }, t.feed = function(e) {
  45373. if (this.isTypedArray(e)) {
  45374. e = this.getFormatedValue(e);
  45375. var t = new Float32Array(this.samples.length + e.length);
  45376. t.set(this.samples, 0), t.set(e, this.samples.length), this.samples = t
  45377. }
  45378. }, t.getFormatedValue = function(e) {
  45379. e = new this.typedArray(e.buffer);
  45380. var t, i = new Float32Array(e.length);
  45381. for (t = 0; t < e.length; t++) i[t] = e[t] / this.maxValue;
  45382. return i
  45383. }, t.volume = function(e) {
  45384. this.gainNode.gain.value = e
  45385. }, t.flush = function() {
  45386. if (null != this.samples && this.samples.length) {
  45387. var e, t, i, r, n, a = this.audioCtx.createBufferSource(),
  45388. s = this.samples.length / this.option.channels,
  45389. o = this.audioCtx.createBuffer(this.option.channels, s, this.option.sampleRate);
  45390. for (t = 0; t < this.option.channels; t++)
  45391. for (e = o.getChannelData(t), i = t, n = 50, r = 0; r < s; r++) e[r] = this.samples[i], r <
  45392. 50 && (e[r] = e[r] * r / 50), r >= s - 51 && (e[r] = e[r] * n--
  45393. /50),i+=this.option.channels;this.startTime<this.audioCtx.currentTime&&(this.startTime=this.audioCtx.currentTime),a.buffer=o,a.connect(this.gainNode),a.start(this.startTime),this.startTime+=o.duration,this.samples=new Float32Array}},t.getTimestamp=function(){return this.audioCtx?this.audioCtx.currentTime:0},t.play=function(e){if(null!=this.audioCtx&&!this._pause){if("running"!==this.audioCtx.state)return this.audioCtx.resume();if(this.isTypedArray(e)&&(e=this.getFormatedValue(e)).length){this.stopFlag=!1;var t,i,r,n,a,s,o=this.audioCtx.createBufferSource(),u=e.length/this
  45394. .option.channels;
  45395. try {
  45396. t = this.audioCtx.createBuffer(this.option.channels, u, this.option.sampleRate)
  45397. } catch (e) {
  45398. console.log("audioBuffer", e)
  45399. }
  45400. for (r = 0; r < this.option.channels; r++)
  45401. for (i = t.getChannelData(r), n = r, s = 50, a = 0; a < u; a++) i[a] = e[n], a < 50 && (i[
  45402. a] = i[a] * a / 50), a >= u - 51 && (i[a] = i[a] * s--
  45403. /50),n+=this.option.channels;this.startTime<this.audioCtx.currentTime&&(this.startTime=this.audioCtx.currentTime),o.buffer=t,o.connect(this.gainNode),o.start(this.startTime),this.startTime+=t.duration,this.bufferSourcePtr=o}}},t.clearAudioBuffer=function(){this.stopFlag=!0,this.bufferSourcePtr&&this.bufferSourcePtr.stop(0)},t.pause=function(){this._pause=!0,null!=this.audioCtx&&"running"===this.audioCtx.state&&this.audioCtx.suspend()},t.resume=function(){this._pause=!1,null!=this.audioCtx&&"suspended"===this.audioCtx.state&&this.audioCtx.resume()},e}();function A(){A=function(){return e};var e={},t=Object.prototype,i=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function o(e,t,i){return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(e){o=function(e,t,i){return e[t]=i}}function u(e,t,i,r){var n=t&&t.prototype instanceof c?t:c,a=Object.create(n.prototype),s=new T(r||[]);return a._invoke=function(e,t,i){var r="suspendedStart";return function(n,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===n)throw a;return{value:void 0,done:!0}}for(i.method=n,i.arg=a;;){var s=i.delegate;if(s){var o=b(s,i);if(o){if(o===d)continue;return o}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===r)throw r="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);r="executing";var u=l(e,t,i);if("normal"===u.type){if(r=i.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:i.done}}"throw"===u.type&&(r="completed",i.method="throw",i.arg=u.arg)}}}(e,i,s),a}function l(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var d={};function c(){}function h(){}function f(){}var p={};o(p,n,function(){return this});var m=Object.getPrototypeOf,g=m&&m(m(S([])));g&&g!==t&&i.call(g,n)&&(p=g);var v=f.prototype=c.prototype=Object.create(p);function y(e){["next","throw","return"].forEach(function(t){o(e,t,function(e){return this._invoke(t,e)})})}function _(e,t){var r;this._invoke=function(n,a){function s(){return new t(function(r,s){!function r(n,a,s,o){var u=l(e[n],e,a);if("throw"!==u.type){var d=u.arg,c=d.value;return c&&"object"==typeof c&&i.call(c,"__await")?t.resolve(c.__await).then(function(e){r("next",e,s,o)},function(e){r("throw",e,s,o)}):t.resolve(c).then(function(e){d.value=e,s(d)},function(e){return r("throw",e,s,o)})}o(u.arg)}(n,a,r,s)})}return r=r?r.then(s,s):s()}}function b(e,t){var i=e.iterator[t.method];if(void 0===i){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=l(i,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var n=r.arg;return n?n.done?(t[e.resultName]=n.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):n:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function S(e){if(e){var t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:k}}function k(){return{value:void 0,done:!0}}return h.prototype=f,o(v,"constructor",f),o(f,"constructor",h),h.displayName=o(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(_.prototype),o(_.prototype,a,function(){return this}),e.AsyncIterator=_,e.async=function(t,i,r,n,a){void 0===a&&(a=Promise);var s=new _(u(t,i,r,n),a);return e.isGeneratorFunction(i)?s:s.next().then(function(e){return e.done?e.value:s.next()})},y(v),o(v,s,"Generator"),o(v,n,function(){return this}),o(v,"toString",function(){return"[object Generator]"}),e.keys=function(e){var t=[];for(var i in e)t.push(i);return t.reverse(),function i(){for(;t.length;){var r=t.pop();if(r in e)return i.value=r,i.done=!1,i}return i.done=!0,i}},e.values=S,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(i,r){return s.type="throw",s.arg=e,t.next=i,r&&(t.method="next",t.arg=void 0),!!r}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),d},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),E(i),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var r=i.completion;if("throw"===r.type){var n=r.arg;E(i)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:S(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),d}},e}function k(e,t,i,r,n,a,s){try{var o=e[a](s),u=o.value}catch(e){return void i(e)}o.done?t(u):Promise.resolve(u).then(r,n)}var R=function(){function e(e,t,i){var r=this;if(this.TAG="Transmuxer",this._emitter=new d.a,t.enableWorker&&"undefined"!=typeof Worker)try{this._worker=m()(228),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[e,t]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},g.a.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:g.a.getConfig()})}catch(i){c.a.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new v.a(e,t)}else this._controller=new v.a(e,t);if(this._controller){var n=this._controller;n.on(y.a.IO_ERROR,this._onIOError.bind(this)),n.on(y.a.DEMUX_ERROR,this._onDemuxError.bind(this)),n.on(y.a.INIT_SEGMENT,this._onInitSegment.bind(this)),n.on(y.a.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),n.on(y.a.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),n.on(y.a.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),n.on(y.a.MEDIA_INFO,this._onMediaInfo.bind(this)),n.on(y.a.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),n.on(y.a.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),n.on(y.a.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),n.on(y.a.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this)),n.on(y.a.SEI_DATA,this._onReceiveSEIData.bind(this)),n.on(y.a.AUDIO_ERROR,this._onAudioError.bind(this)),n.on(y.a.SOCKET_CLOSE,function(){return r._emitter.emit(w.SOURCE_ENDED)}),n.on(y.a.RECORDING,function(e){r._emitter.emit(y.a.RECORDING,e)}),n.on("loaderChunkArrival",function(e){return r._emitter.emit("loaderChunkArrival",e)}),n.on("hls_error",function(){return r._emitter.emit("hls_error")})}this._wasmDecodeWoker=null,this._wasmRecordingWoker=null,this._mediaCanvas=null,this._mediaElement=i,this._webGLPlayer=null,this._isH265=!1,this._totalDuration=0,this._initDuration=0,this._currentPlayTime=0,this.snapshotTimer=null,this.loadingCompleteTimer=null,this._wasmMuted=!1,this._isFlv=e.url.includes(".flv"),this._videoRecordFindKeyframe=!0,this._videoRecordFileName="record.mp4",this._wasmVideoRecordWorker=null,this._videoRecordiInitFlag=!1,this._wasmAudioPlayer=null,this._wasmAudioFmt=0,this._wasmAudioSamplerate=0,this._wasmAudioChannelNum=1,this._wasmInitAudioPlayer=!1,this._wasmRecordingCb=null}var t=e.prototype;return t.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),g.a.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._wasmDecodeWoker&&(this._wasmDecodeWoker.removeAllListeners&&this._wasmDecodeWoker.removeAllListeners(),this._wasmDecodeWoker.postMessage({cmd:b.l}),this._wasmDecodeWoker&&this._wasmDecodeWoker.terminate(),this._wasmDecodeWoker=null),this._wasmRecordingWoker&&(this._wasmRecordingWoker.removeAllListeners&&this._wasmRecordingWoker.removeAllListeners(),this._wasmRecordingWoker.postMessage({cmd:b.l}),this._wasmRecordingWoker&&this._wasmRecordingWoker.terminate(),this._wasmRecordingWoker=null),this._emitter.removeAllListeners(),this._emitter=null,this._mediaCanvas&&this._mediaCanvas.parentNode.removeChild(this._mediaCanvas),this._mediaCanvas=null,this._mediaElement=null,this._webGLPlayer=null,this.snapshotTimer&&clearTimeout(this.snapshotTimer),this.loadingCompleteTimer&&clearTimeout(this.loadingCompleteTimer),this.snapshotTimer=null,this.loadingCompleteTimer=null,this._wasmAudioPlayer=null,this._wasmRecordingCb=null},t.on=function(e,t){this._emitter.addListener(e,t)},t.off=function(e,t){this._emitter.removeListener(e,t)},t.hasWorker=function(){return null!=this._worker},t.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):(this._controller.setReceiveH265MediaFrame(this._onReceiveH265MediaFrame.bind(this)),this._controller.start())},t.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},t.seek=function(e){this._worker?this._worker.postMessage({cmd:"seek",param:e}):this._controller.seek(e)},t.pause=function(){if(this._isH265){var e={cmd:b.x};this._wasmDecodeWoker&&void 0!==this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(e)}else this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},t.resume=function(){if(this._isH265){var e={cmd:b.A};this._wasmDecodeWoker&&void 0!==this._wasmDecodeWoker&&this._wasmDecodeWoker.postMessage(e)}else this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},t._onInitSegment=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.INIT_SEGMENT,e,t)})},t._onMediaSegment=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.MEDIA_SEGMENT,e,t)})},t._onLoadingComplete=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(y.a.LOADING_COMPLETE)})},t._onRecoveredEarlyEof=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(y.a.RECOVERED_EARLY_EOF)})},t._onMediaInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.MEDIA_INFO,e)})},t._onMetaDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.METADATA_ARRIVED,e)})},t._onScriptDataArrived=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.SCRIPTDATA_ARRIVED,e)})},t._onStatisticsInfo=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.STATISTICS_INFO,e)})},t._onIOError=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.IO_ERROR,e,t)})},t._onDemuxError=function(e,t){var i=this;Promise.resolve().then(function(){i._emitter.emit(y.a.DEMUX_ERROR,e,t)})},t._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.RECOMMEND_SEEKPOINT,e)})},t._onRecommendSeekpoint=function(e){var t=this;Promise.resolve().then(function(){t._emitter.emit(y.a.RECOMMEND_SEEKPOINT,e)})},t._encodedH265=function(){var e=this;Promise.resolve().then(function(){e._emitter.emit(y.a.IS_ENCODED_H265,e._isH265)})},t._onLoggingConfigChanged=function(e){this._worker&&this._worker.postMessage({cmd:"logging_config",param:e})},t._onWorkerMessage=function(e){var t=e.data,i=t.data;if("destroyed"===t.msg||this._workerDestroying)return this._workerDestroying=!1,this._worker.terminate(),void(this._worker=null);switch(t.msg){case y.a.INIT_SEGMENT:case y.a.MEDIA_SEGMENT:this._emitter.emit(t.msg,i.type,i.data);break;case y.a.LOADING_COMPLETE:case y.a.RECOVERED_EARLY_EOF:this._emitter.emit(t.msg);break;case y.a.MEDIA_INFO:Object.setPrototypeOf(i,_.a.prototype),this._emitter.emit(t.msg,i);break;case y.a.METADATA_ARRIVED:case y.a.SCRIPTDATA_ARRIVED:case y.a.STATISTICS_INFO:this._emitter.emit(t.msg,i);break;case y.a.IO_ERROR:case y.a.DEMUX_ERROR:this._emitter.emit(t.msg,i.type,i.info);break;case y.a.RECOMMEND_SEEKPOINT:this._emitter.emit(t.msg,i);break;case"logcat_callback":c.a.emitter.emit("log",i.type,i.logcat)}},t._onReceiveSEIData=function(e){this._emitter.emit(y.a.SEI_DATA,e)},t._onAudioError=function(){this._emitter.emit(y.a.AUDIO_ERROR)},t._creatCanvas=function(){var e=this;this._mediaElement.parentNode.style.position="relative";var t=document.createElement("canvas");t.style="width:100%;height:100%;position:absolute;top:0px;left:0px;display:none",this._mediaCanvas=t,this._mediaElement.parentNode.appendChild(this._mediaCanvas),this._mediaCanvas.ondblclick=function(){return e._emitter.emit(y.a.ON_DBL_CLICK)}},t._onReceiveH265MediaFrame=function(){var e,t=(e=A().mark(function e(t,i,r,n,a,s,o,u,l,d,c,h){var f,p,m,g;return A().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isH265||(this._isH265=!0,this._encodedH265(),this._creatCanvas()),!(n<1)||i||1!==o){e.next=3;break}return e.abrupt("return");case 3:if(2===r&&(this._wasmAudioSamplerate=l||0,this._wasmAudioChannelNum=d),null!==this._wasmDecodeWoker){e.next=7;break}return e.next=7,this._createWasmDecodeWorker();case 7:if(!this._wasmDecodeWoker){e.next=15;break}if(f=new Uint8Array(s),p={cmd:b.q,mediaType:r,codecId:n,frameType:a,samplerate:l,channelNum:d,bitPerSample:c,playTimeSec:u,dat:f,sei:h},this._wasmDecodeWoker.postMessage(p,[p.dat.buffer]),this._videoRecordiInitFlag){e.next=13;break}return e.abrupt("return");case 13:1==a&&(this._videoRecordFindKeyframe=!1),this._wasmVideoRecordWorker&&!this._videoRecordFindKeyframe&&(m=new Uint8Array(s),g={cmd:b.q,mediaType:"video",type:1==a,dat:m,pts:u},1===r?(g.mediaType="video",g.codecId="0xAE"):2===r&&(g.mediaType="audio"),this._wasmVideoRecordWorker.postMessage(g,[g.dat.buffer]));case 15:case"end":return e.stop()}},e,this)}),function(){var t=this,i=arguments;return new Promise(function(r,n){var a=e.apply(t,i);function s(e){k(a,r,n,s,o,"next",e)}function o(e){k(a,r,n,s,o,"throw",e)}s(void 0)})});return function(e,i,r,n,a,s,o,u,l,d,c,h){return t.apply(this,arguments)}}(),t._createWasmDecodeWorker=function(){if("undefined"!=typeof Worker)try{"none"===this._mediaCanvas.style.display&&(this._mediaCanvas.style.display="block"),this._wasmDecodeWoker=m()(229);var e={cmd:b.w,url:b.g(),isFlv:this._isFlv};this._wasmDecodeWoker.postMessage(e),this._wasmDecodeWoker.addEventListener("message",this._onWasmWorkerMessage.bind(this)),this._wasmDecodeWoker.onerror=function(e){}}catch(e){this._wasmDecodeWoker=null}else this._wasmDecodeWoker=null;this._wasmDecodeWoker&&null==this._webGLPlayer&&(this._webGLPlayer=new T(this._mediaCanvas),this._webGLPlayer&&this._webGLPlayer.initGL({preserveDrawingBuffer:!1}))},t._onWasmWorkerMessage=function(e){var t=e.data;switch(t.cmd){case b.o:case b.l:break;case b.n:this._wasmMuted&&this._openWasmAudio();break;case b.q:if(t.workerId===b.a)if(1===t.mediaType){if(this._mediaCanvas&&(this._mediaCanvas.width=t.width),this._mediaCanvas&&(this._mediaCanvas.height=t.height),t.playTimeSec>0){var i=Math.floor((t.playTimeSec+1e3)/
  45404. 1e3); this._currentPlayTime !== i && (this._initDuration > 0 && (this
  45405. ._currentPlayTime += i - this._initDuration), this._initDuration !== i && (this
  45406. ._initDuration = i, this._emitter && this._emitter.emit(w.UPDATE_PLAY_INFO)))
  45407. }
  45408. this._webGLPlayer && this._webGLPlayer.renderVideoFrame(t.dat, t.width, t.height, t.sei)
  45409. } else 2 === t.mediaType && (null === this._wasmAudioPlayer ? this._creatWasmAudioPlayer(t.fmt, t
  45410. .samplerate >= 16e3 ? 2 : t.ch, t.samplerate) : (this._wasmAudioFmt = t.fmt, this
  45411. ._wasmAudioSamplerate = t.samplerate, this._wasmAudioChannelNum = t.ch, 44100 == this
  45412. ._wasmAudioSamplerate && (this._wasmAudioFmt = 1)), this._wasmMuted && this
  45413. ._wasmAudioPlayer && this._wasmInitAudioPlayer && this._wasmAudioPlayer.play(t.dat));
  45414. break;
  45415. case b.m: break;
  45416. case b.w: this._videoRecordiInitFlag = !0, this._videoRecordFindKeyframe = !0, this._wasmRecordingCb(1);
  45417. break;
  45418. case b.p:
  45419. this._videoRecordiInitFlag = !1;
  45420. if(this.stopRecoeding) {
  45421. this._videoRecordFindKeyframe = !1, this._wasmVideoRecordWorker.terminate(), this._wasmVideoRecordWorker = null, this._wasmRecordingCb = null
  45422. return false;
  45423. }
  45424. if(!window.isVideoWatermark) {
  45425. var r = document.createElement("a");
  45426. r.style.display = 'none', r.href = t.dat,
  45427. r.download = this._videoRecordFileName, document.body
  45428. .appendChild(r), r.click(), window.URL.revokeObjectURL(r.href), document.body.removeChild(r),
  45429. this._videoRecordFindKeyframe = !1, this._wasmVideoRecordWorker.terminate(), this._wasmVideoRecordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null
  45430. return false;
  45431. }
  45432. fetch(t.dat).then(response => response.blob()).then(blob => {
  45433. const file = new File([blob], this._videoRecordFileName, { type: blob.type })
  45434. console.log('=============视频加水印============2==', file)
  45435. this._videoRecordFindKeyframe = !1, this._wasmVideoRecordWorker.terminate(), this._wasmVideoRecordWorker = null, this._wasmRecordingCb(0), this._wasmRecordingCb = null
  45436. const formData = new FormData()
  45437. formData.append('file', file)
  45438. fetch('/apiserver/export/alarm/order/downloadVideoByFlush', {
  45439. method: 'POST',
  45440. headers: {
  45441. 'Authorization': 'Bearer ' + (window.$videoStoreData?.userInfo?.token || sessionStorage.getItem('Admin-Token')),
  45442. 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || ''
  45443. },
  45444. body: formData
  45445. }).then(response => response.blob()).then(blob => {
  45446. console.log('=============视频加水印============2=返回=', blob)
  45447. var r = document.createElement("a");
  45448. r.style.display = 'none', r.href = window.URL.createObjectURL(new Blob([blob], { type: 'video/mp4' })),
  45449. r.download = this._videoRecordFileName, document.body
  45450. .appendChild(r), r.click(), window.URL.revokeObjectURL(r.href), document.body.removeChild(r)
  45451. })
  45452. })
  45453. }
  45454. },
  45455. t._creatWasmAudioPlayer = function(e, t, i) {
  45456. if (null === this._wasmAudioPlayer) {
  45457. var r;
  45458. r = "16bitInt", this._wasmAudioPlayer = new S, this._wasmAudioPlayer.init({
  45459. encoding: r,
  45460. channels: t,
  45461. sampleRate: i,
  45462. flushingTime: 1e3
  45463. }), this._wasmInitAudioPlayer = !0
  45464. }
  45465. },
  45466. t._getCurrentPlayTime = function() {
  45467. return this._currentPlayTime
  45468. },
  45469. t._getTotalDuration = function() {
  45470. if (this._controller) return this._controller._getHLSTotalDuration()
  45471. },
  45472. t._seekToSecs = function(e, t) {
  45473. var i = {
  45474. cmd: b.B,
  45475. type: t,
  45476. time: e
  45477. };
  45478. this._wasmDecodeWoker && this._wasmDecodeWoker.postMessage(i), this._controller._seekToSecs(e, t)
  45479. },
  45480. t.saveLocalSnapshot = function(fn, name = '图片', count) {
  45481. if(!count) {
  45482. count = 0;
  45483. }
  45484. if(count > 100) {
  45485. return false;
  45486. }
  45487. count ++;
  45488. var e = this,
  45489. t = void 0,
  45490. m = new Date,
  45491. n = name + "-" + m.getFullYear() +
  45492. ('0' + (m.getMonth() + 1)).substr(-2) +
  45493. ('0' + m.getDate()).substr(-2) +
  45494. ('0' + m.getHours()).substr(-2) +
  45495. ('0' + m.getMinutes()).substr(-2) +
  45496. ('0' + m.getSeconds()).substr(-2) + ".png";
  45497. if (t.length < 786432) return this.snapshotTimer = setTimeout(function() {
  45498. return e.saveLocalSnapshot(fn, name, count)
  45499. }, 40);
  45500. this.snapshotTimer && clearTimeout(this.snapshotTimer), this.snapshotTimer = null;
  45501. for (var s = t.split(","), a = s[0].match(/:(.*?);/)[1], h = atob(s[1]), u = h.length, c =
  45502. new Uint8Array(u); u--;) c[u] = h.charCodeAt(u);
  45503. var g = new Blob([c], {
  45504. type: a
  45505. }),
  45506. f = new File([c], n, {
  45507. type: a
  45508. });
  45509. const formData = new FormData()
  45510. formData.append('file', f)
  45511. console.log('=============图片加水印============1=请求=', f)
  45512. fetch('/apiserver/export/alarm/order/downloadPhotoByFlush', {
  45513. method: 'POST',
  45514. headers: {
  45515. 'Authorization': 'Bearer ' + sessionStorage.getItem('Admin-Token'),
  45516. 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || ''
  45517. },
  45518. body: formData
  45519. }).then(response => response.blob()).then(blob => {
  45520. console.log('=============图片加水印============1=返回=', blob)
  45521. if(fn) {
  45522. fn({
  45523. base64: t,
  45524. blob,
  45525. file: new File([blob], n, { type: a })
  45526. });
  45527. return;
  45528. }
  45529. var i = document.createElement("a");
  45530. i.download = n, i.href = window.URL.createObjectURL(blob), document.body.appendChild(i), i.click(),
  45531. i.remove(), window.URL.revokeObjectURL(i.href)
  45532. })
  45533. },
  45534. t.videoRecording = function(e, t, i, r, stop) {
  45535. this.stopRecoeding = stop;
  45536. if (r && (this._wasmRecordingCb = r), this._wasmDecodeWoker)
  45537. if (1 === i) {
  45538. this._wasmVideoRecordWorker = null;
  45539. if (this._videoRecordFileName = e, this._videoRecordingCB = r, null === this
  45540. ._wasmVideoRecordWorker) {
  45541. this._videoRecordFindKeyframe = !0;
  45542. try {
  45543. this._wasmVideoRecordWorker = m()(67), this.onwmsg = this._onWasmWorkerMessage.bind(this);
  45544. var n = {
  45545. cmd: b.w,
  45546. url: b.g(),
  45547. filesize: t,
  45548. audioSamplerate: this._wasmAudioSamplerate,
  45549. channelCount: this._wasmAudioChannelNum
  45550. };
  45551. this._wasmVideoRecordWorker.postMessage(n), this._wasmVideoRecordWorker.addEventListener(
  45552. "message", this.onwmsg)
  45553. } catch (e) {
  45554. this._wasmVideoRecordWorker && this._wasmVideoRecordWorker.terminate(), this
  45555. ._wasmVideoRecordWorker = null
  45556. }
  45557. }
  45558. } else this._videoRecordiInitFlag = !1, this._wasmVideoRecordWorker && (this._wasmVideoRecordWorker
  45559. .postMessage({
  45560. cmd: b.C
  45561. }), this._videoRecordFindKeyframe = !0);
  45562. else {
  45563. if (!this._controller) return;
  45564. this._controller.videoRecording(e, t, i, r, stop)
  45565. }
  45566. },
  45567. t._openWasmAudio = function() {
  45568. this._wasmDecodeWoker && (this._wasmDecodeWoker.postMessage({
  45569. cmd: b.v
  45570. }), this._wasmMuted = !0, null === this._wasmAudioPlayer && (this._wasmAudioSamplerate > 0 ? this
  45571. ._creatWasmAudioPlayer(this._wasmAudioFmt, this._wasmAudioSamplerate >= 16e3 ? 2 : this
  45572. ._wasmAudioChannelNum, this._wasmAudioSamplerate) : console.log("采样率无效")))
  45573. },
  45574. t._closeWasmAudio = function() {
  45575. this._wasmAudioPlayer && this._wasmInitAudioPlayer && this._wasmAudioPlayer.clearAudioBuffer(), this
  45576. ._wasmAudioPlayer && this._wasmInitAudioPlayer && this._wasmAudioPlayer.pause(), this._wasmMuted = !1
  45577. },
  45578. e
  45579. }(), M = i(16), O = i(4), C = function() {
  45580. function e(e) {
  45581. this.TAG = "MSEController", this._config = e, this._emitter = new d.a, this._config.isLive && null == this
  45582. ._config.autoCleanupSourceBuffer && (this._config.autoCleanupSourceBuffer = !0), this.e = {
  45583. onSourceOpen: this._onSourceOpen.bind(this),
  45584. onSourceEnded: this._onSourceEnded.bind(this),
  45585. onSourceClose: this._onSourceClose.bind(this),
  45586. onSourceBufferError: this._onSourceBufferError.bind(this),
  45587. onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this)
  45588. }, this._mediaSource = null, this._mediaSourceObjectURL = null, this._mediaElement = null, this
  45589. ._isBufferFull = !1, this._hasPendingEos = !1, this._requireSetMediaDuration = !1, this
  45590. ._pendingMediaDuration = 0, this._pendingSourceBufferInit = [], this._mimeTypes = {
  45591. video: null,
  45592. audio: null
  45593. }, this._sourceBuffers = {
  45594. video: null,
  45595. audio: null
  45596. }, this._lastInitSegments = {
  45597. video: null,
  45598. audio: null
  45599. }, this._pendingSegments = {
  45600. video: [],
  45601. audio: []
  45602. }, this._pendingRemoveRanges = {
  45603. video: [],
  45604. audio: []
  45605. }, this._idrList = new M.a, this._pause = !1, this._hlsSeekTime = 0, this._lastPlayTime = 0, this
  45606. ._currentPlayTime = 0, this._audioError = !1
  45607. }
  45608. var t = e.prototype;
  45609. return t.destroy = function() {
  45610. (this._mediaElement || this._mediaSource) && this.detachMediaElement(), this.e = null, this._emitter
  45611. .removeAllListeners(), this._emitter = null
  45612. }, t.on = function(e, t) {
  45613. this._emitter.addListener(e, t)
  45614. }, t.off = function(e, t) {
  45615. this._emitter.removeListener(e, t)
  45616. }, t.attachMediaElement = function(e) {
  45617. var t = this;
  45618. if (this._mediaSource) throw new O.a("MediaSource has been attached to an HTMLMediaElement!");
  45619. var i = this._mediaSource = new window.MediaSource;
  45620. i.addEventListener("sourceopen", this.e.onSourceOpen), i.addEventListener("sourceended", this.e
  45621. .onSourceEnded), i.addEventListener("sourceclose", this.e.onSourceClose), this._mediaElement = e,
  45622. this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource), this._mediaElement.src =
  45623. this._mediaSourceObjectURL, e.addEventListener("timeupdate", function() {
  45624. var i = Math.floor(e.currentTime);
  45625. t._hlsSeekTime > 0 && (i = i - self._lastPlayTime + self._hlsSeekTime), t._currentPlayTime !==
  45626. i && (t._currentPlayTime = i, t._emitter && t._emitter.emit(w.UPDATE_PLAY_INFO, {
  45627. currentTime: t._currentPlayTime,
  45628. duration: t._mediaElement.duration
  45629. }))
  45630. }, !1)
  45631. }, t.getCurrentPlayTime = function() {
  45632. return this._currentPlayTime
  45633. }, t.getTotalDuration = function() {
  45634. return this._mediaElement.duration
  45635. }, t.detachMediaElement = function() {
  45636. if (this._mediaSource) {
  45637. var e = this._mediaSource;
  45638. for (var t in this._sourceBuffers) {
  45639. var i = this._pendingSegments[t];
  45640. i.splice(0, i.length), this._pendingSegments[t] = null, this._pendingRemoveRanges[t] = null, this
  45641. ._lastInitSegments[t] = null;
  45642. var r = this._sourceBuffers[t];
  45643. if (r) {
  45644. if ("closed" !== e.readyState) {
  45645. try {
  45646. e.removeSourceBuffer(r)
  45647. } catch (e) {
  45648. c.a.e(this.TAG, e.message)
  45649. }
  45650. r.removeEventListener("error", this.e.onSourceBufferError), r.removeEventListener("updateend",
  45651. this.e.onSourceBufferUpdateEnd)
  45652. }
  45653. this._mimeTypes[t] = null, this._sourceBuffers[t] = null
  45654. }
  45655. }
  45656. if ("open" === e.readyState) try {
  45657. e.endOfStream()
  45658. } catch (e) {
  45659. c.a.e(this.TAG, e.message)
  45660. }
  45661. e.removeEventListener("sourceopen", this.e.onSourceOpen), e.removeEventListener("sourceended", this.e
  45662. .onSourceEnded), e.removeEventListener("sourceclose", this.e.onSourceClose), this
  45663. ._pendingSourceBufferInit = [], this._isBufferFull = !1, this._idrList.clear(), this._mediaSource =
  45664. null
  45665. }
  45666. this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this
  45667. ._mediaElement = null), this._mediaSourceObjectURL && (window.URL.revokeObjectURL(this
  45668. ._mediaSourceObjectURL), this._mediaSourceObjectURL = null)
  45669. }, t.appendInitSegment = function(e, t) {
  45670. if (!this._mediaSource || "open" !== this._mediaSource.readyState) return this._pendingSourceBufferInit
  45671. .push(e), void this._pendingSegments[e.type].push(e);
  45672. var i = e,
  45673. r = "" + i.container;
  45674. i.codec && i.codec.length > 0 && (r += ";codecs=" + i.codec);
  45675. var n = !1;
  45676. if (this._lastInitSegments[i.type] = i, r !== this._mimeTypes[i.type]) {
  45677. if (this._mimeTypes[i.type]) c.a.v(this.TAG, "Notice: " + i.type + " mimeType changed, origin: " +
  45678. this._mimeTypes[i.type] + ", target: " + r);
  45679. else {
  45680. n = !0;
  45681. try {
  45682. var a = this._sourceBuffers[i.type] = this._mediaSource.addSourceBuffer(r);
  45683. a.addEventListener("error", this.e.onSourceBufferError), a.addEventListener("updateend", this.e
  45684. .onSourceBufferUpdateEnd)
  45685. } catch (e) {
  45686. return c.a.e(this.TAG, e.message), void this._emitter.emit(w.ERROR, {
  45687. code: e.code,
  45688. msg: e.message
  45689. })
  45690. }
  45691. }
  45692. this._mimeTypes[i.type] = r
  45693. }
  45694. t || this._pendingSegments[i.type].push(i), n || this._sourceBuffers[i.type] && !this._sourceBuffers[i
  45695. .type].updating && this._doAppendSegments(), h.a.safari && "audio/mpeg" === i.container && i
  45696. .mediaDuration > 0 && (this._requireSetMediaDuration = !0, this._pendingMediaDuration = i
  45697. .mediaDuration / 1e3, this._updateMediaSourceDuration())
  45698. }, t.appendMediaSegment = function(e) {
  45699. if ("audio" !== e.type || !this._audioError) {
  45700. var t = e;
  45701. this._pendingSegments[t.type].push(t), this._config.autoCleanupSourceBuffer && this
  45702. ._needCleanupSourceBuffer() && this._doCleanupSourceBuffer();
  45703. var i = this._sourceBuffers[t.type];
  45704. !i || i.updating || this._hasPendingRemoveRanges() || this._doAppendSegments()
  45705. }
  45706. }, t.seek = function(e) {
  45707. for (var t in this._sourceBuffers)
  45708. if (this._sourceBuffers[t]) {
  45709. var i = this._sourceBuffers[t];
  45710. if ("open" === this._mediaSource.readyState) try {
  45711. i.abort()
  45712. } catch (e) {
  45713. c.a.e(this.TAG, e.message)
  45714. }
  45715. this._idrList.clear();
  45716. var r = this._pendingSegments[t];
  45717. if (r.splice(0, r.length), "closed" !== this._mediaSource.readyState) {
  45718. for (var n = 0; n < i.buffered.length; n++) {
  45719. var a = i.buffered.start(n),
  45720. s = i.buffered.end(n);
  45721. this._pendingRemoveRanges[t].push({
  45722. start: a,
  45723. end: s
  45724. })
  45725. }
  45726. if (i.updating || this._doRemoveRanges(), h.a.safari) {
  45727. var o = this._lastInitSegments[t];
  45728. o && (this._pendingSegments[t].push(o), i.updating || this._doAppendSegments())
  45729. }
  45730. }
  45731. }
  45732. }, t.endOfStream = function() {
  45733. var e = this._mediaSource,
  45734. t = this._sourceBuffers;
  45735. e && "open" === e.readyState ? t.video && t.video.updating || t.audio && t.audio.updating ? this
  45736. ._hasPendingEos = !0 : (this._hasPendingEos = !1, e.endOfStream()) : e && "closed" === e.readyState &&
  45737. this._hasPendingSegments() && (this._hasPendingEos = !0)
  45738. }, t.getNearestKeyframe = function(e) {
  45739. return this._idrList.getLastSyncPointBeforeDts(e)
  45740. }, t._needCleanupSourceBuffer = function() {
  45741. if (!this._config.autoCleanupSourceBuffer) return !1;
  45742. var e = this._mediaElement.currentTime;
  45743. for (var t in this._sourceBuffers) {
  45744. var i = this._sourceBuffers[t];
  45745. if (i) {
  45746. var r = i.buffered;
  45747. if (r.length >= 1 && e - r.start(0) >= this._config.autoCleanupMaxBackwardDuration) return !0
  45748. }
  45749. }
  45750. return !1
  45751. }, t._doCleanupSourceBuffer = function() {
  45752. var e = this._mediaElement.currentTime;
  45753. for (var t in this._sourceBuffers) {
  45754. var i = this._sourceBuffers[t];
  45755. if (i) {
  45756. for (var r = i.buffered, n = !1, a = 0; a < r.length; a++) {
  45757. var s = r.start(a),
  45758. o = r.end(a);
  45759. if (s <= e && e < o + 3) {
  45760. if (e - s >= this._config.autoCleanupMaxBackwardDuration) {
  45761. n = !0;
  45762. var u = e - this._config.autoCleanupMinBackwardDuration;
  45763. this._pendingRemoveRanges[t].push({
  45764. start: s,
  45765. end: u
  45766. })
  45767. }
  45768. } else o < e && (n = !0, this._pendingRemoveRanges[t].push({
  45769. start: s,
  45770. end: o
  45771. }))
  45772. }
  45773. n && !i.updating && this._doRemoveRanges()
  45774. }
  45775. }
  45776. }, t._updateMediaSourceDuration = function() {
  45777. var e = this._sourceBuffers;
  45778. if (0 !== this._mediaElement.readyState && "open" === this._mediaSource.readyState && !(e.video && e
  45779. .video.updating || e.audio && e.audio.updating)) {
  45780. var t = this._mediaSource.duration,
  45781. i = this._pendingMediaDuration;
  45782. i > 0 && (isNaN(t) || i > t) && (c.a.v(this.TAG, "Update MediaSource duration from " + t + " to " +
  45783. i), this._mediaSource.duration = i), this._requireSetMediaDuration = !1, this
  45784. ._pendingMediaDuration = 0
  45785. }
  45786. }, t._doRemoveRanges = function() {
  45787. for (var e in this._pendingRemoveRanges)
  45788. if (this._sourceBuffers[e] && !this._sourceBuffers[e].updating)
  45789. for (var t = this._sourceBuffers[e], i = this._pendingRemoveRanges[e]; i.length && !t.updating;) {
  45790. var r = i.shift();
  45791. t.remove(r.start, r.end)
  45792. }
  45793. }, t._removerAudioSourceBuffer = function() {
  45794. this._audioError = !0;
  45795. var e = this._sourceBuffers.audio;
  45796. e && (this._mediaSource.removeSourceBuffer(e), e.removeEventListener("error", this.e
  45797. .onSourceBufferError), e.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd), this
  45798. ._sourceBuffers.audio = null)
  45799. }, t._doAppendSegments = function() {
  45800. var e = this._pendingSegments;
  45801. for (var t in b.d() && !this._pause && "flv" === this._config.streamType && this.AdjustPlayTimeToEnd(),
  45802. e)
  45803. if (this._sourceBuffers[t] && !this._sourceBuffers[t].updating && e[t].length > 0) {
  45804. var i = e[t].shift();
  45805. if (i.timestampOffset) {
  45806. var r = this._sourceBuffers[t].timestampOffset,
  45807. n = i.timestampOffset / 1e3;
  45808. Math.abs(r - n) > .1 && (c.a.v(this.TAG, "Update MPEG audio timestampOffset from " + r + " to " +
  45809. n), this._sourceBuffers[t].timestampOffset = n), delete i.timestampOffset
  45810. }
  45811. if (!i.data || 0 === i.data.byteLength) continue;
  45812. try {
  45813. this._sourceBuffers[t].appendBuffer(i.data), this._isBufferFull = !1, "video" === t && i
  45814. .hasOwnProperty("info") && this._idrList.appendArray(i.info.syncPoints)
  45815. } catch (e) {
  45816. if (this._pendingSegments[t].unshift(i), 22 === e.code) this._isBufferFull || this._emitter.emit(w
  45817. .BUFFER_FULL), this._isBufferFull = !0;
  45818. else try {
  45819. this._emitter.emit(w.ERROR, {
  45820. code: 11,
  45821. msg: e.message
  45822. })
  45823. } catch (e) {}
  45824. }
  45825. }
  45826. }, t._onSourceOpen = function() {
  45827. if (c.a.v(this.TAG, "MediaSource onSourceOpen"), this._mediaSource.removeEventListener("sourceopen",
  45828. this.e.onSourceOpen), this._pendingSourceBufferInit.length > 0)
  45829. for (var e = this._pendingSourceBufferInit; e.length;) {
  45830. var t = e.shift();
  45831. this.appendInitSegment(t, !0)
  45832. }
  45833. this._hasPendingSegments() && this._doAppendSegments(), this._emitter.emit(w.SOURCE_OPEN)
  45834. }, t._onSourceEnded = function() {
  45835. this._emitter.emit(w.SOURCE_ENDED), c.a.v(this.TAG, "MediaSource onSourceEnded")
  45836. }, t._onSourceClose = function() {
  45837. c.a.v(this.TAG, "MediaSource onSourceClose"), this._mediaSource && null != this.e && (this._mediaSource
  45838. .removeEventListener("sourceopen", this.e.onSourceOpen), this._mediaSource.removeEventListener(
  45839. "sourceended", this.e.onSourceEnded), this._mediaSource.removeEventListener("sourceclose", this.e
  45840. .onSourceClose))
  45841. }, t._hasPendingSegments = function() {
  45842. var e = this._pendingSegments;
  45843. return e.video.length > 0 || e.audio.length > 0
  45844. }, t._hasPendingRemoveRanges = function() {
  45845. var e = this._pendingRemoveRanges;
  45846. return e.video.length > 0 || e.audio.length > 0
  45847. }, t._onSourceBufferUpdateEnd = function() {
  45848. this._requireSetMediaDuration ? this._updateMediaSourceDuration() : this._hasPendingRemoveRanges() ?
  45849. this._doRemoveRanges() : this._hasPendingSegments() ? this._doAppendSegments() : this
  45850. ._hasPendingEos && this.endOfStream(), this._emitter.emit(w.UPDATE_END)
  45851. }, t._onSourceBufferError = function(e) {
  45852. c.a.e(this.TAG, "SourceBuffer Error: " + e)
  45853. }, t.pause = function() {
  45854. this._pause = !0
  45855. }, t.resume = function() {
  45856. this._pause = !1
  45857. }, t.AdjustPlayTimeToEnd = function() {
  45858. if (null != this._emitter && null != this._emitter) {
  45859. var e = this._mediaElement.currentTime;
  45860. for (var t in this._sourceBuffers)
  45861. if ("video" === t) {
  45862. var i = this._sourceBuffers[t];
  45863. if (i && !i.updating) {
  45864. var r = i.buffered;
  45865. if (r.length > 0) {
  45866. var n = r.end(r.length - 1);
  45867. n - e > 2 ? this._mediaElement.currentTime = n : this._lastSpeed > 0 && (this._lastSpeed = 0,
  45868. this._emitter.emit(w.CHANGE_SPEED, {
  45869. speed: 0
  45870. }))
  45871. }
  45872. }
  45873. }
  45874. }
  45875. }, e
  45876. }(), D = i(12), I = {
  45877. NETWORK_ERROR: "NetworkError",
  45878. MEDIA_ERROR: "MediaError",
  45879. OTHER_ERROR: "OtherError"
  45880. }, L = {
  45881. NETWORK_EXCEPTION: u.b.EXCEPTION,
  45882. NETWORK_STATUS_CODE_INVALID: u.b.HTTP_STATUS_CODE_INVALID,
  45883. NETWORK_TIMEOUT: u.b.CONNECTING_TIMEOUT,
  45884. NETWORK_UNRECOVERABLE_EARLY_EOF: u.b.UNRECOVERABLE_EARLY_EOF,
  45885. MEDIA_MSE_ERROR: "MediaMSEError",
  45886. MEDIA_FORMAT_ERROR: D.a.FORMAT_ERROR,
  45887. MEDIA_FORMAT_UNSUPPORTED: D.a.FORMAT_UNSUPPORTED,
  45888. MEDIA_CODEC_UNSUPPORTED: D.a.CODEC_UNSUPPORTED
  45889. };
  45890. function x(e, t) {
  45891. for (var i = 0; i < t.length; i++) {
  45892. var r = t[i];
  45893. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  45894. .defineProperty(e, r.key, r)
  45895. }
  45896. }
  45897. var P = function() {
  45898. function e(e, t) {
  45899. this.TAG = "FlvPlayer", this._type = "FlvPlayer", this._emitter = new d.a;
  45900. var i = e.url,
  45901. r = e.muted,
  45902. n = e.recordMaxFileSize;
  45903. i.includes(".flv") && (this._type = "flv"), i.includes(".m3u8") && (this._type = "hls"), this._config =
  45904. s(), o.supportMSEH264Playback() ? t.decodeType = t.decodeType ? t.decodeType : "auto" : t.decodeType =
  45905. "soft", "object" == typeof t && (this._config = Object.assign(this._config, t)), !0 === e.isLive && (
  45906. this._config.isLive = !0), this.e = {
  45907. onvLoadedMetadata: this._onvLoadedMetadata.bind(this),
  45908. onvSeeking: this._onvSeeking.bind(this),
  45909. onvCanPlay: this._onvCanPlay.bind(this),
  45910. onvStalled: this._onvStalled.bind(this),
  45911. onvProgress: this._onvProgress.bind(this)
  45912. }, self.performance && self.performance.now ? this._now = self.performance.now.bind(self
  45913. .performance) : this._now = Date.now, this._pendingSeekTime = null, this._requestSetTime = !1, this
  45914. ._seekpointRecord = null, this._progressChecker = null, this._mediaDataSource = Object.assign(e, {
  45915. type: this.type
  45916. }), this._mediaElement = null, this._msectl = null, this._transmuxer = null, this._mseSourceOpened = !
  45917. 1, this._hasPendingLoad = !1, this._receivedCanPlay = !1, this._mediaInfo = null, this
  45918. ._statisticsInfo = null;
  45919. var a = h.a.chrome && (h.a.version.major < 50 || 50 === h.a.version.major && h.a.version.build < 2661);
  45920. this._alwaysSeekKeyframe = !!(a || h.a.msedge || h.a.msie), this._alwaysSeekKeyframe && (this._config
  45921. .accurateSeek = !1), this.videoToolsTimer = null, this.playing = !0, this.mute = !0, this.kbpsEle =
  45922. null, this.audioBtnEle = null, this.playBtnEle = null, this.luXiangEle = null, this.timeTrackEle =
  45923. null, this.isFullScreen = !1, this.progressBarEle = null, this.progressBarLabelEle = null, this
  45924. ._webRecording = {
  45925. enable: 0
  45926. }, this._recording = !1, this._fullScreenBtnEle = null, this._muted = r, this._recordHlsOffset = 0,
  45927. this._recordMaxFileSize = n ? 1024 * n * 1024 : 209715200, this._recordHlsArrayBuffer = [], this
  45928. ._isEncodedH265 = !o.supportMSEH264Playback(), this._mobile = this._isMobile(), this.isiOS = !!
  45929. navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), this.switchPlay = this._switchPlay, this
  45930. .switchAudio = this._switchAudio, this.recordSwitch = this._recordSwitch, this.saveLocalSnapshot =
  45931. this._saveLocalSnapshot
  45932. }
  45933. var t, i, r = e.prototype;
  45934. return r.destroy = function() {
  45935. null != this._progressChecker && (window.clearInterval(this._progressChecker), this._progressChecker =
  45936. null), this._transmuxer && this.unload(), this._mediaElement && this.detachMediaElement(), this
  45937. .e = null, this._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null,
  45938. this.videoToolsTimer && clearTimeout(this.videoToolsTimer), this.kbpsEle = null, this.timeTrackEle =
  45939. null, this.audioBtnEle = null, this.playBtnEle = null, this.progressBarEle = null, this
  45940. .videoToolsTimer = null, this.progressBarLabelEle = null, this._fullScreenBtnEle = null;
  45941. var e = document.getElementsByClassName("video-tools")[0];
  45942. e && e.parentNode && e.parentNode.removeChild(e), this._recordHlsOffset = 0, this
  45943. ._recordHlsArrayBuffer = [], this._isEncodedH265 = !1, this.switchAudio = null, this
  45944. .saveLocalSnapshot = null, this.recordSwitch = null
  45945. }, r.on = function(e, t) {
  45946. var i = this;
  45947. e === f.MEDIA_INFO ? null != this._mediaInfo && Promise.resolve().then(function() {
  45948. i._emitter.emit(f.MEDIA_INFO, i.mediaInfo)
  45949. }) : e === f.STATISTICS_INFO && null != this._statisticsInfo && Promise.resolve().then(function() {
  45950. i._emitter.emit(f.STATISTICS_INFO, i.statisticsInfo)
  45951. }), this._emitter.addListener(e, t)
  45952. }, r.off = function(e, t) {
  45953. this._emitter.removeListener(e, t)
  45954. }, r.attachMediaElement = function(e) {
  45955. var t = this;
  45956. if (this._mediaElement = e, o.supportMSEH264Playback()) {
  45957. if (e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), e.addEventListener("seeking",
  45958. this.e.onvSeeking), e.addEventListener("canplay", this.e.onvCanPlay), e.addEventListener(
  45959. "stalled", this.e.onvStalled), e.addEventListener("progress", this.e.onvProgress), this
  45960. ._msectl = new C(this._config), this._msectl.on(w.UPDATE_PLAY_INFO, this._onmseUpdatePlayInfo
  45961. .bind(this)), this._msectl.on(w.UPDATE_END, this._onmseUpdateEnd.bind(this)), this._msectl.on(w
  45962. .BUFFER_FULL, this._onmseBufferFull.bind(this)), this._msectl.on(w.SOURCE_ENDED, function() {
  45963. 1 === t._webRecording.enable && (t._webRecording.enable = 0, t.startWebVideoRecord(0),
  45964. setTimeout(function() {
  45965. return t._emitter.emit(w.SOURCE_ENDED)
  45966. }, 1e3))
  45967. }), this._msectl.on(w.SOURCE_OPEN, function() {
  45968. t._mseSourceOpened = !0, t._hasPendingLoad && (t._hasPendingLoad = !1, t.load())
  45969. }), this._msectl.on(w.ERROR, function(e) {
  45970. t._emitter.emit(f.ERROR, I.MEDIA_ERROR, L.MEDIA_MSE_ERROR, e)
  45971. }), this._msectl.attachMediaElement(e), null != this._pendingSeekTime) try {
  45972. e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null
  45973. } catch (e) {}
  45974. this._mediaElement.muted = this._muted
  45975. } else console.log("ios 设备")
  45976. }, r.detachMediaElement = function() {
  45977. this._mediaElement && (this._msectl.detachMediaElement(), this._mediaElement.removeEventListener(
  45978. "loadedmetadata", this.e.onvLoadedMetadata), this._mediaElement.removeEventListener("seeking",
  45979. this.e.onvSeeking), this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay), this
  45980. ._mediaElement.removeEventListener("stalled", this.e.onvStalled), this._mediaElement
  45981. .removeEventListener("progress", this.e.onvProgress), this._mediaElement = null), this._msectl &&
  45982. (this._msectl.destroy(), this._msectl = null)
  45983. }, r.load = function() {
  45984. var e = this;
  45985. if (o.supportMSEH264Playback()) {
  45986. if (!this._mediaElement) throw new O.a("HTMLMediaElement must be attached before load()!");
  45987. if (this._transmuxer) throw new O.a(
  45988. "FlvPlayer.load() has been called, please call unload() first!");
  45989. if (this._hasPendingLoad) return;
  45990. if (this._config.deferLoadAfterSourceOpen && !1 === this._mseSourceOpened) return void(this
  45991. ._hasPendingLoad = !0);
  45992. this._mediaElement.readyState > 0 && (this._requestSetTime = !0, this._mediaElement.currentTime = 0)
  45993. }
  45994. this._transmuxer = new R(this._mediaDataSource, this._config, this._mediaElement), this._transmuxer
  45995. .on(y.a.INIT_SEGMENT, function(t, i) {
  45996. e._msectl.appendInitSegment(i)
  45997. }), this._transmuxer.on(y.a.ON_DBL_CLICK, function() {
  45998. return e._requestFullScreen()
  45999. }), this._transmuxer.on(y.a.MEDIA_SEGMENT, function(t, i) {
  46000. if (e._msectl.appendMediaSegment(i), e._config.lazyLoad && !e._config.isLive) {
  46001. var r = e._mediaElement.currentTime;
  46002. i.info.endDts >= 1e3 * (r + e._config.lazyLoadMaxDuration) && null == e._progressChecker && (c
  46003. .a.v(e.TAG, "Maximum buffering duration exceeded, suspend transmuxing task"), e
  46004. ._suspendTransmuxer())
  46005. }
  46006. }), this._transmuxer.on(y.a.IS_ENCODED_H265, function(t) {
  46007. e._isEncodedH265 = t, setTimeout(function() {
  46008. return e._emitter.emit(y.a.IS_ENCODED_H265)
  46009. }, 1500), e._render265VideoTools()
  46010. }), this._transmuxer.on(y.a.LOADING_COMPLETE, function() {
  46011. e._msectl.endOfStream(), e._emitter.emit(f.LOADING_COMPLETE)
  46012. }), this._transmuxer.on(y.a.RECOVERED_EARLY_EOF, function() {
  46013. e._emitter.emit(f.RECOVERED_EARLY_EOF)
  46014. }), this._transmuxer.on(y.a.IO_ERROR, function(t, i) {
  46015. e._emitter.emit(f.ERROR, I.NETWORK_ERROR, t, i)
  46016. }), this._transmuxer.on(y.a.DEMUX_ERROR, function(t, i) {
  46017. e._emitter.emit(f.ERROR, I.MEDIA_ERROR, t, {
  46018. code: -1,
  46019. msg: i
  46020. })
  46021. }), this._transmuxer.on(y.a.MEDIA_INFO, function(t) {
  46022. e._mediaInfo = t, e._emitter.emit(f.MEDIA_INFO, Object.assign({}, t))
  46023. }), this._transmuxer.on(y.a.METADATA_ARRIVED, function(t) {
  46024. e._emitter.emit(f.METADATA_ARRIVED, t)
  46025. }), this._transmuxer.on(y.a.SCRIPTDATA_ARRIVED, function(t) {
  46026. e._emitter.emit(f.SCRIPTDATA_ARRIVED, t)
  46027. }), this._transmuxer.on(y.a.STATISTICS_INFO, function(t) {
  46028. e._statisticsInfo = e._fillStatisticsInfo(t), e._emitter.emit(f.STATISTICS_INFO, Object
  46029. .assign({}, e._statisticsInfo))
  46030. }), this._transmuxer.on(y.a.RECOMMEND_SEEKPOINT, function(t) {
  46031. e._mediaElement && !e._config.accurateSeek && (e._requestSetTime = !0, e._mediaElement
  46032. .currentTime = t / 1e3)
  46033. }), this._transmuxer.on(w.SOURCE_ENDED, function() {
  46034. return e._emitter.emit(w.SOURCE_ENDED)
  46035. }), this._transmuxer.on(w.UPDATE_PLAY_INFO, this._onmseUpdatePlayInfo.bind(this)), this._transmuxer
  46036. .on(y.a.AUDIO_ERROR, this._onAudioError.bind(this)), this._transmuxer.on("loaderChunkArrival",
  46037. function(t) {
  46038. if (null !== t) {
  46039. var i = e._mediaDataSource.url;
  46040. if (i && i.includes(".m3u8"))
  46041. if (e._recording) {
  46042. if (0 === e._recordHlsArrayBuffer.length && (e._recordHlsArrayBuffer = new Uint8Array(e
  46043. ._recordMaxFileSize)), e._recordHlsOffset + t.byteLength > e._recordMaxFileSize)
  46044. return e.downRecord(), e._recording = !1, void(e.luXiangEle.style.color = e._recording ?
  46045. "red" : "white");
  46046. e._recordHlsArrayBuffer.set(new Int8Array(t), e._recordHlsOffset), e._recordHlsOffset += t
  46047. .byteLength
  46048. } else {
  46049. if (0 === e._recordHlsArrayBuffer.length || 0 === e._recordHlsArrayBuffer.byteLength){
  46050. e._emitter.emit('recordEnd', false);
  46051. }else {
  46052. if(this.stopRecoeding) {
  46053. this._recordHlsOffset = 0, this._recordHlsArrayBuffer = []
  46054. return false;
  46055. }
  46056. e._emitter.emit('recordEnd', true);
  46057. e.downRecord()
  46058. }
  46059. }
  46060. }
  46061. }), this._transmuxer.on("hls_error", function() {
  46062. 1 === e._webRecording.enable && (e._webRecording.enable = 0, e.downRecord()), setTimeout(
  46063. function() {
  46064. return e._emitter.emit(y.a.SOURCE_ENDED)
  46065. }, 1500)
  46066. }), this._transmuxer.open()
  46067. }, r.downRecord = function() {
  46068. var e = this.dateFormat(new Date, "YYYYMMDDhhmmss"),
  46069. t = this._recordHlsArrayBuffer.slice(0, this._recordHlsOffset),
  46070. i = document.createElement("a"), n = this.playerName + '-' + e;
  46071. var b = new Blob([t], { type: "video/mp4" })
  46072. if(!window.isVideoWatermark) {
  46073. i.style.display = "none", i.href = window.URL.createObjectURL(new Blob([b], { type: 'video/mp4' })),
  46074. i.download = n, document.body.appendChild(i), i.click(), window.URL.revokeObjectURL(i
  46075. .href), document.body.removeChild(i),
  46076. this._recordHlsOffset = 0, this._recordHlsArrayBuffer = []
  46077. return false;
  46078. }
  46079. const file = new File([b], n, { type: b.type })
  46080. console.log('=============视频加水印============3==', file)
  46081. this._recordHlsOffset = 0, this._recordHlsArrayBuffer = []
  46082. const formData = new FormData()
  46083. formData.append('file', file)
  46084. fetch('/apiserver/export/alarm/order/downloadVideoByFlush', {
  46085. method: 'POST',
  46086. headers: {
  46087. 'Authorization': 'Bearer ' + (window.$videoStoreData?.userInfo?.token || sessionStorage.getItem('Admin-Token')),
  46088. 'Cur-Industry-Code': sessionStorage.getItem('chooseTradeVersiondd2') || JSON.parse(sessionStorage.getItem('chooseTradeVersiondd') || null)?.industryCode || ''
  46089. },
  46090. body: formData
  46091. }).then(response => response.blob()).then(blob => {
  46092. console.log('=============视频加水印============3=返回=', blob)
  46093. i.style.display = "none", i.href = window.URL.createObjectURL(new Blob([blob], { type: 'video/mp4' })),
  46094. i.download = n, document.body.appendChild(i), i.click(), window.URL.revokeObjectURL(i
  46095. .href), document.body.removeChild(i)
  46096. })
  46097. }, r.dateFormat = function(e, t) {
  46098. var i, r = {
  46099. "Y+": e.getFullYear().toString(),
  46100. "M+": (e.getMonth() + 1).toString(),
  46101. "D+": e.getDate().toString(),
  46102. "h+": e.getHours().toString(),
  46103. "m+": e.getMinutes().toString(),
  46104. "s+": e.getSeconds().toString()
  46105. };
  46106. for (var n in r)(i = new RegExp("(" + n + ")").exec(t)) && (t = t.replace(i[1], 1 === i[1].length ? r[
  46107. n] : r[n].padStart(i[1].length, "0")));
  46108. return t
  46109. }, r.unload = function() {
  46110. this._mediaElement && this._mediaElement.pause(), this._msectl && this._msectl.seek(0), this
  46111. ._transmuxer && (this._transmuxer.close(), this._transmuxer.destroy(), this._transmuxer = null)
  46112. }, r.play = function() {
  46113. return this._mediaElement.play()
  46114. }, r.resume = function() {
  46115. this._mediaElement && this._mediaElement.play(), this._isEncodedH265 && this._transmuxer && this
  46116. ._transmuxer.resume()
  46117. }, r.pause = function() {
  46118. var e = this._mediaElement;
  46119. e.offsetWidth, e.offsetHeight, this._mediaElement && this._mediaElement.pause(), this
  46120. ._isEncodedH265 && this._transmuxer && this._transmuxer.pause()
  46121. }, r._fillStatisticsInfo = function(e) {
  46122. if (e.playerType = this._type, !(this._mediaElement instanceof HTMLVideoElement)) return e;
  46123. var t = !0,
  46124. i = 0,
  46125. r = 0;
  46126. if (this._mediaElement.getVideoPlaybackQuality) {
  46127. var n = this._mediaElement.getVideoPlaybackQuality();
  46128. i = n.totalVideoFrames, r = n.droppedVideoFrames
  46129. } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement
  46130. .webkitDecodedFrameCount, r = this._mediaElement.webkitDroppedFrameCount) : t = !1;
  46131. return t && (e.decodedFrames = i, e.droppedFrames = r), e
  46132. }, r._onmseUpdateEnd = function() {
  46133. if (this._config.lazyLoad && !this._config.isLive) {
  46134. for (var e = this._mediaElement.buffered, t = this._mediaElement.currentTime, i = 0, r = 0; r < e
  46135. .length; r++) {
  46136. var n = e.start(r),
  46137. a = e.end(r);
  46138. if (n <= t && t < a) {
  46139. i = a;
  46140. break
  46141. }
  46142. }
  46143. i >= t + this._config.lazyLoadMaxDuration && null == this._progressChecker && (c.a.v(this.TAG,
  46144. "Maximum buffering duration exceeded, suspend transmuxing task"), this._suspendTransmuxer())
  46145. }
  46146. }, r._onmseUpdatePlayInfo = function() {
  46147. if (this._transmuxer) {
  46148. var e = 0,
  46149. t = 0;
  46150. this._isEncodedH265 && this._mediaDataSource.url.includes(".m3u8") && ((e = this._transmuxer
  46151. ._getCurrentPlayTime()) < 0 && (e = 0), t = this._transmuxer._getTotalDuration(), this
  46152. ._updateDuration({
  46153. currentTime: e,
  46154. duration: t
  46155. }));
  46156. var i = this._transmuxer._controller._ioctl.currentSpeed,
  46157. r = this._transmuxer._controller._ioctl.averageKBps;
  46158. this._updateKbps({
  46159. currentSpeed: i,
  46160. averageKBps: r
  46161. })
  46162. }
  46163. }, r._onmseBufferFull = function() {
  46164. c.a.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task"), null == this
  46165. ._progressChecker && this._suspendTransmuxer()
  46166. }, r._suspendTransmuxer = function() {
  46167. this._transmuxer && (this._transmuxer.pause(), null == this._progressChecker && (this
  46168. ._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3)))
  46169. }, r._checkProgressAndResume = function() {
  46170. for (var e = this._mediaElement.currentTime, t = this._mediaElement.buffered, i = !1, r = 0; r < t
  46171. .length; r++) {
  46172. var n = t.start(r),
  46173. a = t.end(r);
  46174. if (e >= n && e < a) {
  46175. e >= a - this._config.lazyLoadRecoverDuration && (i = !0);
  46176. break
  46177. }
  46178. }
  46179. i && (window.clearInterval(this._progressChecker), this._progressChecker = null, i && (c.a.v(this.TAG,
  46180. "Continue loading from paused position"), this._transmuxer.resume()))
  46181. }, r._isTimepointBuffered = function(e) {
  46182. for (var t = this._mediaElement.buffered, i = 0; i < t.length; i++) {
  46183. var r = t.start(i),
  46184. n = t.end(i);
  46185. if (e >= r && e < n) return !0
  46186. }
  46187. return !1
  46188. }, r._internalSeek = function(e) {
  46189. var t = this._isTimepointBuffered(e),
  46190. i = !1,
  46191. r = 0;
  46192. if (e < 1 && this._mediaElement.buffered.length > 0) {
  46193. var n = this._mediaElement.buffered.start(0);
  46194. (n < 1 && e < n || h.a.safari) && (i = !0, r = h.a.safari ? .1 : n)
  46195. }
  46196. if (i) this._requestSetTime = !0, this._mediaElement.currentTime = r;
  46197. else if (t) {
  46198. if (this._alwaysSeekKeyframe) {
  46199. var a = this._msectl.getNearestKeyframe(Math.floor(1e3 * e));
  46200. this._requestSetTime = !0, this._mediaElement.currentTime = null != a ? a.dts / 1e3 : e
  46201. } else this._requestSetTime = !0, this._mediaElement.currentTime = e;
  46202. null != this._progressChecker && this._checkProgressAndResume()
  46203. } else null != this._progressChecker && (window.clearInterval(this._progressChecker), this
  46204. ._progressChecker = null), this._msectl.seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this
  46205. ._config.accurateSeek && (this._requestSetTime = !0, this._mediaElement.currentTime = e)
  46206. }, r._checkAndApplyUnbufferedSeekpoint = function() {
  46207. if (this._seekpointRecord)
  46208. if (this._seekpointRecord.recordTime <= this._now() - 100) {
  46209. var e = this._mediaElement.currentTime;
  46210. this._seekpointRecord = null, this._isTimepointBuffered(e) || (null != this._progressChecker && (
  46211. window.clearTimeout(this._progressChecker), this._progressChecker = null), this._msectl
  46212. .seek(e), this._transmuxer.seek(Math.floor(1e3 * e)), this._config.accurateSeek && (this
  46213. ._requestSetTime = !0, this._mediaElement.currentTime = e))
  46214. } else window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50)
  46215. }, r._checkAndResumeStuckPlayback = function(e) {
  46216. var t = this._mediaElement;
  46217. if (e || !this._receivedCanPlay || t.readyState < 2) {
  46218. var i = t.buffered;
  46219. i.length > 0 && t.currentTime < i.start(0) && (c.a.w(this.TAG, "Playback seems stuck at " + t
  46220. .currentTime + ", seek to " + i.start(0)), this._requestSetTime = !0, this._mediaElement
  46221. .currentTime = i.start(0), this._mediaElement.removeEventListener("progress", this.e
  46222. .onvProgress))
  46223. } else this._mediaElement.removeEventListener("progress", this.e.onvProgress)
  46224. }, r._onvLoadedMetadata = function(e) {
  46225. null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this
  46226. ._pendingSeekTime = null)
  46227. }, r._onvSeeking = function(e) {
  46228. var t = this._mediaElement.currentTime,
  46229. i = this._mediaElement.buffered;
  46230. if (this._requestSetTime) this._requestSetTime = !1;
  46231. else {
  46232. if (t < 1 && i.length > 0) {
  46233. var r = i.start(0);
  46234. if (r < 1 && t < r || h.a.safari) return this._requestSetTime = !0, void(this._mediaElement
  46235. .currentTime = h.a.safari ? .1 : r)
  46236. }
  46237. if (this._isTimepointBuffered(t)) {
  46238. if (this._alwaysSeekKeyframe) {
  46239. var n = this._msectl.getNearestKeyframe(Math.floor(1e3 * t));
  46240. null != n && (this._requestSetTime = !0, this._mediaElement.currentTime = n.dts / 1e3)
  46241. }
  46242. null != this._progressChecker && this._checkProgressAndResume()
  46243. } else this._seekpointRecord = {
  46244. seekPoint: t,
  46245. recordTime: this._now()
  46246. }, window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50)
  46247. }
  46248. }, r._onvCanPlay = function(e) {
  46249. this._receivedCanPlay = !0, this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay)
  46250. }, r._onvStalled = function(e) {
  46251. this._checkAndResumeStuckPlayback(!0)
  46252. }, r._onvProgress = function(e) {
  46253. this._checkAndResumeStuckPlayback()
  46254. }, r.seek = function(e, t) {
  46255. if (this._isEncodedH265 && this._transmuxer && this._mediaDataSource.url.includes(".m3u8")) {
  46256. var i = Math.floor(e / 100 * this._transmuxer._getTotalDuration());
  46257. if (this._msectl && this._msectl.getCurrentPlayTime() === i) return !0;
  46258. this._transmuxer._seekToSecs(e, t)
  46259. }
  46260. }, r._render265VideoTools = function() {
  46261. var e = this,
  46262. t = document.createElement("span");
  46263. t.style =
  46264. "width:100%;height:30px;position:absolute;bottom:0;left:0;background-color:rgba(43, 51, 63, 0.7);;z-index: 10;opacity:0;display: flex;flex-direction: row;justify-content: space-between;",
  46265. t.classList = "video-tools", this.videoTools = t;
  46266. var i = document.createElement("div");
  46267. i.style = "display: flex;flex-direction: row;", this.playBtnEle = document.createElement("span"), this
  46268. .playBtnEle.style =
  46269. "font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center",
  46270. this.playBtnEle.classList = "iconfontep " + (this.playing ? "icon-zanting" : "icon-bofang"), this
  46271. .audioBtnEle = document.createElement("span"), this.audioBtnEle.style =
  46272. "font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center",
  46273. this.audioBtnEle.classList = "iconfontep " + (this._muted ? "icon-jingyin" : "icon-shengyin1") +
  46274. " icon-wasm-audio", this._mediaDataSource.url.includes(".m3u8") && (this.progressBarEle = document
  46275. .createElement("div"), this.progressBarEle.style = "display:flex;flex:1;opacity: 0", this
  46276. .timeTrackEle = document.createElement("input"), this.timeTrackEle.classList = "timeTrack", this
  46277. .timeTrackEle.id = "timeTrack", this.timeTrackEle.type = "range", this.timeTrackEle.style =
  46278. "width:100%;-webkit-appearance: none;height:3px;border-radius:3px;cursor:pointer;margin:auto;display:block;color: #FFF",
  46279. this.timeTrackEle.value = 0, this.timeTrackEle.oninput = function() {
  46280. e.seekToPercent(e.timeTrackEle.value, 1)
  46281. }, this.progressBarEle.appendChild(this.timeTrackEle), this.progressBarLabelEle = document
  46282. .createElement("label"), this.progressBarLabelEle.style =
  46283. "color: #fff;padding-left: 10px;line-height:30px;font-size: 12px;min-width: 115px", this
  46284. .progressBarLabelEle.innerHTML = "00:00:00/00:00:00", this.progressBarEle.appendChild(this
  46285. .progressBarLabelEle)), this.playBtnEle.onclick = function(ee) {
  46286. return e._switchPlay(ee)
  46287. }, this.audioBtnEle.onclick = function() {
  46288. return e._switchAudio()
  46289. };
  46290. var r = document.createElement("div");
  46291. r.style = "display: flex;flex-direction: row;", this.kbpsEle = document.createElement("div"), this
  46292. .kbpsEle.style =
  46293. "font-size:12px;min-width:60px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;padding-right: 10px;",
  46294. this.luXiangEle = document.createElement("span"), this.luXiangEle.title = "录像", this.luXiangEle
  46295. .style =
  46296. "font-size:16px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;",
  46297. this.luXiangEle.classList = "iconfontep icon-luxiang2", this.luXiangEle.onclick = function() {
  46298. return e._recordSwitch()
  46299. };
  46300. var n = document.createElement("span");
  46301. n.title = "快照", n.style =
  46302. "font-size:16px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center;",
  46303. n.classList = "iconfontep icon-xiangji", n.onclick = function() {
  46304. return e._saveLocalSnapshot()
  46305. }, this._fullScreenBtnEle = document.createElement("span"), this._fullScreenBtnEle.title = "全屏",
  46306. this._fullScreenBtnEle.style =
  46307. "font-size:14px;width:40px;height: 30px;color:#FFF;text-align:center;display:flex;flex-direction: row;justify-content: center;align-items: center",
  46308. this._fullScreenBtnEle.classList = "iconfontep " + (this.isFullScreen ? "icon-xiaoping" :
  46309. "icon-quanping1"), this._fullScreenBtnEle.onclick = function() {
  46310. return e._requestFullScreen()
  46311. }, this._mediaElement.parentNode.onmousemove = function() {
  46312. e.videoToolsTimer && clearTimeout(e.videoToolsTimer), e.videoTools.style.opacity = "1", e
  46313. .videoToolsTimer = setTimeout(function() {
  46314. e.videoTools.style.opacity = "0"
  46315. }, 1e4)
  46316. }, this._mediaElement.parentNode.onmouseout = function() {
  46317. e.videoTools.style.opacity = "0", e.videoToolsTimer && clearTimeout(e.videoToolsTimer), e
  46318. .videoToolsTimer = null
  46319. }, i.appendChild(this.playBtnEle), i.appendChild(this.audioBtnEle), r.appendChild(this.kbpsEle),
  46320. this.isiOS || (r.appendChild(this.luXiangEle), r.appendChild(n)), r.appendChild(this
  46321. ._fullScreenBtnEle), t.appendChild(i), this.progressBarEle && !this._mobile && t.appendChild(this
  46322. .progressBarEle), t.appendChild(r), this._mediaElement.parentNode.appendChild(t), window
  46323. .onresize = function() {
  46324. !document.fullscreenElement && e.isFullScreen && (e.isFullScreen = !1, e._fullScreenBtnEle
  46325. .classList = "iconfontep " + (e.isFullScreen ? "icon-xiaoping" : "icon-quanping1"))
  46326. }
  46327. }, r._recordingUIChange = function() {
  46328. this._recording = !this._recording, this.luXiangEle.title = this._recording ? "关闭录像" : "录像", this
  46329. .luXiangEle.style.color = this._recording ? "red" : "white"
  46330. }, r._requestFullScreen = function() {
  46331. this.isFullScreen = !this.isFullScreen, this._fullScreenBtnEle.title = this.isFullScreen ? "退出全屏" :
  46332. "全屏", this._fullScreenBtnEle.classList = "iconfontep " + (this.isFullScreen ? "icon-xiaoping" :
  46333. "icon-quanping1"), this._emitter.emit("changeFullScreen", this.isFullScreen)
  46334. }, r._updateDuration = function(e) {
  46335. var t = e.currentTime,
  46336. i = e.duration;
  46337. if (!i) return this.progressBarEle.style.opacity = 0;
  46338. "0" === this.progressBarEle.style.opacity && (this.progressBarEle.style.opacity = 1);
  46339. var r = parseInt((t + 1) / i * 100);
  46340. r !== parseInt(this.timeTrackEle.value) && (this.timeTrackEle.value = r), this.progressBarLabelEle &&
  46341. (t < 1 ? t = 0 : t > i && (t = i), this.progressBarLabelEle.innerHTML = this._formatTime(t) +
  46342. " / " + this._formatTime(i)), this._emitter.emit("timeupdate", t)
  46343. }, r._updateKbps = function(e) {
  46344. e.currentSpeed;
  46345. var t = e.averageKBps;
  46346. this.kbpsEle && (this.kbpsEle.innerText = 8 * t >= 1024 ? (8 * t / 1024).toFixed(2) + " Mb/s" :
  46347. parseInt(8 * t + "") + " Kb/s")
  46348. }, r._saveLocalSnapshot = function(fn, name) {
  46349. this._transmuxer.saveLocalSnapshot(fn, name)
  46350. }, r._formatTime = function(e) {
  46351. return (Math.floor(e / 3600) < 10 ? "0" + Math.floor(e / 3600) : Math.floor(e / 3600)) + ":" + (Math
  46352. .floor(e / 60 % 60) < 10 ? "0" + Math.floor(e / 60 % 60) : Math.floor(e / 60 % 60)) + ":" + (Math
  46353. .floor(e % 60) < 10 ? "0" + Math.floor(e % 60) : Math.floor(e % 60))
  46354. }, r._onAudioError = function() {
  46355. this._msectl && this._msectl._removerAudioSourceBuffer()
  46356. }, r.getClass = function(e) {
  46357. return 0 === e ? "blue" : 1 === e ? "black" : 2 === e ? "white" : 3 === e ? "green" : 4 === e ?
  46358. "red" : 5 === e ? "yellow" : "red"
  46359. }, r.seekToPercent = function(e) {
  46360. this.seek(e, 1)
  46361. }, r.startWebVideoRecord = function(e, t, i, r, stop) {
  46362. if(this._transmuxer) {
  46363. if(this._mediaDataSource.url.includes(".flv")) {
  46364. r = (e) => {
  46365. console.log('============recordEndCB===========', e)
  46366. clearTimeout(this.recordError);
  46367. if(e === 0) {
  46368. this._emitter.emit('recordEnd', true);
  46369. }
  46370. };
  46371. this.recordError = setTimeout(() => {
  46372. console.log('============recordError===========')
  46373. this._emitter.emit('recordEnd', false);
  46374. }, 500);
  46375. this._transmuxer.videoRecording(t, i || this._recordMaxFileSize, e, r, stop);
  46376. }
  46377. this._webRecording.enable = e;
  46378. return;
  46379. }
  46380. if(this._mediaDataSource.url.includes(".flv")) {
  46381. this._emitter.emit('recordEnd', false);
  46382. }
  46383. }, r._isMobile = function() {
  46384. try {
  46385. return document.createEvent("TouchEvent"), !0
  46386. } catch (e) {
  46387. return !1
  46388. }
  46389. }, r._recordSwitch = function(playerName, stop) {
  46390. this.playerName = playerName;
  46391. this.stopRecoeding = stop;
  46392. var e = this;
  46393. this._recordingUIChange(), this.startWebVideoRecord(this._recording ? 1 : 0, playerName + '-' + this.dateFormat(new Date, "YYYYMMDDhhmmss"), "", function() {
  46394. e._emitter.emit(w.RECORDING_END)
  46395. }, stop)
  46396. }, r._switchAudio = function() {
  46397. this._muted = !this._muted, this.audioBtnEle.title = this._muted ? "取消静音" : "静音", this.audioBtnEle
  46398. .classList = "iconfontep " + (this._muted ? "icon-jingyin" : "icon-shengyin1") + " ", this
  46399. ._mediaElement.muted = this._muted, this._transmuxer && (this._transmuxer._wasmInitAudioPlayer ?
  46400. this._muted ? this._transmuxer._wasmAudioPlayer.pause() : this._transmuxer._wasmAudioPlayer
  46401. .resume() : this._muted || this._transmuxer._openWasmAudio())
  46402. }, r._switchPlay = function(ee) {
  46403. ee.stopPropagation();
  46404. this.playing ? this.pause() : this.resume(), this.playing = !this.playing, this.playBtnEle.title =
  46405. this.playing ? "暂停" : "播放", this.playBtnEle.classList = "iconfontep " + (this.playing ?
  46406. "icon-zanting" : "icon-bofang")
  46407. }, t = e, (i = [{
  46408. key: "type",
  46409. get: function() {
  46410. return this._type
  46411. }
  46412. }, {
  46413. key: "buffered",
  46414. get: function() {
  46415. return this._mediaElement.buffered
  46416. }
  46417. }, {
  46418. key: "duration",
  46419. get: function() {
  46420. return this._mediaElement.duration
  46421. }
  46422. }, {
  46423. key: "volume",
  46424. get: function() {
  46425. return this._mediaElement.volume
  46426. },
  46427. set: function(e) {
  46428. this._mediaElement.volume = e
  46429. }
  46430. }, {
  46431. key: "muted",
  46432. get: function() {
  46433. return this._mediaElement.muted
  46434. },
  46435. set: function(e) {
  46436. this._mediaElement.muted = e
  46437. }
  46438. }, {
  46439. key: "currentTime",
  46440. get: function() {
  46441. return this._mediaElement ? this._mediaElement.currentTime : 0
  46442. },
  46443. set: function(e) {
  46444. this._mediaElement ? this._internalSeek(e) : this._pendingSeekTime = e
  46445. }
  46446. }, {
  46447. key: "mediaInfo",
  46448. get: function() {
  46449. return Object.assign({}, this._mediaInfo)
  46450. }
  46451. }, {
  46452. key: "statisticsInfo",
  46453. get: function() {
  46454. return null == this._statisticsInfo && (this._statisticsInfo = {}), this._statisticsInfo =
  46455. this._fillStatisticsInfo(this._statisticsInfo), Object.assign({}, this._statisticsInfo)
  46456. }
  46457. }]) && x(t.prototype, i), Object.defineProperty(t, "prototype", {
  46458. writable: !1
  46459. }), e
  46460. }();
  46461. function U(e, t) {
  46462. for (var i = 0; i < t.length; i++) {
  46463. var r = t[i];
  46464. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  46465. .defineProperty(e, r.key, r)
  46466. }
  46467. }
  46468. var N = function() {
  46469. function e(e, t) {
  46470. if (this.TAG = "NativePlayer", this._type = "NativePlayer", this._emitter = new d.a, this._config = s(),
  46471. "object" == typeof t && Object.assign(this._config, t), "flv" === e.type.toLowerCase()) throw new O.b(
  46472. "NativePlayer does't support flv MediaDataSource input!");
  46473. if (e.hasOwnProperty("segments")) throw new O.b("NativePlayer(" + e.type +
  46474. ") doesn't support multipart playback!");
  46475. this.e = {
  46476. onvLoadedMetadata: this._onvLoadedMetadata.bind(this)
  46477. }, this._pendingSeekTime = null, this._statisticsReporter = null, this._mediaDataSource = e, this
  46478. ._mediaElement = null
  46479. }
  46480. var t, i, r = e.prototype;
  46481. return r.destroy = function() {
  46482. this._mediaElement && (this.unload(), this.detachMediaElement()), this.e = null, this
  46483. ._mediaDataSource = null, this._emitter.removeAllListeners(), this._emitter = null
  46484. }, r.on = function(e, t) {
  46485. var i = this;
  46486. e === f.MEDIA_INFO ? null != this._mediaElement && 0 !== this._mediaElement.readyState && Promise
  46487. .resolve().then(function() {
  46488. i._emitter.emit(f.MEDIA_INFO, i.mediaInfo)
  46489. }) : e === f.STATISTICS_INFO && null != this._mediaElement && 0 !== this._mediaElement.readyState &&
  46490. Promise.resolve().then(function() {
  46491. i._emitter.emit(f.STATISTICS_INFO, i.statisticsInfo)
  46492. }), this._emitter.addListener(e, t)
  46493. }, r.off = function(e, t) {
  46494. this._emitter.removeListener(e, t)
  46495. }, r.attachMediaElement = function(e) {
  46496. if (this._mediaElement = e, e.addEventListener("loadedmetadata", this.e.onvLoadedMetadata), null !=
  46497. this._pendingSeekTime) try {
  46498. e.currentTime = this._pendingSeekTime, this._pendingSeekTime = null
  46499. } catch (e) {}
  46500. }, r.detachMediaElement = function() {
  46501. this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src"), this
  46502. ._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata), this
  46503. ._mediaElement = null), null != this._statisticsReporter && (window.clearInterval(this
  46504. ._statisticsReporter), this._statisticsReporter = null)
  46505. }, r.load = function() {
  46506. if (!this._mediaElement) throw new O.a("HTMLMediaElement must be attached before load()!");
  46507. this._mediaElement.src = this._mediaDataSource.url, this._mediaElement.readyState > 0 && (this
  46508. ._mediaElement.currentTime = 0), this._mediaElement.preload = "auto", this._mediaElement.load(),
  46509. this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config
  46510. .statisticsInfoReportInterval)
  46511. }, r.unload = function() {
  46512. this._mediaElement && (this._mediaElement.src = "", this._mediaElement.removeAttribute("src")),
  46513. null != this._statisticsReporter && (window.clearInterval(this._statisticsReporter), this
  46514. ._statisticsReporter = null)
  46515. }, r.play = function() {
  46516. return this._mediaElement.play()
  46517. }, r.pause = function() {
  46518. this._mediaElement.pause()
  46519. }, r._onvLoadedMetadata = function(e) {
  46520. null != this._pendingSeekTime && (this._mediaElement.currentTime = this._pendingSeekTime, this
  46521. ._pendingSeekTime = null), this._emitter.emit(f.MEDIA_INFO, this.mediaInfo)
  46522. }, r._reportStatisticsInfo = function() {
  46523. this._emitter.emit(f.STATISTICS_INFO, this.statisticsInfo)
  46524. }, t = e, (i = [{
  46525. key: "type",
  46526. get: function() {
  46527. return this._type
  46528. }
  46529. }, {
  46530. key: "buffered",
  46531. get: function() {
  46532. return this._mediaElement.buffered
  46533. }
  46534. }, {
  46535. key: "duration",
  46536. get: function() {
  46537. return this._mediaElement.duration
  46538. }
  46539. }, {
  46540. key: "volume",
  46541. get: function() {
  46542. return this._mediaElement.volume
  46543. },
  46544. set: function(e) {
  46545. this._mediaElement.volume = e
  46546. }
  46547. }, {
  46548. key: "muted",
  46549. get: function() {
  46550. return this._mediaElement.muted
  46551. },
  46552. set: function(e) {
  46553. this._mediaElement.muted = e
  46554. }
  46555. }, {
  46556. key: "currentTime",
  46557. get: function() {
  46558. return this._mediaElement ? this._mediaElement.currentTime : 0
  46559. },
  46560. set: function(e) {
  46561. this._mediaElement ? this._mediaElement.currentTime = e : this._pendingSeekTime = e
  46562. }
  46563. }, {
  46564. key: "mediaInfo",
  46565. get: function() {
  46566. var e = {
  46567. mimeType: (this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/") + this
  46568. ._mediaDataSource.type
  46569. };
  46570. return this._mediaElement && (e.duration = Math.floor(1e3 * this._mediaElement.duration), this
  46571. ._mediaElement instanceof HTMLVideoElement && (e.width = this._mediaElement.videoWidth, e
  46572. .height = this._mediaElement.videoHeight)), e
  46573. }
  46574. }, {
  46575. key: "statisticsInfo",
  46576. get: function() {
  46577. var e = {
  46578. playerType: this._type,
  46579. url: this._mediaDataSource.url
  46580. };
  46581. if (!(this._mediaElement instanceof HTMLVideoElement)) return e;
  46582. var t = !0,
  46583. i = 0,
  46584. r = 0;
  46585. if (this._mediaElement.getVideoPlaybackQuality) {
  46586. var n = this._mediaElement.getVideoPlaybackQuality();
  46587. i = n.totalVideoFrames, r = n.droppedVideoFrames
  46588. } else null != this._mediaElement.webkitDecodedFrameCount ? (i = this._mediaElement
  46589. .webkitDecodedFrameCount, r = this._mediaElement.webkitDroppedFrameCount) : t = !1;
  46590. return t && (e.decodedFrames = i, e.droppedFrames = r), e
  46591. }
  46592. }]) && U(t.prototype, i), Object.defineProperty(t, "prototype", {
  46593. writable: !1
  46594. }), e
  46595. }();r.a.install();
  46596. var B = {
  46597. createPlayer: function(e, t) {
  46598. var i = e;
  46599. if (null == i || "object" != typeof i) throw new O.b("MediaDataSource must be an javascript object!");
  46600. return new P(i, t)
  46601. },
  46602. isSupported: function() {
  46603. return o.supportMSEH264Playback()
  46604. },
  46605. getFeatureList: function() {
  46606. return o.getFeatureList()
  46607. }
  46608. };B.BaseLoader = u.a, B.LoaderStatus = u.c, B.LoaderErrors = u.b, B.Events = f, B.ErrorTypes = I, B
  46609. .ErrorDetails = L, B.FlvPlayer = P, B.NativePlayer = N, B.LoggingControl = g.a, Object.defineProperty(B,
  46610. "version", {
  46611. enumerable: !0,
  46612. get: function() {
  46613. return __VERSION__
  46614. }
  46615. });
  46616. var F = B;t.default = F
  46617. }, function(e, t, i) {
  46618. "use strict";
  46619. i.r(t);
  46620. var r = i(30),
  46621. n = i.n(r),
  46622. a = i(123),
  46623. s = i.n(a);
  46624. function o(e, t) {
  46625. return (o = Object.setPrototypeOf || function(e, t) {
  46626. return e.__proto__ = t, e
  46627. })(e, t)
  46628. }
  46629. var u = function(e) {
  46630. var t, i;
  46631. function r() {
  46632. var t;
  46633. return (t = e.call(this) || this).buffer = "", t
  46634. }
  46635. return i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, o(t, i), r
  46636. .prototype.push = function(e) {
  46637. var t;
  46638. for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf("\n")) this
  46639. .trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer.substring(t + 1)
  46640. }, r
  46641. }(n.a);
  46642. function l(e, t) {
  46643. return (l = Object.setPrototypeOf || function(e, t) {
  46644. return e.__proto__ = t, e
  46645. })(e, t)
  46646. }
  46647. var d = function(e) {
  46648. for (var t, i = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), r = {}, n = i.length; n--;)
  46649. "" !== i[n] && ((t = /([^=]*)=(.*)/.exec(i[n]).slice(1))[0] = t[0].replace(/^\s+|\s+$/g, ""), t[1] = t[
  46650. 1].replace(/^\s+|\s+$/g, ""), t[1] = t[1].replace(/^['"](.*)['"]$/g, "$1"), r[t[0]] = t[1]);
  46651. return r
  46652. },
  46653. c = function(e) {
  46654. var t, i;
  46655. function r() {
  46656. var t;
  46657. return (t = e.call(this) || this).customParsers = [], t.tagMappers = [], t
  46658. }
  46659. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, l(t, i);
  46660. var n = r.prototype;
  46661. return n.push = function(e) {
  46662. var t, i, r = this;
  46663. 0 !== (e = e.trim()).length && ("#" === e[0] ? this.tagMappers.reduce(function(t, i) {
  46664. var r = i(e);
  46665. return r === e ? t : t.concat([r])
  46666. }, [e]).forEach(function(e) {
  46667. for (var n = 0; n < r.customParsers.length; n++)
  46668. if (r.customParsers[n].call(r, e)) return;
  46669. if (0 === e.indexOf("#EXT"))
  46670. if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) r.trigger("data", {
  46671. type: "tag",
  46672. tagType: "m3u"
  46673. });
  46674. else {
  46675. if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = {
  46676. type: "tag",
  46677. tagType: "inf"
  46678. }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]), void r.trigger(
  46679. "data", i);
  46680. if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = {
  46681. type: "tag",
  46682. tagType: "targetduration"
  46683. }, t[1] && (i.duration = parseInt(t[1], 10)), void r.trigger("data", i);
  46684. if (t = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return i = {
  46685. type: "tag",
  46686. tagType: "totalduration"
  46687. }, t[1] && (i.duration = parseInt(t[1], 10)), void r.trigger("data", i);
  46688. if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = {
  46689. type: "tag",
  46690. tagType: "version"
  46691. }, t[1] && (i.version = parseInt(t[1], 10)), void r.trigger("data", i);
  46692. if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
  46693. type: "tag",
  46694. tagType: "media-sequence"
  46695. }, t[1] && (i.number = parseInt(t[1], 10)), void r.trigger("data", i);
  46696. if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
  46697. type: "tag",
  46698. tagType: "discontinuity-sequence"
  46699. }, t[1] && (i.number = parseInt(t[1], 10)), void r.trigger("data", i);
  46700. if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = {
  46701. type: "tag",
  46702. tagType: "playlist-type"
  46703. }, t[1] && (i.playlistType = t[1]), void r.trigger("data", i);
  46704. if (t = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return i = {
  46705. type: "tag",
  46706. tagType: "byterange"
  46707. }, t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[2], 10)),
  46708. void r.trigger("data", i);
  46709. if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = {
  46710. type: "tag",
  46711. tagType: "allow-cache"
  46712. }, t[1] && (i.allowed = !/NO/.test(t[1])), void r.trigger("data", i);
  46713. if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) {
  46714. if (i = {
  46715. type: "tag",
  46716. tagType: "map"
  46717. }, t[1]) {
  46718. var a = d(t[1]);
  46719. if (a.URI && (i.uri = a.URI), a.BYTERANGE) {
  46720. var s = a.BYTERANGE.split("@"),
  46721. o = s[0],
  46722. u = s[1];
  46723. i.byterange = {}, o && (i.byterange.length = parseInt(o, 10)), u && (i.byterange
  46724. .offset = parseInt(u, 10))
  46725. }
  46726. }
  46727. r.trigger("data", i)
  46728. } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) {
  46729. if (i = {
  46730. type: "tag",
  46731. tagType: "stream-inf"
  46732. }, t[1]) {
  46733. if (i.attributes = d(t[1]), i.attributes.RESOLUTION) {
  46734. var l = i.attributes.RESOLUTION.split("x"),
  46735. c = {};
  46736. l[0] && (c.width = parseInt(l[0], 10)), l[1] && (c.height = parseInt(l[1], 10)), i
  46737. .attributes.RESOLUTION = c
  46738. }
  46739. i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes.BANDWIDTH,
  46740. 10)), i.attributes["PROGRAM-ID"] && (i.attributes["PROGRAM-ID"] = parseInt(i
  46741. .attributes["PROGRAM-ID"], 10))
  46742. }
  46743. r.trigger("data", i)
  46744. } else {
  46745. if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = {
  46746. type: "tag",
  46747. tagType: "media"
  46748. }, t[1] && (i.attributes = d(t[1])), void r.trigger("data", i);
  46749. if (t = /^#EXT-X-ENDLIST/.exec(e)) r.trigger("data", {
  46750. type: "tag",
  46751. tagType: "endlist"
  46752. });
  46753. else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) r.trigger("data", {
  46754. type: "tag",
  46755. tagType: "discontinuity"
  46756. });
  46757. else {
  46758. if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = {
  46759. type: "tag",
  46760. tagType: "program-date-time"
  46761. }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])), void r
  46762. .trigger("data", i);
  46763. if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = {
  46764. type: "tag",
  46765. tagType: "key"
  46766. }, t[1] && (i.attributes = d(t[1]), i.attributes.IV && ("0x" === i.attributes.IV
  46767. .substring(0, 2).toLowerCase() && (i.attributes.IV = i.attributes.IV
  46768. .substring(2)), i.attributes.IV = i.attributes.IV.match(/.{8}/g), i
  46769. .attributes.IV[0] = parseInt(i.attributes.IV[0], 16), i.attributes.IV[1] =
  46770. parseInt(i.attributes.IV[1], 16), i.attributes.IV[2] = parseInt(i.attributes
  46771. .IV[2], 16), i.attributes.IV[3] = parseInt(i.attributes.IV[3], 16), i
  46772. .attributes.IV = new Uint32Array(i.attributes.IV))), void r.trigger("data", i);
  46773. if (t = /^#EXT-X-START:?(.*)$/.exec(e)) return i = {
  46774. type: "tag",
  46775. tagType: "start"
  46776. }, t[1] && (i.attributes = d(t[1]), i.attributes["TIME-OFFSET"] = parseFloat(i
  46777. .attributes["TIME-OFFSET"]), i.attributes.PRECISE = /YES/.test(i.attributes
  46778. .PRECISE)), void r.trigger("data", i);
  46779. if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = {
  46780. type: "tag",
  46781. tagType: "cue-out-cont"
  46782. }, t[1] ? i.data = t[1] : i.data = "", void r.trigger("data", i);
  46783. if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = {
  46784. type: "tag",
  46785. tagType: "cue-out"
  46786. }, t[1] ? i.data = t[1] : i.data = "", void r.trigger("data", i);
  46787. if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = {
  46788. type: "tag",
  46789. tagType: "cue-in"
  46790. }, t[1] ? i.data = t[1] : i.data = "", void r.trigger("data", i);
  46791. r.trigger("data", {
  46792. type: "tag",
  46793. data: e.slice(4)
  46794. })
  46795. }
  46796. }
  46797. }
  46798. else r.trigger("data", {
  46799. type: "comment",
  46800. text: e.slice(1)
  46801. })
  46802. }) : this.trigger("data", {
  46803. type: "uri",
  46804. uri: e
  46805. }))
  46806. }, n.addParser = function(e) {
  46807. var t = this,
  46808. i = e.expression,
  46809. r = e.customType,
  46810. n = e.dataParser,
  46811. a = e.segment;
  46812. "function" != typeof n && (n = function(e) {
  46813. return e
  46814. }), this.customParsers.push(function(e) {
  46815. if (i.exec(e)) return t.trigger("data", {
  46816. type: "custom",
  46817. data: n(e),
  46818. customType: r,
  46819. segment: a
  46820. }), !0
  46821. })
  46822. }, n.addTagMapper = function(e) {
  46823. var t = e.expression,
  46824. i = e.map;
  46825. this.tagMappers.push(function(e) {
  46826. return t.test(e) ? i(e) : e
  46827. })
  46828. }, r
  46829. }(n.a);
  46830. function h(e, t) {
  46831. return (h = Object.setPrototypeOf || function(e, t) {
  46832. return e.__proto__ = t, e
  46833. })(e, t)
  46834. }
  46835. var f = function(e) {
  46836. var t, i;
  46837. function r() {
  46838. var t;
  46839. (t = e.call(this) || this).lineStream = new u, t.parseStream = new c, t.lineStream.pipe(t.parseStream);
  46840. var i, r, n = function(e) {
  46841. if (void 0 === e) throw new ReferenceError(
  46842. "this hasn't been initialised - super() hasn't been called");
  46843. return e
  46844. }(t),
  46845. a = [],
  46846. o = {},
  46847. l = {
  46848. AUDIO: {},
  46849. VIDEO: {},
  46850. "CLOSED-CAPTIONS": {},
  46851. SUBTITLES: {}
  46852. },
  46853. d = 0;
  46854. return t.manifest = {
  46855. allowCache: !0,
  46856. discontinuityStarts: [],
  46857. segments: []
  46858. }, t.parseStream.on("data", function(e) {
  46859. var t, u;
  46860. ({
  46861. tag: function() {
  46862. (({
  46863. "allow-cache": function() {
  46864. this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger("info", {
  46865. message: "defaulting allowCache to YES"
  46866. }), this.manifest.allowCache = !0)
  46867. },
  46868. byterange: function() {
  46869. var t = {};
  46870. "length" in e && (o.byterange = t, t.length = e.length, "offset" in e || (this
  46871. .trigger("info", {
  46872. message: "defaulting offset to zero"
  46873. }), e.offset = 0)), "offset" in e && (o.byterange = t, t.offset = e.offset)
  46874. },
  46875. endlist: function() {
  46876. this.manifest.endList = !0
  46877. },
  46878. inf: function() {
  46879. "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this
  46880. .trigger("info", {
  46881. message: "defaulting media sequence to zero"
  46882. })), "discontinuitySequence" in this.manifest || (this.manifest
  46883. .discontinuitySequence = 0, this.trigger("info", {
  46884. message: "defaulting discontinuity sequence to zero"
  46885. })), e.duration > 0 && (o.duration = e.duration), 0 === e.duration && (o
  46886. .duration = .01, this.trigger("info", {
  46887. message: "updating zero segment duration to a small value"
  46888. })), this.manifest.segments = a
  46889. },
  46890. key: function() {
  46891. if (e.attributes)
  46892. if ("NONE" !== e.attributes.METHOD)
  46893. if (e.attributes.URI) {
  46894. if ("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed" === e.attributes
  46895. .KEYFORMAT) return -1 === ["SAMPLE-AES", "SAMPLE-AES-CTR",
  46896. "SAMPLE-AES-CENC"
  46897. ].indexOf(e.attributes.METHOD) ? void this.trigger("warn", {
  46898. message: "invalid key method provided for Widevine"
  46899. }) : ("SAMPLE-AES-CENC" === e.attributes.METHOD && this.trigger(
  46900. "warn", {
  46901. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  46902. }), "data:text/plain;base64," !== e.attributes.URI.substring(0,
  46903. 23) ? void this.trigger("warn", {
  46904. message: "invalid key URI provided for Widevine"
  46905. }) : e.attributes.KEYID && "0x" === e.attributes.KEYID.substring(0,
  46906. 2) ? void(this.manifest.contentProtection = {
  46907. "com.widevine.alpha": {
  46908. attributes: {
  46909. schemeIdUri: e.attributes.KEYFORMAT,
  46910. keyId: e.attributes.KEYID.substring(2)
  46911. },
  46912. pssh: s()(e.attributes.URI.split(",")[1])
  46913. }
  46914. }) : void this.trigger("warn", {
  46915. message: "invalid key ID provided for Widevine"
  46916. }));
  46917. e.attributes.METHOD || this.trigger("warn", {
  46918. message: "defaulting key method to AES-128"
  46919. }), r = {
  46920. method: e.attributes.METHOD || "AES-128",
  46921. uri: e.attributes.URI
  46922. }, void 0 !== e.attributes.IV && (r.iv = e.attributes.IV)
  46923. } else this.trigger("warn", {
  46924. message: "ignoring key declaration without URI"
  46925. });
  46926. else r = null;
  46927. else this.trigger("warn", {
  46928. message: "ignoring key declaration without attribute list"
  46929. })
  46930. },
  46931. "media-sequence": function() {
  46932. isFinite(e.number) ? this.manifest.mediaSequence = e.number : this.trigger(
  46933. "warn", {
  46934. message: "ignoring invalid media sequence: " + e.number
  46935. })
  46936. },
  46937. "discontinuity-sequence": function() {
  46938. isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, d = e
  46939. .number) : this.trigger("warn", {
  46940. message: "ignoring invalid discontinuity sequence: " + e.number
  46941. })
  46942. },
  46943. "playlist-type": function() {
  46944. /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e.playlistType :
  46945. this.trigger("warn", {
  46946. message: "ignoring unknown playlist type: " + e.playlist
  46947. })
  46948. },
  46949. map: function() {
  46950. i = {}, e.uri && (i.uri = e.uri), e.byterange && (i.byterange = e.byterange)
  46951. },
  46952. "stream-inf": function() {
  46953. this.manifest.playlists = a, this.manifest.mediaGroups = this.manifest
  46954. .mediaGroups || l, e.attributes ? (o.attributes || (o.attributes = {}), Object
  46955. .assign(o.attributes, e.attributes)) : this.trigger("warn", {
  46956. message: "ignoring empty stream-inf attributes"
  46957. })
  46958. },
  46959. media: function() {
  46960. if (this.manifest.mediaGroups = this.manifest.mediaGroups || l, e.attributes &&
  46961. e.attributes.TYPE && e.attributes["GROUP-ID"] && e.attributes.NAME) {
  46962. var i = this.manifest.mediaGroups[e.attributes.TYPE];
  46963. i[e.attributes["GROUP-ID"]] = i[e.attributes["GROUP-ID"]] || {}, t = i[e
  46964. .attributes["GROUP-ID"]], (u = {
  46965. default: /yes/i.test(e.attributes.DEFAULT)
  46966. }).default ? u.autoselect = !0 : u.autoselect = /yes/i.test(e.attributes
  46967. .AUTOSELECT), e.attributes.LANGUAGE && (u.language = e.attributes
  46968. .LANGUAGE), e.attributes.URI && (u.uri = e.attributes.URI), e.attributes[
  46969. "INSTREAM-ID"] && (u.instreamId = e.attributes["INSTREAM-ID"]), e
  46970. .attributes.CHARACTERISTICS && (u.characteristics = e.attributes
  46971. .CHARACTERISTICS), e.attributes.FORCED && (u.forced = /yes/i.test(e
  46972. .attributes.FORCED)), t[e.attributes.NAME] = u
  46973. } else this.trigger("warn", {
  46974. message: "ignoring incomplete or missing media group"
  46975. })
  46976. },
  46977. discontinuity: function() {
  46978. d += 1, o.discontinuity = !0, this.manifest.discontinuityStarts.push(a.length)
  46979. },
  46980. "program-date-time": function() {
  46981. void 0 === this.manifest.dateTimeString && (this.manifest.dateTimeString = e
  46982. .dateTimeString, this.manifest.dateTimeObject = e.dateTimeObject), o
  46983. .dateTimeString = e.dateTimeString, o.dateTimeObject = e.dateTimeObject
  46984. },
  46985. targetduration: function() {
  46986. !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
  46987. message: "ignoring invalid target duration: " + e.duration
  46988. }) : this.manifest.targetDuration = e.duration
  46989. },
  46990. totalduration: function() {
  46991. !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
  46992. message: "ignoring invalid total duration: " + e.duration
  46993. }) : this.manifest.totalDuration = e.duration
  46994. },
  46995. start: function() {
  46996. e.attributes && !isNaN(e.attributes["TIME-OFFSET"]) ? this.manifest.start = {
  46997. timeOffset: e.attributes["TIME-OFFSET"],
  46998. precise: e.attributes.PRECISE
  46999. } : this.trigger("warn", {
  47000. message: "ignoring start declaration without appropriate attribute list"
  47001. })
  47002. },
  47003. "cue-out": function() {
  47004. o.cueOut = e.data
  47005. },
  47006. "cue-out-cont": function() {
  47007. o.cueOutCont = e.data
  47008. },
  47009. "cue-in": function() {
  47010. o.cueIn = e.data
  47011. }
  47012. })[e.tagType] || function() {}).call(n)
  47013. },
  47014. uri: function() {
  47015. o.uri = e.uri, a.push(o), this.manifest.targetDuration && !("duration" in o) && (this
  47016. .trigger("warn", {
  47017. message: "defaulting segment duration to the target duration"
  47018. }), o.duration = this.manifest.targetDuration), r && (o.key = r), o.timeline = d, i &&
  47019. (o.map = i), o = {}
  47020. },
  47021. comment: function() {},
  47022. custom: function() {
  47023. e.segment ? (o.custom = o.custom || {}, o.custom[e.customType] = e.data) : (this.manifest
  47024. .custom = this.manifest.custom || {}, this.manifest.custom[e.customType] = e.data)
  47025. }
  47026. })[e.type].call(n)
  47027. }), t
  47028. }
  47029. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, h(t, i);
  47030. var n = r.prototype;
  47031. return n.push = function(e) {
  47032. this.lineStream.push(e)
  47033. }, n.end = function() {
  47034. this.lineStream.push("\n")
  47035. }, n.addParser = function(e) {
  47036. this.parseStream.addParser(e)
  47037. }, n.addTagMapper = function(e) {
  47038. this.parseStream.addTagMapper(e)
  47039. }, r
  47040. }(n.a),
  47041. p = i(1),
  47042. m = new WebAssembly.Memory({
  47043. initial: 256,
  47044. maximum: 256
  47045. });
  47046. new WebAssembly.Table({
  47047. initial: 0,
  47048. maximum: 0,
  47049. element: "anyfunc"
  47050. }), m.buffer.byteLength, t.default = function(e) {
  47051. e.url = "", e.canvas = null, e.webGLPlayer = null, e.videoSampleQueue = [], e.audioSampleQueue = [], e
  47052. .videoInterval = 40, e.lastRenderTime = 0, e.intervalVal = 0, e.renderFrameCount = 0, e.requestAbort = !
  47053. 1, e.pause = !1, e.cbStreamData = !0, e.reConnect = !0, e.isLiveStream = !0, e.seekTime = 0, e
  47054. .totalDuration = 0, e.playDuration = 0, e.startVideoPts = 0, e.startAudioPts = 0, e.tsFileList = [], e
  47055. .getFileIndex = 0, e.lastTsFile = "", e.isFirstFile = !0, e.lastTsFileSequence = 0, e
  47056. .sequenceExceptNum = 0, e.hlsTsPlaybackFileNo = -1, e.tsDemuxer = null, e.getFileCount = 100, e
  47057. .intervalHandle = -1, e.intervalValue = 40, e.startDownloadTimeSecs = 0;
  47058. var t = function(e, t) {
  47059. if (e.indexOf("http") >= 0) return e;
  47060. for (var i = t, r = 0, n = 0; n >= 0;)(n = i.indexOf("/")) >= 0 ? (i = i.substring(n + 1), r += n +
  47061. 1) : i = t.substring(0, r);
  47062. return "" !== e ? i + e : i
  47063. },
  47064. i = function() {
  47065. var t = {
  47066. cmd: p.l,
  47067. workerId: p.b
  47068. };
  47069. e.postMessage(t), e.getFileIndex = 0, e.hlsTsPlaybackFileNo = -1
  47070. },
  47071. r = function r(n, a) {
  47072. if (e.url = n, 1 != e._requestAbort) {
  47073. if (!e.pause && (!(e.totalDuration > 0) || e.isLiveStream)) {
  47074. var s = new XMLHttpRequest;
  47075. s.open("get", n, !0), s.responseType = "text", s.onreadystatechange = function() {
  47076. if (4 != s.readyState || 200 != s.status && 304 != s.status) 4 === s.readyState && 404 === s
  47077. .status && e.postMessage({
  47078. cmd: 404
  47079. });
  47080. else {
  47081. var i = new f;
  47082. i.push(s.responseText), i.end();
  47083. var n = i.manifest;
  47084. if ("undefined" !== i.manifest.endList && 1 == i.manifest.endList ? e.isLiveStream = !1 : e
  47085. .isLiveStream = !0, n.segments.length < 1) {
  47086. var o = e;
  47087. return void p.j(3e3).then(function() {
  47088. r(o.url, 1)
  47089. })
  47090. }
  47091. var u = 0,
  47092. l = 0;
  47093. if (e.isLiveStream)
  47094. if ("" == e.lastTsFile) {
  47095. for (u = 0; u < n.segments.length; u++) g = {
  47096. filename: h = t(n.segments[u].uri, e.url),
  47097. duration: n.segments[u].duration
  47098. }, e.tsFileList.push(g);
  47099. var d = 0;
  47100. n.segments.length > 2 && (d = n.segments.length - 1 - 1), e.getFileIndex = d, e
  47101. .lastTsFile = n.segments[d].uri
  47102. } else {
  47103. d = -1;
  47104. var c = !1;
  47105. for (u = 0; u < n.segments.length; u++) h = t(n.segments[u].uri, e.url), n.segments[u]
  47106. .uri !== e.lastTsFile ? d >= 0 && (g = {
  47107. filename: h,
  47108. duration: n.segments[u].duration
  47109. }, e.totalDuration += n.segments[u].duration, e.tsFileList.push(g), c || (e
  47110. .lastTsFile = n.segments[u].uri, c = !0)) : (d = u, e.tsFileList.length = 0, e
  47111. .tsFileList = [], e.getFileIndex = 0);
  47112. if (d < 0)
  47113. for (e.tsFileList.length = 0, e.tsFileList = [], e.getFileIndex = 0, u = 0; u < n
  47114. .segments.length; u++) g = {
  47115. filename: h = t(n.segments[u].uri, e.url),
  47116. duration: n.segments[u].duration
  47117. }, e.totalDuration += n.segments[u].duration, e.tsFileList.push(g), e.lastTsFile = n
  47118. .segments[u].uri;
  47119. if (1 === a) return
  47120. }
  47121. else {
  47122. for (e.seekTime > 0 && (e.getFileIndex = -1), u = 0; u < n.segments.length; u++) {
  47123. var h = t(n.segments[u].uri, e.url),
  47124. m = 0;
  47125. for (l = 0; l < e.tsFileList.length; l++)
  47126. if (e.tsFileList[l].filename === h) {
  47127. m = 1;
  47128. break
  47129. } if (0 == m) {
  47130. e.seekTime > 0 && e.totalDuration >= e.seekTime && e.getFileIndex < 0 && (e
  47131. .getFileIndex = u);
  47132. var g = {
  47133. filename: h,
  47134. duration: n.segments[u].duration
  47135. };
  47136. e.totalDuration += n.segments[u].duration, e.tsFileList.push(g)
  47137. }
  47138. }
  47139. e.getFileIndex < 0 && (e.getFileIndex = 0);
  47140. var v = {
  47141. cmd: p.u,
  47142. duration: e.totalDuration,
  47143. live: e.isLiveStream,
  47144. workerId: p.b
  47145. };
  47146. e.postMessage(v)
  47147. }
  47148. e.tsFileList.length > 0 && 1 == a && (v = {
  47149. cmd: p.w,
  47150. workerId: p.b
  47151. }, e.postMessage(v))
  47152. }
  47153. }, s.send()
  47154. }
  47155. } else i()
  47156. },
  47157. n = function t() {
  47158. if (!(e.getFileCount++ < 1)) {
  47159. var n = !1;
  47160. if (!e.pause)
  47161. if (1 != e._requestAbort) {
  47162. if (e.isLiveStream) {
  47163. if (e.getFileCount = 0, e.getFileIndex >= e.tsFileList.length || 3 == e.getFileCount)
  47164. return void r(e.url, 1);
  47165. n = !0
  47166. } else if (e.getFileIndex >= e.tsFileList.length) {
  47167. e.getFileIndex++;
  47168. var a = {
  47169. cmd: p.r,
  47170. workerId: p.b
  47171. };
  47172. return void e.postMessage(a)
  47173. }
  47174. var s = e.tsFileList[e.getFileIndex].filename;
  47175. if (e.isLiveStream) {
  47176. var o = function(e) {
  47177. var t = s.split("-"),
  47178. i = t.length;
  47179. if (i > 0) {
  47180. var r = t[i - 1].split(".");
  47181. if (r.length > 0) return r[0]
  47182. }
  47183. return ""
  47184. }(),
  47185. u = parseInt(o);
  47186. u > 0 && u > e.lastTsFileSequence + 1 && (e.sequenceExceptNum++, a = {
  47187. cmd: p.z,
  47188. workerId: p.b,
  47189. fileSequence: e.sequenceExceptNum
  47190. }, e.postMessage(a)), e.lastTsFileSequence = u
  47191. } else if (e.hlsTsPlaybackFileNo == e.getFileIndex) return;
  47192. var l = new XMLHttpRequest;
  47193. l.open("get", s, !0), l.responseType = "arraybuffer", l.onreadystatechange = function() {
  47194. if (404 == l.status) return p.e("current file not found. refresh list..."), void r(e.url,
  47195. 1);
  47196. if (4 == l.readyState && (200 == l.status || 304 == l.status)) {
  47197. var i = new Uint8Array(l.response),
  47198. a = 0;
  47199. for (a = 0; a < e.getFileIndex; a++) e.tsFileList[a].duration;
  47200. var s = {
  47201. cmd: p.q,
  47202. workerId: p.b,
  47203. mediaType: 1,
  47204. codecId: 27,
  47205. flag: 0,
  47206. pts: 0,
  47207. playTimeSec: 0,
  47208. dat: i
  47209. };
  47210. if (e.postMessage(s, [s.dat.buffer]), e.intervalHandle >= 0 && (clearInterval(e
  47211. .intervalHandle), e.intervalHandle = -1), !e.pause) {
  47212. var o = e.getFileIndex;
  47213. o >= 0 && o < e.tsFileList.length ? e.intervalValue = 1e3 * e.tsFileList[o].duration -
  47214. 600 : e.intervalValue = 2e3, e.isFirstFile && (e.isFirstFile = !1, e.intervalValue >
  47215. 900 && (e.intervalValue -= 900)), e.intervalValue = 1e3 * e.tsFileList[o].duration,
  47216. e.intervalHandle = setInterval(t, e.intervalValue)
  47217. }
  47218. if (e.getFileCount = 100, e.getFileIndex++, e.getFileIndex >= 0 && (e.getFileIndex, e
  47219. .tsFileList.length), s = {
  47220. cmd: p.t,
  47221. workerId: p.b
  47222. }, e.postMessage(s), n) return r(e.url, 0)
  47223. }
  47224. }, l.send(), e.hlsTsPlaybackFileNo = e.getFileIndex
  47225. } else i()
  47226. }
  47227. };
  47228. e.addEventListener("message", function(t) {
  47229. var a = t.data;
  47230. switch (a.cmd) {
  47231. case p.w:
  47232. e.url = a.url, e.seekTime = a.time, r(a.url, 1);
  47233. break;
  47234. case p.s:
  47235. 0 == a.t && n();
  47236. break;
  47237. case p.y:
  47238. r(e.url, 1);
  47239. break;
  47240. case p.B:
  47241. var s = a.time;
  47242. 1 == a.type && (s = a.time / 100 * e.totalDuration);
  47243. var o = !1,
  47244. u = 0,
  47245. l = 0;
  47246. for (l = 0; l < e.tsFileList.length; l++)
  47247. if ((u += e.tsFileList[l].duration) > s) {
  47248. e.getFileIndex = l, n();
  47249. var d = {
  47250. cmd: p.B,
  47251. type: a.type,
  47252. time: s
  47253. };
  47254. e.postMessage(d), o = !0;
  47255. break
  47256. } o || (d = {
  47257. cmd: p.B,
  47258. type: a.type,
  47259. time: s
  47260. }, e.postMessage(d));
  47261. break;
  47262. case p.x:
  47263. e.pause = !0;
  47264. break;
  47265. case p.A:
  47266. e.pause = !1, r(e.url, 1);
  47267. break;
  47268. case p.l:
  47269. e._requestAbort = !0, e.seekTime = 0, i()
  47270. }
  47271. })
  47272. }
  47273. }]).default
  47274. }),
  47275. function(e, t) {
  47276. "object" == typeof exports && "undefined" != typeof module ? module.exports = t(require("video.js")) : "function" ==
  47277. typeof define && define.amd ? define(["video.js"], t) : e.videojsFlash = t(e.videojs)
  47278. }(this, function(e) {
  47279. "use strict";
  47280. e = e && e.hasOwnProperty("default") ? e.default : e;
  47281. var t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ?
  47282. self : {},
  47283. i = "undefined" != typeof window ? window : void 0 !== t ? t : "undefined" != typeof self ? self : {},
  47284. r = function(e, t) {
  47285. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  47286. },
  47287. n = function(e, t) {
  47288. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  47289. return !t || "object" != typeof t && "function" != typeof t ? e : t
  47290. },
  47291. a = e.getComponent("Tech"),
  47292. s = e.dom,
  47293. o = e.url,
  47294. u = e.createTimeRange,
  47295. l = e.mergeOptions,
  47296. d = i && i.navigator || {},
  47297. c = function(e) {
  47298. function t(a, s) {
  47299. r(this, t);
  47300. var o = n(this, e.call(this, a, s));
  47301. return a.source && o.ready(function() {
  47302. this.setSource(a.source)
  47303. }, !0), a.startTime && o.ready(function() {
  47304. this.load(), this.play(), this.currentTime(a.startTime)
  47305. }, !0), i.videojs = i.videojs || {}, i.videojs.Flash = i.videojs.Flash || {}, i.videojs.Flash.onReady = t
  47306. .onReady, i.videojs.Flash.onEvent = t.onEvent, i.videojs.Flash.onError = t.onError, o.on("seeked",
  47307. function() {
  47308. this.lastSeekTarget_ = void 0
  47309. }), o
  47310. }
  47311. return function(e, t) {
  47312. if ("function" != typeof t && null !== t) throw new TypeError(
  47313. "Super expression must either be null or a function, not " + typeof t);
  47314. e.prototype = Object.create(t && t.prototype, {
  47315. constructor: {
  47316. value: e,
  47317. enumerable: !1,
  47318. writable: !0,
  47319. configurable: !0
  47320. }
  47321. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  47322. }(t, e), t.prototype.createEl = function() {
  47323. var e = this.options_;
  47324. e.swf || (e.swf = "https://vjs.zencdn.net/swf/5.4.2/video-js.swf");
  47325. var i = e.techId,
  47326. r = l({
  47327. readyFunction: "videojs.Flash.onReady",
  47328. eventProxyFunction: "videojs.Flash.onEvent",
  47329. errorEventProxyFunction: "videojs.Flash.onError",
  47330. autoplay: e.autoplay,
  47331. stretch: e.stretch || !1,
  47332. fluent: e.fluent || !1,
  47333. preload: e.preload,
  47334. loop: e.loop,
  47335. muted: e.muted
  47336. }, e.flashVars),
  47337. n = l({
  47338. wmode: "opaque",
  47339. bgcolor: "#000000"
  47340. }, e.params),
  47341. a = l({
  47342. id: i,
  47343. name: i,
  47344. class: "vjs-tech"
  47345. }, e.attributes);
  47346. return this.el_ = t.embed(e.swf, r, n, a), this.el_.tech = this, this.el_
  47347. }, t.prototype.play = function() {
  47348. this.ended() && this.setCurrentTime(0), this.el_.vjs_play()
  47349. }, t.prototype.pause = function() {
  47350. this.el_.vjs_pause()
  47351. }, t.prototype.src = function(e) {
  47352. return void 0 === e ? this.currentSrc() : this.setSrc(e)
  47353. }, t.prototype.setSrc = function(e) {
  47354. var t = this;
  47355. e = o.getAbsoluteURL(e), this.el_.vjs_src(e), this.autoplay() && this.setTimeout(function() {
  47356. return t.play()
  47357. }, 0)
  47358. }, t.prototype.seeking = function() {
  47359. return void 0 !== this.lastSeekTarget_
  47360. }, t.prototype.setCurrentTime = function(t) {
  47361. var i = this.seekable();
  47362. i.length && (t = (t = t > i.start(0) ? t : i.start(0)) < i.end(i.length - 1) ? t : i.end(i.length - 1), this
  47363. .lastSeekTarget_ = t, this.trigger("seeking"), this.el_.vjs_setProperty("currentTime", t), e.prototype
  47364. .setCurrentTime.call(this))
  47365. }, t.prototype.currentTime = function() {
  47366. return this.seeking() ? this.lastSeekTarget_ || 0 : this.el_.vjs_getProperty("currentTime")
  47367. }, t.prototype.currentSrc = function() {
  47368. return this.currentSource_ ? this.currentSource_.src : this.el_.vjs_getProperty("currentSrc")
  47369. }, t.prototype.duration = function() {
  47370. if (0 === this.readyState()) return NaN;
  47371. var e = this.el_.vjs_getProperty("duration");
  47372. return e >= 0 ? e : 1 / 0
  47373. }, t.prototype.load = function() {
  47374. this.el_.vjs_load()
  47375. }, t.prototype.poster = function() {
  47376. this.el_.vjs_getProperty("poster")
  47377. }, t.prototype.setPoster = function() {}, t.prototype.seekable = function() {
  47378. var e = this.duration();
  47379. return 0 === e ? u() : u(0, e)
  47380. }, t.prototype.buffered = function() {
  47381. var e = this.el_.vjs_getProperty("buffered");
  47382. return 0 === e.length ? u() : u(e[0][0], e[0][1])
  47383. }, t.prototype.supportsFullScreen = function() {
  47384. return !1
  47385. }, t.prototype.enterFullScreen = function() {
  47386. return !1
  47387. }, t.prototype.getVideoPlaybackQuality = function() {
  47388. var e = this.el_.vjs_getProperty("getVideoPlaybackQuality");
  47389. return i.performance && "function" == typeof i.performance.now ? e.creationTime = i.performance.now() : i
  47390. .performance && i.performance.timing && "number" == typeof i.performance.timing.navigationStart && (e
  47391. .creationTime = i.Date.now() - i.performance.timing.navigationStart), e
  47392. }, t
  47393. }(a),
  47394. h = ["rtmpConnection", "rtmpStream", "preload", "defaultPlaybackRate", "playbackRate", "autoplay", "stretch",
  47395. "fluent", "loop", "controls", "volume", "muted", "defaultMuted"
  47396. ],
  47397. f = ["networkState", "readyState", "initialTime", "startOffsetTime", "paused", "ended", "videoWidth",
  47398. "videoHeight"
  47399. ],
  47400. p = c.prototype;
  47401. function m(e) {
  47402. var t = e.charAt(0).toUpperCase() + e.slice(1);
  47403. p["set" + t] = function(t) {
  47404. return this.el_.vjs_setProperty(e, t)
  47405. }
  47406. }
  47407. function g(e) {
  47408. p[e] = function() {
  47409. return this.el_.vjs_getProperty(e)
  47410. }
  47411. }
  47412. for (var v = 0; v < h.length; v++) g(h[v]), m(h[v]);
  47413. for (var y = 0; y < f.length; y++) g(f[y]);
  47414. return c.isSupported = function() {
  47415. return !!(e.browser.IS_CHROME && !e.browser.IS_ANDROID || e.browser.IS_SAFARI && !e.browser.IS_IOS) || c
  47416. .version()[0] >= 10
  47417. }, a.withSourceHandlers(c), c.nativeSourceHandler = {}, c.nativeSourceHandler.canPlayType = function(e) {
  47418. return e in c.formats ? "maybe" : ""
  47419. }, c.nativeSourceHandler.canHandleSource = function(e, t) {
  47420. var i, r, n = void 0;
  47421. return e.type ? n = e.type.replace(/;.*/, "").toLowerCase() : (i = e.src, n = (r = o.getFileExtension(i)) ?
  47422. "video/" + r : ""), c.nativeSourceHandler.canPlayType(n)
  47423. }, c.nativeSourceHandler.handleSource = function(e, t, i) {
  47424. t.setSrc(e.src)
  47425. }, c.nativeSourceHandler.dispose = function() {}, c.registerSourceHandler(c.nativeSourceHandler), c.formats = {
  47426. "video/flv": "FLV",
  47427. "video/x-flv": "FLV",
  47428. "video/mp4": "MP4",
  47429. "video/m4v": "MP4"
  47430. }, c.onReady = function(e) {
  47431. var t = s.$("#" + e),
  47432. i = t && t.tech;
  47433. i && i.el() && c.checkReady(i)
  47434. }, c.checkReady = function(e) {
  47435. e.el() && (e.el().vjs_getProperty ? e.triggerReady() : this.setTimeout(function() {
  47436. c.checkReady(e)
  47437. }, 50))
  47438. }, c.onEvent = function(e, t) {
  47439. var i = s.$("#" + e).tech,
  47440. r = Array.prototype.slice.call(arguments, 2);
  47441. i.setTimeout(function() {
  47442. i.trigger(t, r)
  47443. }, 1)
  47444. }, c.onError = function(e, t) {
  47445. var i = s.$("#" + e).tech;
  47446. if ("srcnotfound" === t) return i.error(4);
  47447. "string" == typeof t ? i.error("FLASH: " + t) : (t.origin = "flash", i.error(t))
  47448. }, c.version = function() {
  47449. var e = "0,0,0";
  47450. try {
  47451. e = new i.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(
  47452. /^,?(.+),?$/)[1]
  47453. } catch (t) {
  47454. try {
  47455. d.mimeTypes["application/x-shockwave-flash"].enabledPlugin && (e = (d.plugins["Shockwave Flash 2.0"] || d
  47456. .plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1])
  47457. } catch (e) {}
  47458. }
  47459. return e.split(",")
  47460. }, c.embed = function(e, t, i, r) {
  47461. var n = c.getEmbedCode(e, t, i, r);
  47462. return s.createEl("div", {
  47463. innerHTML: n
  47464. }).childNodes[0]
  47465. }, c.getEmbedCode = function(e, t, i, r) {
  47466. var n = "",
  47467. a = "",
  47468. s = "";
  47469. return t && Object.getOwnPropertyNames(t).forEach(function(e) {
  47470. n += e + "=" + t[e] + "&amp;"
  47471. }), i = l({
  47472. movie: e,
  47473. flashvars: n,
  47474. allowScriptAccess: "always",
  47475. allowNetworking: "all"
  47476. }, i), Object.getOwnPropertyNames(i).forEach(function(e) {
  47477. a += '<param name="' + e + '" value="' + i[e] + '" />'
  47478. }), r = l({
  47479. data: e,
  47480. width: "100%",
  47481. height: "100%"
  47482. }, r), Object.getOwnPropertyNames(r).forEach(function(e) {
  47483. s += e + '="' + r[e] + '" '
  47484. }), '<object type="application/x-shockwave-flash" ' + s + ">" + a + "</object>"
  47485. },
  47486. function(e) {
  47487. e.streamingFormats = {
  47488. "rtmp/mp4": "MP4",
  47489. "rtmp/flv": "FLV"
  47490. }, e.streamFromParts = function(e, t) {
  47491. return e + "&" + t
  47492. }, e.streamToParts = function(e) {
  47493. var t = {
  47494. connection: "",
  47495. stream: ""
  47496. };
  47497. if (!e) return t;
  47498. var i = e.search(/&(?![\w-]+=)/),
  47499. r = void 0;
  47500. return -1 !== i ? r = i + 1 : 0 === (i = r = e.lastIndexOf("/") + 1) && (i = r = e.length), t.connection = e
  47501. .substring(0, i), t.stream = e.substring(r, e.length), t
  47502. }, e.isStreamingType = function(t) {
  47503. return t in e.streamingFormats
  47504. }, e.RTMP_RE = /^rtmp[set]?:\/\//i, e.isStreamingSrc = function(t) {
  47505. return e.RTMP_RE.test(t)
  47506. }, e.rtmpSourceHandler = {}, e.rtmpSourceHandler.canPlayType = function(t) {
  47507. return e.isStreamingType(t) ? "maybe" : ""
  47508. }, e.rtmpSourceHandler.canHandleSource = function(t, i) {
  47509. var r = e.rtmpSourceHandler.canPlayType(t.type);
  47510. return r || (e.isStreamingSrc(t.src) ? "maybe" : "")
  47511. }, e.rtmpSourceHandler.handleSource = function(t, i, r) {
  47512. var n = e.streamToParts(t.src);
  47513. i.setRtmpConnection(n.connection), i.setRtmpStream(n.stream)
  47514. }, e.registerSourceHandler(e.rtmpSourceHandler)
  47515. }(c), a.getTech("Flash") ? (e.log.warn("Not using videojs-flash as it appears to already be registered"), e.log
  47516. .warn("videojs-flash should only be used with video.js@6 and above")) : e.registerTech("Flash", c), c.VERSION =
  47517. "2.1.2", c
  47518. }),
  47519. function(e) {
  47520. if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
  47521. else if ("function" == typeof define && define.amd) define([], e);
  47522. else {
  47523. ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self :
  47524. this).videojsContribHls = e()
  47525. }
  47526. }(function() {
  47527. return function e(t, i, r) {
  47528. function n(s, o) {
  47529. if (!i[s]) {
  47530. if (!t[s]) {
  47531. var u = "function" == typeof require && require;
  47532. if (!o && u) return u(s, !0);
  47533. if (a) return a(s, !0);
  47534. var l = new Error("Cannot find module '" + s + "'");
  47535. throw l.code = "MODULE_NOT_FOUND", l
  47536. }
  47537. var d = i[s] = {
  47538. exports: {}
  47539. };
  47540. t[s][0].call(d.exports, function(e) {
  47541. var i = t[s][1][e];
  47542. return n(i || e)
  47543. }, d, d.exports, e, t, i, r)
  47544. }
  47545. return i[s].exports
  47546. }
  47547. for (var a = "function" == typeof require && require, s = 0; s < r.length; s++) n(r[s]);
  47548. return n
  47549. }({
  47550. 1: [function(e, t, i) {
  47551. "use strict";
  47552. Object.defineProperty(i, "__esModule", {
  47553. value: !0
  47554. });
  47555. var r = function() {
  47556. return function(e, t) {
  47557. if (Array.isArray(e)) return e;
  47558. if (Symbol.iterator in Object(e)) return function(e, t) {
  47559. var i = [],
  47560. r = !0,
  47561. n = !1,
  47562. a = void 0;
  47563. try {
  47564. for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s.value), !
  47565. t || i.length !== t); r = !0);
  47566. } catch (e) {
  47567. n = !0, a = e
  47568. } finally {
  47569. try {
  47570. !r && o.return && o.return()
  47571. } finally {
  47572. if (n) throw a
  47573. }
  47574. }
  47575. return i
  47576. }(e, t);
  47577. throw new TypeError("Invalid attempt to destructure non-iterable instance")
  47578. }
  47579. }();
  47580. var n, a = e("global/window"),
  47581. s = (n = a) && n.__esModule ? n : {
  47582. default: n
  47583. },
  47584. o = function(e, t) {
  47585. for (var i = e.cues, r = 0; r < i.length; r++) {
  47586. var n = i[r];
  47587. if (t >= n.adStartTime && t <= n.adEndTime) return n
  47588. }
  47589. return null
  47590. };
  47591. i.default = {
  47592. updateAdCues: function(e, t) {
  47593. var i = arguments.length <= 2 || void 0 === arguments[2] ? 0 : arguments[2];
  47594. if (e.segments)
  47595. for (var n = i, a = void 0, u = 0; u < e.segments.length; u++) {
  47596. var l = e.segments[u];
  47597. if (a || (a = o(t, n + l.duration / 2)), a) {
  47598. if ("cueIn" in l) {
  47599. a.endTime = n, a.adEndTime = n, n += l.duration, a = null;
  47600. continue
  47601. }
  47602. if (n < a.endTime) {
  47603. n += l.duration;
  47604. continue
  47605. }
  47606. a.endTime += l.duration
  47607. } else if ("cueOut" in l && ((a = new s.default.VTTCue(n, n + l.duration, l.cueOut))
  47608. .adStartTime = n, a.adEndTime = n + parseFloat(l.cueOut), t.addCue(a)), "cueOutCont" in
  47609. l) {
  47610. var d, c, h = l.cueOutCont.split("/").map(parseFloat),
  47611. f = r(h, 2);
  47612. d = f[0], c = f[1], (a = new s.default.VTTCue(n, n + l.duration, "")).adStartTime = n - d,
  47613. a.adEndTime = a.adStartTime + c, t.addCue(a)
  47614. }
  47615. n += l.duration
  47616. }
  47617. },
  47618. findAdCue: o
  47619. }, t.exports = i.default
  47620. }, {
  47621. "global/window": 32
  47622. }],
  47623. 2: [function(e, t, i) {
  47624. "use strict";
  47625. Object.defineProperty(i, "__esModule", {
  47626. value: !0
  47627. });
  47628. var r = function(e, t) {
  47629. return e.start(t) + "-" + e.end(t)
  47630. },
  47631. n = function(e, t) {
  47632. var i = e.toString(16);
  47633. return "00".substring(0, 2 - i.length) + i + (t % 2 ? " " : "")
  47634. },
  47635. a = function(e) {
  47636. return e >= 32 && e < 126 ? String.fromCharCode(e) : "."
  47637. },
  47638. s = {
  47639. hexDump: function(e) {
  47640. for (var t = Array.prototype.slice.call(e), i = "", r = 0; r < t.length / 16; r++) i += t.slice(
  47641. 16 * r, 16 * r + 16).map(n).join("") + " " + t.slice(16 * r, 16 * r + 16).map(a).join("") +
  47642. "\n";
  47643. return i
  47644. },
  47645. tagDump: function(e) {
  47646. return s.hexDump(e.bytes)
  47647. },
  47648. textRanges: function(e) {
  47649. var t = "",
  47650. i = void 0;
  47651. for (i = 0; i < e.length; i++) t += r(e, i) + " ";
  47652. return t
  47653. },
  47654. createTransferableMessage: function(e) {
  47655. var t = {};
  47656. return Object.keys(e).forEach(function(i) {
  47657. var r = e[i];
  47658. ArrayBuffer.isView(r) ? t[i] = {
  47659. bytes: r.buffer,
  47660. byteOffset: r.byteOffset,
  47661. byteLength: r.byteLength
  47662. } : t[i] = r
  47663. }), t
  47664. },
  47665. initSegmentId: function(e) {
  47666. var t = e.byterange || {
  47667. length: 1 / 0,
  47668. offset: 0
  47669. };
  47670. return [t.length, t.offset, e.resolvedUri].join(",")
  47671. }
  47672. };
  47673. i.default = s, t.exports = i.default
  47674. }, {}],
  47675. 3: [function(e, t, i) {
  47676. "use strict";
  47677. Object.defineProperty(i, "__esModule", {
  47678. value: !0
  47679. }), i.default = {
  47680. GOAL_BUFFER_LENGTH: 30,
  47681. MAX_GOAL_BUFFER_LENGTH: 60,
  47682. GOAL_BUFFER_LENGTH_RATE: 1,
  47683. BANDWIDTH_VARIANCE: 1.2,
  47684. BUFFER_LOW_WATER_LINE: 0,
  47685. MAX_BUFFER_LOW_WATER_LINE: 30,
  47686. BUFFER_LOW_WATER_LINE_RATE: 1
  47687. }, t.exports = i.default
  47688. }, {}],
  47689. 4: [function(e, t, i) {
  47690. "use strict";
  47691. Object.defineProperty(i, "__esModule", {
  47692. value: !0
  47693. });
  47694. var r, n = e("global/window"),
  47695. a = (r = n) && r.__esModule ? r : {
  47696. default: r
  47697. },
  47698. s = e("aes-decrypter"),
  47699. o = e("./bin-utils");
  47700. i.default = function(e) {
  47701. return new function(e) {
  47702. e.onmessage = function(e) {
  47703. var t = e.data,
  47704. i = new Uint8Array(t.encrypted.bytes, t.encrypted.byteOffset, t.encrypted.byteLength),
  47705. r = new Uint32Array(t.key.bytes, t.key.byteOffset, t.key.byteLength / 4),
  47706. n = new Uint32Array(t.iv.bytes, t.iv.byteOffset, t.iv.byteLength / 4);
  47707. new s.Decrypter(i, r, n, function(e, i) {
  47708. a.default.postMessage((0, o.createTransferableMessage)({
  47709. source: t.source,
  47710. decrypted: i
  47711. }), [i.buffer])
  47712. })
  47713. }
  47714. }(e)
  47715. }, t.exports = i.default
  47716. }, {
  47717. "./bin-utils": 2,
  47718. "aes-decrypter": 25,
  47719. "global/window": 32
  47720. }],
  47721. 5: [function(e, t, i) {
  47722. (function(t) {
  47723. "use strict";
  47724. Object.defineProperty(i, "__esModule", {
  47725. value: !0
  47726. });
  47727. var r = function() {
  47728. function e(e, t) {
  47729. for (var i = 0; i < t.length; i++) {
  47730. var r = t[i];
  47731. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  47732. Object.defineProperty(e, r.key, r)
  47733. }
  47734. }
  47735. return function(t, i, r) {
  47736. return i && e(t.prototype, i), r && e(t, r), t
  47737. }
  47738. }(),
  47739. n = function(e, t, i) {
  47740. for (var r = !0; r;) {
  47741. var n = e,
  47742. a = t,
  47743. s = i;
  47744. r = !1, null === n && (n = Function.prototype);
  47745. var o = Object.getOwnPropertyDescriptor(n, a);
  47746. if (void 0 !== o) {
  47747. if ("value" in o) return o.value;
  47748. var u = o.get;
  47749. if (void 0 === u) return;
  47750. return u.call(s)
  47751. }
  47752. var l = Object.getPrototypeOf(n);
  47753. if (null === l) return;
  47754. e = l, t = a, i = s, r = !0, o = l = void 0
  47755. }
  47756. };
  47757. function a(e) {
  47758. return e && e.__esModule ? e : {
  47759. default: e
  47760. }
  47761. }
  47762. var s = a(e("./playlist-loader")),
  47763. o = e("./playlist.js"),
  47764. u = a(e("./segment-loader")),
  47765. l = a(e("./vtt-segment-loader")),
  47766. d = a(e("./ranges")),
  47767. c = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null),
  47768. h = a(e("./ad-cue-tags")),
  47769. f = a(e("./sync-controller")),
  47770. p = e("videojs-contrib-media-sources/es5/codec-utils"),
  47771. m = a(e("webwackify")),
  47772. g = a(e("./decrypter-worker")),
  47773. v = a(e("./config")),
  47774. y = e("./util/codecs.js"),
  47775. _ = e("./media-groups"),
  47776. b = void 0,
  47777. w = {
  47778. videoCodec: "avc1",
  47779. videoObjectTypeIndicator: ".4d400d",
  47780. audioProfile: "2"
  47781. },
  47782. E = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored",
  47783. "mediaTransferDuration", "mediaBytesTransferred"
  47784. ],
  47785. T = function(e) {
  47786. return this.audioSegmentLoader_[e] + this.mainSegmentLoader_[e]
  47787. },
  47788. S = function() {
  47789. var t = void 0;
  47790. try {
  47791. t = e.resolve("./decrypter-worker")
  47792. } catch (e) {}
  47793. return t
  47794. },
  47795. A = function(e) {
  47796. return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e) {
  47797. return (0, p.translateLegacyCodecs)([e])[0]
  47798. })
  47799. };
  47800. i.mapLegacyAvcCodecs_ = A;
  47801. var k = function(e, t, i) {
  47802. return e + "/" + t + '; codecs="' + i.filter(function(e) {
  47803. return !!e
  47804. }).join(", ") + '"'
  47805. },
  47806. R = function(e, t) {
  47807. var i = function(e) {
  47808. return e.segments && e.segments.length && e.segments[0].map ? "mp4" : "mp2t"
  47809. }(t),
  47810. r = function(e) {
  47811. var t = e.attributes || {};
  47812. return t.CODECS ? (0, y.parseCodecs)(t.CODECS) : w
  47813. }(t),
  47814. n = t.attributes || {},
  47815. a = !0,
  47816. s = !1;
  47817. if (!t) return [];
  47818. if (e.mediaGroups.AUDIO && n.AUDIO) {
  47819. var o = e.mediaGroups.AUDIO[n.AUDIO];
  47820. if (o)
  47821. for (var u in s = !0, a = !1, o)
  47822. if (!o[u].uri) {
  47823. a = !0;
  47824. break
  47825. }
  47826. }
  47827. s && !r.audioProfile && (c.default.log.warn(
  47828. "Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"
  47829. ), r.audioProfile = w.audioProfile);
  47830. var l = {};
  47831. r.videoCodec && (l.video = "" + r.videoCodec + r.videoObjectTypeIndicator), r.audioProfile && (l
  47832. .audio = "mp4a.40." + r.audioProfile);
  47833. var d = k("audio", i, [l.audio]),
  47834. h = k("video", i, [l.video]),
  47835. f = k("video", i, [l.video, l.audio]);
  47836. return s ? !a && l.video ? [h, d] : [f, d] : l.video ? [f] : [d]
  47837. };
  47838. i.mimeTypesForPlaylist_ = R;
  47839. var M = function(e) {
  47840. function t(e) {
  47841. var i = this;
  47842. ! function(e, t) {
  47843. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  47844. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this);
  47845. var r = e.url,
  47846. a = e.handleManifestRedirects,
  47847. o = e.withCredentials,
  47848. d = e.mode,
  47849. h = e.tech,
  47850. p = e.bandwidth,
  47851. v = e.externHls,
  47852. y = e.useCueTags,
  47853. w = e.blacklistDuration,
  47854. A = e.enableLowInitialPlaylist;
  47855. if (!r) throw new Error("A non-empty playlist URL is required");
  47856. b = v, this.tech_ = h, this.hls_ = h.hls, this.mode_ = d, this.useCueTags_ = y, this
  47857. .blacklistDuration = w, this.enableLowInitialPlaylist = A, this.useCueTags_ && (this
  47858. .cueTagsTrack_ = this.tech_.addTextTrack("metadata", "ad-cues"), this.cueTagsTrack_
  47859. .inBandMetadataTrackDispatchType = ""), this.requestOptions_ = {
  47860. withCredentials: o,
  47861. handleManifestRedirects: a,
  47862. timeout: null
  47863. }, this.mediaTypes_ = (0, _.createMediaTypes)(), this.mediaSource = new c.default
  47864. .MediaSource({
  47865. mode: d
  47866. }), this.mediaSource.addEventListener("sourceopen", this.handleSourceOpen_.bind(this)), this
  47867. .seekable_ = c.default.createTimeRanges(), this.hasPlayed_ = function() {
  47868. return !1
  47869. }, this.syncController_ = new f.default(e), this.segmentMetadataTrack_ = h
  47870. .addRemoteTextTrack({
  47871. kind: "metadata",
  47872. label: "segment-metadata"
  47873. }, !1).track, this.decrypter_ = (0, m.default)(g.default, S());
  47874. var k = {
  47875. hls: this.hls_,
  47876. mediaSource: this.mediaSource,
  47877. currentTime: this.tech_.currentTime.bind(this.tech_),
  47878. seekable: function() {
  47879. return i.seekable()
  47880. },
  47881. seeking: function() {
  47882. return i.tech_.seeking()
  47883. },
  47884. duration: function() {
  47885. return i.mediaSource.duration
  47886. },
  47887. hasPlayed: function() {
  47888. return i.hasPlayed_()
  47889. },
  47890. goalBufferLength: function() {
  47891. return i.goalBufferLength()
  47892. },
  47893. bandwidth: p,
  47894. syncController: this.syncController_,
  47895. decrypter: this.decrypter_
  47896. };
  47897. this.masterPlaylistLoader_ = new s.default(r, this.hls_, this.requestOptions_), this
  47898. .setupMasterPlaylistLoaderListeners_(), this.mainSegmentLoader_ = new u.default(c.default
  47899. .mergeOptions(k, {
  47900. segmentMetadataTrack: this.segmentMetadataTrack_,
  47901. loaderType: "main"
  47902. }), e), this.audioSegmentLoader_ = new u.default(c.default.mergeOptions(k, {
  47903. loaderType: "audio"
  47904. }), e), this.subtitleSegmentLoader_ = new l.default(c.default.mergeOptions(k, {
  47905. loaderType: "vtt"
  47906. }), e), this.setupSegmentLoaderListeners_(), E.forEach(function(e) {
  47907. i[e + "_"] = T.bind(i, e)
  47908. }), this.masterPlaylistLoader_.load()
  47909. }
  47910. return function(e, t) {
  47911. if ("function" != typeof t && null !== t) throw new TypeError(
  47912. "Super expression must either be null or a function, not " + typeof t);
  47913. e.prototype = Object.create(t && t.prototype, {
  47914. constructor: {
  47915. value: e,
  47916. enumerable: !1,
  47917. writable: !0,
  47918. configurable: !0
  47919. }
  47920. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  47921. }(t, c["default"].EventTarget), r(t, [{
  47922. key: "setupMasterPlaylistLoaderListeners_",
  47923. value: function() {
  47924. var e = this;
  47925. this.masterPlaylistLoader_.on("loadedmetadata", function() {
  47926. var t = e.masterPlaylistLoader_.media(),
  47927. i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3;
  47928. (0, o.isLowestEnabledRendition)(e.masterPlaylistLoader_.master, e
  47929. .masterPlaylistLoader_.media()) ? e.requestOptions_.timeout = 0: e
  47930. .requestOptions_.timeout = i, t.endList && "none" !== e.tech_.preload() && (
  47931. e.mainSegmentLoader_.playlist(t, e.requestOptions_), e.mainSegmentLoader_
  47932. .load()), (0, _.setupMediaGroups)({
  47933. segmentLoaders: {
  47934. AUDIO: e.audioSegmentLoader_,
  47935. SUBTITLES: e.subtitleSegmentLoader_,
  47936. main: e.mainSegmentLoader_
  47937. },
  47938. tech: e.tech_,
  47939. requestOptions: e.requestOptions_,
  47940. masterPlaylistLoader: e.masterPlaylistLoader_,
  47941. mode: e.mode_,
  47942. hls: e.hls_,
  47943. master: e.master(),
  47944. mediaTypes: e.mediaTypes_,
  47945. blacklistCurrentPlaylist: e.blacklistCurrentPlaylist.bind(e)
  47946. }), e.triggerPresenceUsage_(e.master(), t);
  47947. try {
  47948. e.setupSourceBuffers_()
  47949. } catch (t) {
  47950. return c.default.log.warn("Failed to create SourceBuffers", t), e
  47951. .mediaSource.endOfStream("decode")
  47952. }
  47953. e.setupFirstPlay(), e.trigger("selectedinitialmedia")
  47954. }), this.masterPlaylistLoader_.on("loadedplaylist", function() {
  47955. var t, i = e.masterPlaylistLoader_.media();
  47956. if (!i) {
  47957. var r = void 0;
  47958. return e.enableLowInitialPlaylist && (r = e.selectInitialPlaylist()), r || (
  47959. r = e.selectPlaylist()), e.initialMedia_ = r, void e
  47960. .masterPlaylistLoader_.media(e.initialMedia_)
  47961. }
  47962. e.useCueTags_ && e.updateAdCues_(i), e.mainSegmentLoader_.playlist(i, e
  47963. .requestOptions_), e.updateDuration(), e.tech_.paused() || e
  47964. .mainSegmentLoader_.load(), i.endList || (t = function() {
  47965. var t = e.seekable();
  47966. 0 !== t.length && e.mediaSource.addSeekableRange_(t.start(0), t.end(0))
  47967. }, e.duration() !== 1 / 0 ? e.tech_.one("durationchange", function i() {
  47968. e.duration() === 1 / 0 ? t() : e.tech_.one("durationchange", i)
  47969. }) : t())
  47970. }), this.masterPlaylistLoader_.on("error", function() {
  47971. e.blacklistCurrentPlaylist(e.masterPlaylistLoader_.error)
  47972. }), this.masterPlaylistLoader_.on("mediachanging", function() {
  47973. e.mainSegmentLoader_.abort(), e.mainSegmentLoader_.pause()
  47974. }), this.masterPlaylistLoader_.on("mediachange", function() {
  47975. var t = e.masterPlaylistLoader_.media(),
  47976. i = 1.5 * e.masterPlaylistLoader_.targetDuration * 1e3;
  47977. (0, o.isLowestEnabledRendition)(e.masterPlaylistLoader_.master, e
  47978. .masterPlaylistLoader_.media()) ? e.requestOptions_.timeout = 0: e
  47979. .requestOptions_.timeout = i, e.mainSegmentLoader_.playlist(t, e
  47980. .requestOptions_), e.mainSegmentLoader_.load(), e.tech_.trigger({
  47981. type: "mediachange",
  47982. bubbles: !0
  47983. })
  47984. }), this.masterPlaylistLoader_.on("playlistunchanged", function() {
  47985. var t = e.masterPlaylistLoader_.media();
  47986. e.stuckAtPlaylistEnd_(t) && (e.blacklistCurrentPlaylist({
  47987. message: "Playlist no longer updating."
  47988. }), e.tech_.trigger("playliststuck"))
  47989. }), this.masterPlaylistLoader_.on("renditiondisabled", function() {
  47990. e.tech_.trigger({
  47991. type: "usage",
  47992. name: "hls-rendition-disabled"
  47993. })
  47994. }), this.masterPlaylistLoader_.on("renditionenabled", function() {
  47995. e.tech_.trigger({
  47996. type: "usage",
  47997. name: "hls-rendition-enabled"
  47998. })
  47999. })
  48000. }
  48001. }, {
  48002. key: "triggerPresenceUsage_",
  48003. value: function(e, t) {
  48004. var i = e.mediaGroups || {},
  48005. r = !0,
  48006. n = Object.keys(i.AUDIO);
  48007. for (var a in i.AUDIO)
  48008. for (var s in i.AUDIO[a]) {
  48009. i.AUDIO[a][s].uri || (r = !1)
  48010. }
  48011. r && this.tech_.trigger({
  48012. type: "usage",
  48013. name: "hls-demuxed"
  48014. }), Object.keys(i.SUBTITLES).length && this.tech_.trigger({
  48015. type: "usage",
  48016. name: "hls-webvtt"
  48017. }), b.Playlist.isAes(t) && this.tech_.trigger({
  48018. type: "usage",
  48019. name: "hls-aes"
  48020. }), b.Playlist.isFmp4(t) && this.tech_.trigger({
  48021. type: "usage",
  48022. name: "hls-fmp4"
  48023. }), n.length && Object.keys(i.AUDIO[n[0]]).length > 1 && this.tech_.trigger({
  48024. type: "usage",
  48025. name: "hls-alternate-audio"
  48026. }), this.useCueTags_ && this.tech_.trigger({
  48027. type: "usage",
  48028. name: "hls-playlist-cue-tags"
  48029. })
  48030. }
  48031. }, {
  48032. key: "setupSegmentLoaderListeners_",
  48033. value: function() {
  48034. var e = this;
  48035. this.mainSegmentLoader_.on("bandwidthupdate", function() {
  48036. var t = e.selectPlaylist(),
  48037. i = e.masterPlaylistLoader_.media(),
  48038. r = e.tech_.buffered(),
  48039. n = r.length ? r.end(r.length - 1) - e.tech_.currentTime() : 0,
  48040. a = e.bufferLowWaterLine();
  48041. (!i.endList || e.duration() < v.default.MAX_BUFFER_LOW_WATER_LINE || t
  48042. .attributes.BANDWIDTH < i.attributes.BANDWIDTH || n >= a) && e
  48043. .masterPlaylistLoader_.media(t), e.tech_.trigger("bandwidthupdate")
  48044. }), this.mainSegmentLoader_.on("progress", function() {
  48045. e.trigger("progress")
  48046. }), this.mainSegmentLoader_.on("error", function() {
  48047. e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())
  48048. }), this.mainSegmentLoader_.on("syncinfoupdate", function() {
  48049. e.onSyncInfoUpdate_()
  48050. }), this.mainSegmentLoader_.on("timestampoffset", function() {
  48051. e.tech_.trigger({
  48052. type: "usage",
  48053. name: "hls-timestamp-offset"
  48054. })
  48055. }), this.audioSegmentLoader_.on("syncinfoupdate", function() {
  48056. e.onSyncInfoUpdate_()
  48057. }), this.mainSegmentLoader_.on("ended", function() {
  48058. e.onEndOfStream()
  48059. }), this.mainSegmentLoader_.on("earlyabort", function() {
  48060. e.blacklistCurrentPlaylist({
  48061. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  48062. }, 120)
  48063. }), this.mainSegmentLoader_.on("reseteverything", function() {
  48064. e.tech_.trigger("hls-reset")
  48065. }), this.mainSegmentLoader_.on("segmenttimemapping", function(t) {
  48066. e.tech_.trigger({
  48067. type: "hls-segment-time-mapping",
  48068. mapping: t.mapping
  48069. })
  48070. }), this.audioSegmentLoader_.on("ended", function() {
  48071. e.onEndOfStream()
  48072. })
  48073. }
  48074. }, {
  48075. key: "mediaSecondsLoaded_",
  48076. value: function() {
  48077. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this
  48078. .mainSegmentLoader_.mediaSecondsLoaded)
  48079. }
  48080. }, {
  48081. key: "load",
  48082. value: function() {
  48083. this.mainSegmentLoader_.load(), this.mediaTypes_.AUDIO.activePlaylistLoader && this
  48084. .audioSegmentLoader_.load(), this.mediaTypes_.SUBTITLES.activePlaylistLoader &&
  48085. this.subtitleSegmentLoader_.load()
  48086. }
  48087. }, {
  48088. key: "fastQualityChange_",
  48089. value: function() {
  48090. var e = this.selectPlaylist();
  48091. e !== this.masterPlaylistLoader_.media() && (this.masterPlaylistLoader_.media(e),
  48092. this.mainSegmentLoader_.resetLoader())
  48093. }
  48094. }, {
  48095. key: "play",
  48096. value: function() {
  48097. if (!this.setupFirstPlay()) {
  48098. this.tech_.ended() && this.tech_.setCurrentTime(0), this.hasPlayed_() && this
  48099. .load();
  48100. var e = this.tech_.seekable();
  48101. return this.tech_.duration() === 1 / 0 && this.tech_.currentTime() < e.start(0) ?
  48102. this.tech_.setCurrentTime(e.end(e.length - 1)) : void 0
  48103. }
  48104. }
  48105. }, {
  48106. key: "setupFirstPlay",
  48107. value: function() {
  48108. var e, t = this,
  48109. i = this.masterPlaylistLoader_.media();
  48110. if (!i || this.tech_.paused() || this.hasPlayed_()) return !1;
  48111. if (!i.endList) {
  48112. var r = (e = t.seekable()).length ? c.default.browser.IE_VERSION && "html5" === t
  48113. .mode_ && 0 === t.tech_.readyState() ? (t.tech_.one("loadedmetadata",
  48114. function() {
  48115. t.trigger("firstplay"), t.tech_.setCurrentTime(e.end(0)), t.hasPlayed_ =
  48116. function() {
  48117. return !0
  48118. }
  48119. }), {
  48120. v: !1
  48121. }) : (t.trigger("firstplay"), void t.tech_.setCurrentTime(e.end(0))) : {
  48122. v: !1
  48123. };
  48124. if ("object" == typeof r) return r.v
  48125. }
  48126. return this.hasPlayed_ = function() {
  48127. return !0
  48128. }, this.load(), !0
  48129. }
  48130. }, {
  48131. key: "handleSourceOpen_",
  48132. value: function() {
  48133. try {
  48134. this.setupSourceBuffers_()
  48135. } catch (e) {
  48136. return c.default.log.warn("Failed to create Source Buffers", e), this.mediaSource
  48137. .endOfStream("decode")
  48138. }
  48139. if (this.tech_.autoplay()) {
  48140. var e = this.tech_.play();
  48141. void 0 !== e && "function" == typeof e.then && e.then(null, function(e) {})
  48142. }
  48143. this.trigger("sourceopen")
  48144. }
  48145. }, {
  48146. key: "onEndOfStream",
  48147. value: function() {
  48148. var e = this.mainSegmentLoader_.ended_;
  48149. this.mediaTypes_.AUDIO.activePlaylistLoader && (e = e && this.audioSegmentLoader_
  48150. .ended_), e && this.mediaSource.endOfStream()
  48151. }
  48152. }, {
  48153. key: "stuckAtPlaylistEnd_",
  48154. value: function(e) {
  48155. if (!this.seekable().length) return !1;
  48156. var t = this.syncController_.getExpiredTime(e, this.mediaSource.duration);
  48157. if (null === t) return !1;
  48158. var i = b.Playlist.playlistEnd(e, t),
  48159. r = this.tech_.currentTime(),
  48160. n = this.tech_.buffered();
  48161. if (!n.length) return i - r <= d.default.SAFE_TIME_DELTA;
  48162. var a = n.end(n.length - 1);
  48163. return a - r <= d.default.SAFE_TIME_DELTA && i - a <= d.default.SAFE_TIME_DELTA
  48164. }
  48165. }, {
  48166. key: "blacklistCurrentPlaylist",
  48167. value: function(e, t) {
  48168. void 0 === e && (e = {});
  48169. var i, r = void 0;
  48170. if (r = e.playlist || this.masterPlaylistLoader_.media(), t = t || e
  48171. .blacklistDuration || this.blacklistDuration, !r) {
  48172. this.error = e;
  48173. try {
  48174. return this.mediaSource.endOfStream("network")
  48175. } catch (e) {
  48176. return this.trigger("error")
  48177. }
  48178. }
  48179. var n = 1 === this.masterPlaylistLoader_.master.playlists.filter(o.isEnabled)
  48180. .length;
  48181. return n ? (c.default.log.warn(
  48182. "Problem encountered with the current HLS playlist. Trying again since it is the final playlist."
  48183. ), this.tech_.trigger("retryplaylist"), this.masterPlaylistLoader_.load(n)) : (r
  48184. .excludeUntil = Date.now() + 1e3 * t, this.tech_.trigger("blacklistplaylist"),
  48185. this.tech_.trigger({
  48186. type: "usage",
  48187. name: "hls-rendition-blacklisted"
  48188. }), i = this.selectPlaylist(), c.default.log.warn(
  48189. "Problem encountered with the current HLS playlist." + (e.message ? " " + e
  48190. .message : "") + " Switching to another playlist."), this
  48191. .masterPlaylistLoader_.media(i))
  48192. }
  48193. }, {
  48194. key: "pauseLoading",
  48195. value: function() {
  48196. this.mainSegmentLoader_.pause(), this.mediaTypes_.AUDIO.activePlaylistLoader && this
  48197. .audioSegmentLoader_.pause(), this.mediaTypes_.SUBTITLES.activePlaylistLoader &&
  48198. this.subtitleSegmentLoader_.pause()
  48199. }
  48200. }, {
  48201. key: "setCurrentTime",
  48202. value: function(e) {
  48203. var t = d.default.findRange(this.tech_.buffered(), e);
  48204. return this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media() && this
  48205. .masterPlaylistLoader_.media().segments ? t && t.length && "flash" !== this
  48206. .mode_ ? e : (this.mainSegmentLoader_.resetEverything(), this.mainSegmentLoader_
  48207. .abort(), this.mediaTypes_.AUDIO.activePlaylistLoader && (this
  48208. .audioSegmentLoader_.resetEverything(), this.audioSegmentLoader_.abort()),
  48209. this.mediaTypes_.SUBTITLES.activePlaylistLoader && (this.subtitleSegmentLoader_
  48210. .resetEverything(), this.subtitleSegmentLoader_.abort()), void this.load()) :
  48211. 0
  48212. }
  48213. }, {
  48214. key: "duration",
  48215. value: function() {
  48216. return this.masterPlaylistLoader_ ? this.mediaSource ? this.mediaSource.duration : b
  48217. .Playlist.duration(this.masterPlaylistLoader_.media()) : 0
  48218. }
  48219. }, {
  48220. key: "seekable",
  48221. value: function() {
  48222. return this.seekable_
  48223. }
  48224. }, {
  48225. key: "onSyncInfoUpdate_",
  48226. value: function() {
  48227. var e = void 0,
  48228. t = void 0;
  48229. if (this.masterPlaylistLoader_) {
  48230. var i = this.masterPlaylistLoader_.media();
  48231. if (i) {
  48232. var r = this.syncController_.getExpiredTime(i, this.mediaSource.duration);
  48233. if (null !== r && 0 !== (e = b.Playlist.seekable(i, r)).length) {
  48234. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  48235. if (i = this.mediaTypes_.AUDIO.activePlaylistLoader.media(), null === (r =
  48236. this.syncController_.getExpiredTime(i, this.mediaSource.duration)))
  48237. return;
  48238. if (0 === (t = b.Playlist.seekable(i, r)).length) return
  48239. }
  48240. t ? t.start(0) > e.end(0) || e.start(0) > t.end(0) ? this.seekable_ = e : this
  48241. .seekable_ = c.default.createTimeRanges([
  48242. [t.start(0) > e.start(0) ? t.start(0) : e.start(0), t.end(0) < e.end(
  48243. 0) ? t.end(0) : e.end(0)
  48244. ]
  48245. ]) : this.seekable_ = e, this.tech_.trigger("seekablechanged")
  48246. }
  48247. }
  48248. }
  48249. }
  48250. }, {
  48251. key: "updateDuration",
  48252. value: function() {
  48253. var e = this,
  48254. t = this.mediaSource.duration,
  48255. i = b.Playlist.duration(this.masterPlaylistLoader_.media()),
  48256. r = this.tech_.buffered(),
  48257. n = function t() {
  48258. e.mediaSource.duration = i, e.tech_.trigger("durationchange"), e.mediaSource
  48259. .removeEventListener("sourceopen", t)
  48260. };
  48261. r.length > 0 && (i = Math.max(i, r.end(r.length - 1))), t !== i && ("open" !== this
  48262. .mediaSource.readyState ? this.mediaSource.addEventListener("sourceopen", n) :
  48263. n())
  48264. }
  48265. }, {
  48266. key: "dispose",
  48267. value: function() {
  48268. var e = this;
  48269. this.decrypter_.terminate(), this.masterPlaylistLoader_.dispose(), this
  48270. .mainSegmentLoader_.dispose(), ["AUDIO", "SUBTITLES"].forEach(function(t) {
  48271. var i = e.mediaTypes_[t].groups;
  48272. for (var r in i) i[r].forEach(function(e) {
  48273. e.playlistLoader && e.playlistLoader.dispose()
  48274. })
  48275. }), this.audioSegmentLoader_.dispose(), this.subtitleSegmentLoader_.dispose()
  48276. }
  48277. }, {
  48278. key: "master",
  48279. value: function() {
  48280. return this.masterPlaylistLoader_.master
  48281. }
  48282. }, {
  48283. key: "media",
  48284. value: function() {
  48285. return this.masterPlaylistLoader_.media() || this.initialMedia_
  48286. }
  48287. }, {
  48288. key: "setupSourceBuffers_",
  48289. value: function() {
  48290. var e, t = this.masterPlaylistLoader_.media();
  48291. if (t && "open" === this.mediaSource.readyState) {
  48292. if ((e = R(this.masterPlaylistLoader_.master, t)).length < 1) return this.error =
  48293. "No compatible SourceBuffer configuration for the variant stream:" + t
  48294. .resolvedUri, this.mediaSource.endOfStream("decode");
  48295. this.mainSegmentLoader_.mimeType(e[0]), e[1] && this.audioSegmentLoader_.mimeType(
  48296. e[1]), this.excludeIncompatibleVariants_(t)
  48297. }
  48298. }
  48299. }, {
  48300. key: "excludeIncompatibleVariants_",
  48301. value: function(e) {
  48302. var t = this.masterPlaylistLoader_.master,
  48303. i = 2,
  48304. r = null,
  48305. n = void 0;
  48306. e.attributes.CODECS && (n = (0, y.parseCodecs)(e.attributes.CODECS), r = n
  48307. .videoCodec, i = n.codecCount), t.playlists.forEach(function(e) {
  48308. var t = {
  48309. codecCount: 2,
  48310. videoCodec: null
  48311. };
  48312. if (e.attributes.CODECS) {
  48313. var n = e.attributes.CODECS;
  48314. t = (0, y.parseCodecs)(n), window.MediaSource && window.MediaSource
  48315. .isTypeSupported && !window.MediaSource.isTypeSupported(
  48316. 'video/mp4; codecs="' + A(n) + '"') && (e.excludeUntil = 1 / 0)
  48317. }
  48318. t.codecCount !== i && (e.excludeUntil = 1 / 0), t.videoCodec !== r && (e
  48319. .excludeUntil = 1 / 0)
  48320. })
  48321. }
  48322. }, {
  48323. key: "updateAdCues_",
  48324. value: function(e) {
  48325. var t = 0,
  48326. i = this.seekable();
  48327. i.length && (t = i.start(0)), h.default.updateAdCues(e, this.cueTagsTrack_, t)
  48328. }
  48329. }, {
  48330. key: "goalBufferLength",
  48331. value: function() {
  48332. var e = this.tech_.currentTime(),
  48333. t = v.default.GOAL_BUFFER_LENGTH,
  48334. i = v.default.GOAL_BUFFER_LENGTH_RATE,
  48335. r = Math.max(t, v.default.MAX_GOAL_BUFFER_LENGTH);
  48336. return Math.min(t + e * i, r)
  48337. }
  48338. }, {
  48339. key: "bufferLowWaterLine",
  48340. value: function() {
  48341. var e = this.tech_.currentTime(),
  48342. t = v.default.BUFFER_LOW_WATER_LINE,
  48343. i = v.default.BUFFER_LOW_WATER_LINE_RATE,
  48344. r = Math.max(t, v.default.MAX_BUFFER_LOW_WATER_LINE);
  48345. return Math.min(t + e * i, r)
  48346. }
  48347. }]), t
  48348. }();
  48349. i.MasterPlaylistController = M
  48350. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  48351. typeof window ? window : {})
  48352. }, {
  48353. "./ad-cue-tags": 1,
  48354. "./config": 3,
  48355. "./decrypter-worker": 4,
  48356. "./media-groups": 6,
  48357. "./playlist-loader": 9,
  48358. "./playlist.js": 11,
  48359. "./ranges": 12,
  48360. "./segment-loader": 16,
  48361. "./sync-controller": 18,
  48362. "./util/codecs.js": 19,
  48363. "./vtt-segment-loader": 20,
  48364. "videojs-contrib-media-sources/es5/codec-utils": 65,
  48365. webwackify: 76
  48366. }],
  48367. 6: [function(e, t, i) {
  48368. (function(t) {
  48369. "use strict";
  48370. function r(e) {
  48371. return e && e.__esModule ? e : {
  48372. default: e
  48373. }
  48374. }
  48375. Object.defineProperty(i, "__esModule", {
  48376. value: !0
  48377. });
  48378. var n = r("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null),
  48379. a = r(e("./playlist-loader")),
  48380. s = function() {},
  48381. o = function(e) {
  48382. var t = e.default ? "main" : "alternative";
  48383. return e.characteristics && e.characteristics.indexOf("public.accessibility.describes-video") >=
  48384. 0 && (t = "main-desc"), t
  48385. },
  48386. u = function(e, t) {
  48387. e.abort(), e.pause(), t && t.activePlaylistLoader && (t.activePlaylistLoader.pause(), t
  48388. .activePlaylistLoader = null)
  48389. };
  48390. i.stopLoaders = u;
  48391. var l = function(e, t) {
  48392. t.activePlaylistLoader = e, e.load()
  48393. };
  48394. i.startLoaders = l;
  48395. var d = function(e, t) {
  48396. return function() {
  48397. var i = t.segmentLoaders,
  48398. r = i[e],
  48399. n = i.main,
  48400. a = t.mediaTypes[e],
  48401. s = a.activeTrack(),
  48402. o = a.activeGroup(s),
  48403. d = a.activePlaylistLoader;
  48404. u(r, a), o && (o.playlistLoader ? (r.resyncLoader(), l(o.playlistLoader, a)) : d && n
  48405. .resetEverything())
  48406. }
  48407. };
  48408. i.onGroupChanged = d;
  48409. var c = function(e, t) {
  48410. return function() {
  48411. var i = t.segmentLoaders,
  48412. r = i[e],
  48413. n = i.main,
  48414. a = t.mediaTypes[e],
  48415. s = a.activeTrack(),
  48416. o = a.activeGroup(s),
  48417. d = a.activePlaylistLoader;
  48418. u(r, a), o && (o.playlistLoader ? d !== o.playlistLoader ? (r.track && r.track(s), r
  48419. .resetEverything(), l(o.playlistLoader, a)) : l(o.playlistLoader, a) : n
  48420. .resetEverything())
  48421. }
  48422. };
  48423. i.onTrackChanged = c;
  48424. var h = {
  48425. AUDIO: function(e, t) {
  48426. return function() {
  48427. var i = t.segmentLoaders[e],
  48428. r = t.mediaTypes[e],
  48429. a = t.blacklistCurrentPlaylist;
  48430. u(i, r);
  48431. var s = r.activeTrack(),
  48432. o = r.activeGroup(),
  48433. l = (o.filter(function(e) {
  48434. return e.default
  48435. })[0] || o[0]).id,
  48436. d = r.tracks[l];
  48437. if (s !== d) {
  48438. for (var c in n.default.log.warn(
  48439. "Problem encountered loading the alternate audio track.Switching back to default."
  48440. ), r.tracks) r.tracks[c].enabled = r.tracks[c] === d;
  48441. r.onTrackChanged()
  48442. } else a({
  48443. message: "Problem encountered loading the default audio track."
  48444. })
  48445. }
  48446. },
  48447. SUBTITLES: function(e, t) {
  48448. return function() {
  48449. var i = t.segmentLoaders[e],
  48450. r = t.mediaTypes[e];
  48451. n.default.log.warn(
  48452. "Problem encountered loading the subtitle track.Disabling subtitle track."), u(i, r);
  48453. var a = r.activeTrack();
  48454. a && (a.mode = "disabled"), r.onTrackChanged()
  48455. }
  48456. }
  48457. };
  48458. i.onError = h;
  48459. var f = {
  48460. AUDIO: function(e, t, i) {
  48461. if (t) {
  48462. var r = i.tech,
  48463. n = i.requestOptions,
  48464. a = i.segmentLoaders[e];
  48465. t.on("loadedmetadata", function() {
  48466. var e = t.media();
  48467. a.playlist(e, n), (!r.paused() || e.endList && "none" !== r.preload()) && a.load()
  48468. }), t.on("loadedplaylist", function() {
  48469. a.playlist(t.media(), n), r.paused() || a.load()
  48470. }), t.on("error", h[e](e, i))
  48471. }
  48472. },
  48473. SUBTITLES: function(e, t, i) {
  48474. var r = i.tech,
  48475. n = i.requestOptions,
  48476. a = i.segmentLoaders[e],
  48477. s = i.mediaTypes[e];
  48478. t.on("loadedmetadata", function() {
  48479. var e = t.media();
  48480. a.playlist(e, n), a.track(s.activeTrack()), (!r.paused() || e.endList && "none" !== r
  48481. .preload()) && a.load()
  48482. }), t.on("loadedplaylist", function() {
  48483. a.playlist(t.media(), n), r.paused() || a.load()
  48484. }), t.on("error", h[e](e, i))
  48485. }
  48486. };
  48487. i.setupListeners = f;
  48488. var p = {
  48489. AUDIO: function(e, t) {
  48490. var i = t.mode,
  48491. r = t.hls,
  48492. s = t.segmentLoaders[e],
  48493. u = t.requestOptions,
  48494. l = t.master.mediaGroups,
  48495. d = t.mediaTypes[e],
  48496. c = d.groups,
  48497. p = d.tracks;
  48498. for (var m in l[e] && 0 !== Object.keys(l[e]).length && "html5" === i || (l[e] = {
  48499. main: {
  48500. default: {
  48501. default: !0
  48502. }
  48503. }
  48504. }), l[e])
  48505. for (var g in c[m] || (c[m] = []), l[e][m]) {
  48506. var v = l[e][m][g],
  48507. y = void 0;
  48508. if (y = v.resolvedUri ? new a.default(v.resolvedUri, r, u) : null, v = n.default
  48509. .mergeOptions({
  48510. id: g,
  48511. playlistLoader: y
  48512. }, v), f[e](e, v.playlistLoader, t), c[m].push(v), void 0 === p[g]) {
  48513. var _ = new n.default.AudioTrack({
  48514. id: g,
  48515. kind: o(v),
  48516. enabled: !1,
  48517. language: v.language,
  48518. default: v.default,
  48519. label: g
  48520. });
  48521. p[g] = _
  48522. }
  48523. }
  48524. s.on("error", h[e](e, t))
  48525. },
  48526. SUBTITLES: function(e, t) {
  48527. var i = t.tech,
  48528. r = t.hls,
  48529. s = t.segmentLoaders[e],
  48530. o = t.requestOptions,
  48531. u = t.master.mediaGroups,
  48532. l = t.mediaTypes[e],
  48533. d = l.groups,
  48534. c = l.tracks;
  48535. for (var p in u[e])
  48536. for (var m in d[p] || (d[p] = []), u[e][p])
  48537. if (!u[e][p][m].forced) {
  48538. var g = u[e][p][m];
  48539. if (g = n.default.mergeOptions({
  48540. id: m,
  48541. playlistLoader: new a.default(g.resolvedUri, r, o)
  48542. }, g), f[e](e, g.playlistLoader, t), d[p].push(g), void 0 === c[m]) {
  48543. var v = i.addRemoteTextTrack({
  48544. id: m,
  48545. kind: "subtitles",
  48546. enabled: !1,
  48547. language: g.language,
  48548. label: m
  48549. }, !1).track;
  48550. c[m] = v
  48551. }
  48552. } s.on("error", h[e](e, t))
  48553. },
  48554. "CLOSED-CAPTIONS": function(e, t) {
  48555. var i = t.tech,
  48556. r = t.master.mediaGroups,
  48557. a = t.mediaTypes[e],
  48558. s = a.groups,
  48559. o = a.tracks;
  48560. for (var u in r[e])
  48561. for (var l in s[u] || (s[u] = []), r[e][u]) {
  48562. var d = r[e][u][l];
  48563. if (d.instreamId.match(/CC\d/) && (s[u].push(n.default.mergeOptions({
  48564. id: l
  48565. }, d)), void 0 === o[l])) {
  48566. var c = i.addRemoteTextTrack({
  48567. id: d.instreamId,
  48568. kind: "captions",
  48569. enabled: !1,
  48570. language: d.language,
  48571. label: l
  48572. }, !1).track;
  48573. o[l] = c
  48574. }
  48575. }
  48576. }
  48577. };
  48578. i.initialize = p;
  48579. var m = function(e, t) {
  48580. return function(i) {
  48581. var r = t.masterPlaylistLoader,
  48582. n = t.mediaTypes[e].groups,
  48583. a = r.media();
  48584. if (!a) return null;
  48585. var s = null;
  48586. return a.attributes[e] && (s = n[a.attributes[e]]), s = s || n.main, void 0 === i ? s :
  48587. null === i ? null : s.filter(function(e) {
  48588. return e.id === i.id
  48589. })[0] || null
  48590. }
  48591. };
  48592. i.activeGroup = m;
  48593. var g = {
  48594. AUDIO: function(e, t) {
  48595. return function() {
  48596. var i = t.mediaTypes[e].tracks;
  48597. for (var r in i)
  48598. if (i[r].enabled) return i[r];
  48599. return null
  48600. }
  48601. },
  48602. SUBTITLES: function(e, t) {
  48603. return function() {
  48604. var i = t.mediaTypes[e].tracks;
  48605. for (var r in i)
  48606. if ("showing" === i[r].mode) return i[r];
  48607. return null
  48608. }
  48609. }
  48610. };
  48611. i.activeTrack = g;
  48612. i.setupMediaGroups = function(e) {
  48613. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) {
  48614. p[t](t, e)
  48615. });
  48616. var t = e.mediaTypes,
  48617. i = e.masterPlaylistLoader,
  48618. r = e.tech,
  48619. n = e.hls;
  48620. ["AUDIO", "SUBTITLES"].forEach(function(i) {
  48621. t[i].activeGroup = m(i, e), t[i].activeTrack = g[i](i, e), t[i].onGroupChanged = d(i, e),
  48622. t[i].onTrackChanged = c(i, e)
  48623. });
  48624. var a = t.AUDIO.activeGroup(),
  48625. s = (a.filter(function(e) {
  48626. return e.default
  48627. })[0] || a[0]).id;
  48628. t.AUDIO.tracks[s].enabled = !0, t.AUDIO.onTrackChanged(), i.on("mediachange", function() {
  48629. ["AUDIO", "SUBTITLES"].forEach(function(e) {
  48630. return t[e].onGroupChanged()
  48631. })
  48632. });
  48633. var o = function() {
  48634. t.AUDIO.onTrackChanged(), r.trigger({
  48635. type: "usage",
  48636. name: "hls-audio-change"
  48637. })
  48638. };
  48639. for (var u in r.audioTracks().addEventListener("change", o), r.remoteTextTracks()
  48640. .addEventListener("change", t.SUBTITLES.onTrackChanged), n.on("dispose", function() {
  48641. r.audioTracks().removeEventListener("change", o), r.remoteTextTracks()
  48642. .removeEventListener("change", t.SUBTITLES.onTrackChanged)
  48643. }), r.clearTracks("audio"), t.AUDIO.tracks) r.audioTracks().addTrack(t.AUDIO.tracks[u])
  48644. };
  48645. i.createMediaTypes = function() {
  48646. var e = {};
  48647. return ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(t) {
  48648. e[t] = {
  48649. groups: {},
  48650. tracks: {},
  48651. activePlaylistLoader: null,
  48652. activeGroup: s,
  48653. activeTrack: s,
  48654. onGroupChanged: s,
  48655. onTrackChanged: s
  48656. }
  48657. }), e
  48658. }
  48659. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  48660. typeof window ? window : {})
  48661. }, {
  48662. "./playlist-loader": 9
  48663. }],
  48664. 7: [function(e, t, i) {
  48665. (function(t) {
  48666. "use strict";
  48667. Object.defineProperty(i, "__esModule", {
  48668. value: !0
  48669. });
  48670. var r, n = "undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null,
  48671. a = (r = n) && r.__esModule ? r : {
  48672. default: r
  48673. },
  48674. s = e("./bin-utils"),
  48675. o = {
  48676. FAILURE: 2,
  48677. TIMEOUT: -101,
  48678. ABORTED: -102
  48679. };
  48680. i.REQUEST_ERRORS = o;
  48681. var u = function(e) {
  48682. var t, i, r = {};
  48683. return e.byterange && (r.Range = (t = e.byterange, i = t.offset + t.length - 1, "bytes=" + t
  48684. .offset + "-" + i)), r
  48685. },
  48686. l = function(e) {
  48687. e.forEach(function(e) {
  48688. e.abort()
  48689. })
  48690. },
  48691. d = function(e, t) {
  48692. return t.timedout ? {
  48693. status: t.status,
  48694. message: "HLS request timed-out at URL: " + t.uri,
  48695. code: o.TIMEOUT,
  48696. xhr: t
  48697. } : t.aborted ? {
  48698. status: t.status,
  48699. message: "HLS request aborted at URL: " + t.uri,
  48700. code: o.ABORTED,
  48701. xhr: t
  48702. } : e ? {
  48703. status: t.status,
  48704. message: "HLS request errored at URL: " + t.uri,
  48705. code: o.FAILURE,
  48706. xhr: t
  48707. } : null
  48708. },
  48709. c = function(e, t, i) {
  48710. var r = [],
  48711. n = 0;
  48712. return function(a, o) {
  48713. if (a && (l(e), r.push(a)), (n += 1) === e.length) {
  48714. if (o.endOfAllRequests = Date.now(), r.length > 0) {
  48715. var u = function(e) {
  48716. return e.reduce(function(e, t) {
  48717. return t.code > e.code ? t : e
  48718. })
  48719. }(r);
  48720. return i(u, o)
  48721. }
  48722. return o.encryptedBytes ? function(e, t, i) {
  48723. e.addEventListener("message", function r(n) {
  48724. if (n.data.source === t.requestId) {
  48725. e.removeEventListener("message", r);
  48726. var a = n.data.decrypted;
  48727. return t.bytes = new Uint8Array(a.bytes, a.byteOffset, a.byteLength), i(null,
  48728. t)
  48729. }
  48730. }), e.postMessage((0, s.createTransferableMessage)({
  48731. source: t.requestId,
  48732. encrypted: t.encryptedBytes,
  48733. key: t.key.bytes,
  48734. iv: t.key.iv
  48735. }), [t.encryptedBytes.buffer, t.key.bytes.buffer])
  48736. }(t, o, i) : i(null, o)
  48737. }
  48738. }
  48739. },
  48740. h = function(e, t) {
  48741. return function(i) {
  48742. var r, n, s;
  48743. return e.stats = a.default.mergeOptions(e.stats, (n = (r = i).target, (s = {
  48744. bandwidth: 1 / 0,
  48745. bytesReceived: 0,
  48746. roundTripTime: Date.now() - n.requestTime || 0
  48747. }).bytesReceived = r.loaded, s.bandwidth = Math.floor(s.bytesReceived / s
  48748. .roundTripTime * 8 * 1e3), s)), !e.stats.firstBytesReceivedAt && e.stats
  48749. .bytesReceived && (e.stats.firstBytesReceivedAt = Date.now()), t(i, e)
  48750. }
  48751. };
  48752. i.mediaSegmentRequest = function(e, t, i, r, n, s) {
  48753. var f = [],
  48754. p = c(f, i, s);
  48755. if (r.key) {
  48756. var m = e(a.default.mergeOptions(t, {
  48757. uri: r.key.resolvedUri,
  48758. responseType: "arraybuffer"
  48759. }), function(e, t) {
  48760. return function(i, r) {
  48761. var n = r.response,
  48762. a = d(i, r);
  48763. if (a) return t(a, e);
  48764. if (16 !== n.byteLength) return t({
  48765. status: r.status,
  48766. message: "Invalid HLS key at URL: " + r.uri,
  48767. code: o.FAILURE,
  48768. xhr: r
  48769. }, e);
  48770. var s = new DataView(n);
  48771. return e.key.bytes = new Uint32Array([s.getUint32(0), s.getUint32(4), s.getUint32(
  48772. 8), s.getUint32(12)
  48773. ]), t(null, e)
  48774. }
  48775. }(r, p));
  48776. f.push(m)
  48777. }
  48778. if (r.map && !r.map.bytes) {
  48779. var g = e(a.default.mergeOptions(t, {
  48780. uri: r.map.resolvedUri,
  48781. responseType: "arraybuffer",
  48782. headers: u(r.map)
  48783. }), function(e, t) {
  48784. return function(i, r) {
  48785. var n = r.response,
  48786. a = d(i, r);
  48787. return a ? t(a, e) : 0 === n.byteLength ? t({
  48788. status: r.status,
  48789. message: "Empty HLS segment content at URL: " + r.uri,
  48790. code: o.FAILURE,
  48791. xhr: r
  48792. }, e) : (e.map.bytes = new Uint8Array(r.response), t(null, e))
  48793. }
  48794. }(r, p));
  48795. f.push(g)
  48796. }
  48797. var v = e(a.default.mergeOptions(t, {
  48798. uri: r.resolvedUri,
  48799. responseType: "arraybuffer",
  48800. headers: u(r)
  48801. }), function(e, t) {
  48802. return function(i, r) {
  48803. var n = r.response,
  48804. a = d(i, r);
  48805. return a ? t(a, e) : 0 === n.byteLength ? t({
  48806. status: r.status,
  48807. message: "Empty HLS segment content at URL: " + r.uri,
  48808. code: o.FAILURE,
  48809. xhr: r
  48810. }, e) : (e.stats = function(e) {
  48811. return {
  48812. bandwidth: e.bandwidth,
  48813. bytesReceived: e.bytesReceived || 0,
  48814. roundTripTime: e.roundTripTime || 0
  48815. }
  48816. }(r), e.key ? e.encryptedBytes = new Uint8Array(r.response) : e.bytes =
  48817. new Uint8Array(r.response), t(null, e))
  48818. }
  48819. }(r, p));
  48820. return v.addEventListener("progress", h(r, n)), f.push(v),
  48821. function() {
  48822. return l(f)
  48823. }
  48824. }
  48825. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  48826. typeof window ? window : {})
  48827. }, {
  48828. "./bin-utils": 2
  48829. }],
  48830. 8: [function(e, t, i) {
  48831. (function(r) {
  48832. "use strict";
  48833. Object.defineProperty(i, "__esModule", {
  48834. value: !0
  48835. });
  48836. var n = function() {
  48837. function e(e, t) {
  48838. for (var i = 0; i < t.length; i++) {
  48839. var r = t[i];
  48840. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  48841. Object.defineProperty(e, r.key, r)
  48842. }
  48843. }
  48844. return function(t, i, r) {
  48845. return i && e(t.prototype, i), r && e(t, r), t
  48846. }
  48847. }();
  48848. function a(e) {
  48849. return e && e.__esModule ? e : {
  48850. default: e
  48851. }
  48852. }
  48853. var s = a(e("global/window")),
  48854. o = a(e("./ranges")),
  48855. u = a("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null),
  48856. l = ["seeking", "seeked", "pause", "playing", "error"],
  48857. d = function() {
  48858. function e(t) {
  48859. var i = this;
  48860. ! function(e, t) {
  48861. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  48862. }(this, e), this.tech_ = t.tech, this.seekable = t.seekable, this.consecutiveUpdates = 0, this
  48863. .lastRecordedTime = null, this.timer_ = null, this.checkCurrentTimeTimeout_ = null, t
  48864. .debug && (this.logger_ = u.default.log.bind(u.default, "playback-watcher ->")), this
  48865. .logger_("initialize");
  48866. var r = function() {
  48867. return i.monitorCurrentTime_()
  48868. },
  48869. n = function() {
  48870. return i.techWaiting_()
  48871. },
  48872. a = function() {
  48873. return i.cancelTimer_()
  48874. },
  48875. o = function() {
  48876. return i.fixesBadSeeks_()
  48877. };
  48878. this.tech_.on("seekablechanged", o), this.tech_.on("waiting", n), this.tech_.on(l, a), this
  48879. .tech_.on("canplay", r), this.dispose = function() {
  48880. i.logger_("dispose"), i.tech_.off("seekablechanged", o), i.tech_.off("waiting", n), i
  48881. .tech_.off(l, a), i.tech_.off("canplay", r), i.checkCurrentTimeTimeout_ && s.default
  48882. .clearTimeout(i.checkCurrentTimeTimeout_), i.cancelTimer_()
  48883. }
  48884. }
  48885. return n(e, [{
  48886. key: "monitorCurrentTime_",
  48887. value: function() {
  48888. this.checkCurrentTime_(), this.checkCurrentTimeTimeout_ && s.default.clearTimeout(
  48889. this.checkCurrentTimeTimeout_), this.checkCurrentTimeTimeout_ = s.default
  48890. .setTimeout(this.monitorCurrentTime_.bind(this), 250)
  48891. }
  48892. }, {
  48893. key: "checkCurrentTime_",
  48894. value: function() {
  48895. if (this.tech_.seeking() && this.fixesBadSeeks_()) return this.consecutiveUpdates =
  48896. 0, void(this.lastRecordedTime = this.tech_.currentTime());
  48897. if (!this.tech_.paused() && !this.tech_.seeking()) {
  48898. var e = this.tech_.currentTime(),
  48899. t = this.tech_.buffered();
  48900. if (this.lastRecordedTime === e && (!t.length || e + o.default.SAFE_TIME_DELTA >=
  48901. t.end(t.length - 1))) return this.techWaiting_();
  48902. this.consecutiveUpdates >= 5 && e === this.lastRecordedTime ? (this
  48903. .consecutiveUpdates++, this.waiting_()) : e === this.lastRecordedTime ? this
  48904. .consecutiveUpdates++ : (this.consecutiveUpdates = 0, this.lastRecordedTime = e)
  48905. }
  48906. }
  48907. }, {
  48908. key: "cancelTimer_",
  48909. value: function() {
  48910. this.consecutiveUpdates = 0, this.timer_ && (this.logger_("cancelTimer_"),
  48911. clearTimeout(this.timer_)), this.timer_ = null
  48912. }
  48913. }, {
  48914. key: "fixesBadSeeks_",
  48915. value: function() {
  48916. var e = this.tech_.seeking(),
  48917. t = this.seekable(),
  48918. i = this.tech_.currentTime(),
  48919. r = void 0;
  48920. e && this.afterSeekableWindow_(t, i) && (r = t.end(t.length - 1));
  48921. e && this.beforeSeekableWindow_(t, i) && (r = t.start(0) + o.default
  48922. .SAFE_TIME_DELTA);
  48923. return void 0 !== r && (this.logger_("Trying to seek outside of seekable at time " +
  48924. i + " with seekable range " + o.default.printableRange(t) + ". Seeking to " +
  48925. r + "."), this.tech_.setCurrentTime(r), !0)
  48926. }
  48927. }, {
  48928. key: "waiting_",
  48929. value: function() {
  48930. if (!this.techWaiting_()) {
  48931. var e = this.tech_.currentTime(),
  48932. t = this.tech_.buffered(),
  48933. i = o.default.findRange(t, e);
  48934. return i.length && e + 3 <= i.end(0) ? (this.cancelTimer_(), this.tech_
  48935. .setCurrentTime(e), this.logger_("Stopped at " + e +
  48936. " while inside a buffered region [" + i.start(0) + " -> " + i.end(0) +
  48937. "]. Attempting to resume playback by seeking to the current time."),
  48938. void this.tech_.trigger({
  48939. type: "usage",
  48940. name: "hls-unknown-waiting"
  48941. })) : void 0
  48942. }
  48943. }
  48944. }, {
  48945. key: "techWaiting_",
  48946. value: function() {
  48947. var e = this.seekable(),
  48948. t = this.tech_.currentTime();
  48949. if (this.tech_.seeking() && this.fixesBadSeeks_()) return !0;
  48950. if (this.tech_.seeking() || null !== this.timer_) return !0;
  48951. if (this.beforeSeekableWindow_(e, t)) {
  48952. var i = e.end(e.length - 1);
  48953. return this.logger_("Fell out of live window at time " + t +
  48954. ". Seeking to live point (seekable end) " + i), this.cancelTimer_(), this
  48955. .tech_.setCurrentTime(i), this.tech_.trigger({
  48956. type: "usage",
  48957. name: "hls-live-resync"
  48958. }), !0
  48959. }
  48960. var r = this.tech_.buffered(),
  48961. n = o.default.findNextRange(r, t);
  48962. if (this.videoUnderflow_(n, r, t)) return this.cancelTimer_(), this.tech_
  48963. .setCurrentTime(t), this.tech_.trigger({
  48964. type: "usage",
  48965. name: "hls-video-underflow"
  48966. }), !0;
  48967. if (n.length > 0) {
  48968. var a = n.start(0) - t;
  48969. return this.logger_("Stopped at " + t + ", setting timer for " + a +
  48970. ", seeking to " + n.start(0)), this.timer_ = setTimeout(this.skipTheGap_.bind(
  48971. this), 1e3 * a, t), !0
  48972. }
  48973. return !1
  48974. }
  48975. }, {
  48976. key: "afterSeekableWindow_",
  48977. value: function(e, t) {
  48978. return !!e.length && t > e.end(e.length - 1) + o.default.SAFE_TIME_DELTA
  48979. }
  48980. }, {
  48981. key: "beforeSeekableWindow_",
  48982. value: function(e, t) {
  48983. return !!(e.length && e.start(0) > 0 && t < e.start(0) - o.default.SAFE_TIME_DELTA)
  48984. }
  48985. }, {
  48986. key: "videoUnderflow_",
  48987. value: function(e, t, i) {
  48988. if (0 === e.length) {
  48989. var r = this.gapFromVideoUnderflow_(t, i);
  48990. if (r) return this.logger_("Encountered a gap in video from " + r.start + " to " +
  48991. r.end + ". Seeking to current time " + i), !0
  48992. }
  48993. return !1
  48994. }
  48995. }, {
  48996. key: "skipTheGap_",
  48997. value: function(e) {
  48998. var t = this.tech_.buffered(),
  48999. i = this.tech_.currentTime(),
  49000. r = o.default.findNextRange(t, i);
  49001. this.cancelTimer_(), 0 !== r.length && i === e && (this.logger_("skipTheGap_:",
  49002. "currentTime:", i, "scheduled currentTime:", e, "nextRange start:", r.start(0)
  49003. ), this.tech_.setCurrentTime(r.start(0) + o.default.TIME_FUDGE_FACTOR), this
  49004. .tech_.trigger({
  49005. type: "usage",
  49006. name: "hls-gap-skip"
  49007. }))
  49008. }
  49009. }, {
  49010. key: "gapFromVideoUnderflow_",
  49011. value: function(e, t) {
  49012. for (var i = o.default.findGaps(e), r = 0; r < i.length; r++) {
  49013. var n = i.start(r),
  49014. a = i.end(r);
  49015. if (t - n < 4 && t - n > 2) return {
  49016. start: n,
  49017. end: a
  49018. }
  49019. }
  49020. return null
  49021. }
  49022. }, {
  49023. key: "logger_",
  49024. value: function() {}
  49025. }]), e
  49026. }();
  49027. i.default = d, t.exports = i.default
  49028. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  49029. typeof window ? window : {})
  49030. }, {
  49031. "./ranges": 12,
  49032. "global/window": 32
  49033. }],
  49034. 9: [function(e, t, i) {
  49035. (function(t) {
  49036. "use strict";
  49037. Object.defineProperty(i, "__esModule", {
  49038. value: !0
  49039. });
  49040. var r = function() {
  49041. function e(e, t) {
  49042. for (var i = 0; i < t.length; i++) {
  49043. var r = t[i];
  49044. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  49045. Object.defineProperty(e, r.key, r)
  49046. }
  49047. }
  49048. return function(t, i, r) {
  49049. return i && e(t.prototype, i), r && e(t, r), t
  49050. }
  49051. }(),
  49052. n = function(e, t, i) {
  49053. for (var r = !0; r;) {
  49054. var n = e,
  49055. a = t,
  49056. s = i;
  49057. r = !1, null === n && (n = Function.prototype);
  49058. var o = Object.getOwnPropertyDescriptor(n, a);
  49059. if (void 0 !== o) {
  49060. if ("value" in o) return o.value;
  49061. var u = o.get;
  49062. if (void 0 === u) return;
  49063. return u.call(s)
  49064. }
  49065. var l = Object.getPrototypeOf(n);
  49066. if (null === l) return;
  49067. e = l, t = a, i = s, r = !0, o = l = void 0
  49068. }
  49069. };
  49070. function a(e) {
  49071. return e && e.__esModule ? e : {
  49072. default: e
  49073. }
  49074. }
  49075. var s = a(e("./resolve-url")),
  49076. o = "undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null,
  49077. u = a(e("m3u8-parser")),
  49078. l = a(e("global/window")),
  49079. d = function(e, t, i) {
  49080. var r = t.slice();
  49081. i = i || 0;
  49082. for (var n = Math.min(e.length, t.length + i), a = i; a < n; a++) r[a - i] = (0, o.mergeOptions)
  49083. (e[a], r[a - i]);
  49084. return r
  49085. };
  49086. i.updateSegments = d;
  49087. var c = function(e, t) {
  49088. e.resolvedUri || (e.resolvedUri = (0, s.default)(t, e.uri)), e.key && !e.key.resolvedUri && (e
  49089. .key.resolvedUri = (0, s.default)(t, e.key.uri)), e.map && !e.map.resolvedUri && (e.map
  49090. .resolvedUri = (0, s.default)(t, e.map.uri))
  49091. };
  49092. i.resolveSegmentUris = c;
  49093. var h = function(e, t) {
  49094. var i = (0, o.mergeOptions)(e, {}),
  49095. r = i.playlists.filter(function(e) {
  49096. return e.uri === t.uri
  49097. })[0];
  49098. if (!r) return null;
  49099. if (r.segments && t.segments && r.segments.length === t.segments.length && r.mediaSequence === t
  49100. .mediaSequence) return null;
  49101. var n = (0, o.mergeOptions)(r, t);
  49102. r.segments && (n.segments = d(r.segments, t.segments, t.mediaSequence - r.mediaSequence)), n
  49103. .segments.forEach(function(e) {
  49104. c(e, n.resolvedUri)
  49105. });
  49106. for (var a = 0; a < i.playlists.length; a++) i.playlists[a].uri === t.uri && (i.playlists[a] =
  49107. n);
  49108. return i.playlists[t.uri] = n, i
  49109. };
  49110. i.updateMaster = h;
  49111. var f = function(e) {
  49112. for (var t = e.playlists.length; t--;) {
  49113. var i = e.playlists[t];
  49114. e.playlists[i.uri] = i, i.resolvedUri = (0, s.default)(e.uri, i.uri), i.attributes || (i
  49115. .attributes = {}, o.log.warn(
  49116. "Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))
  49117. }
  49118. };
  49119. i.setupMediaPlaylists = f;
  49120. var p = function(e) {
  49121. ["AUDIO", "SUBTITLES"].forEach(function(t) {
  49122. for (var i in e.mediaGroups[t])
  49123. for (var r in e.mediaGroups[t][i]) {
  49124. var n = e.mediaGroups[t][i][r];
  49125. n.uri && (n.resolvedUri = (0, s.default)(e.uri, n.uri))
  49126. }
  49127. })
  49128. };
  49129. i.resolveMediaGroupUris = p;
  49130. var m = function(e, t) {
  49131. var i = e.segments[e.segments.length - 1];
  49132. return t && i && i.duration ? 1e3 * i.duration : 500 * (e.targetDuration || 10)
  49133. };
  49134. i.refreshDelay = m;
  49135. var g = function(e) {
  49136. function t(e, i, r) {
  49137. var a = this;
  49138. if (function(e, t) {
  49139. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  49140. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), r = r ||
  49141. {}, this.srcUrl = e, this.hls_ = i, this.withCredentials = !!r.withCredentials, this
  49142. .handleManifestRedirects = !!r.handleManifestRedirects, !this.srcUrl) throw new Error(
  49143. "A non-empty playlist URL is required");
  49144. this.state = "HAVE_NOTHING", this.on("mediaupdatetimeout", function() {
  49145. "HAVE_METADATA" === a.state && (a.state = "HAVE_CURRENT_METADATA", a.request = a.hls_
  49146. .xhr({
  49147. uri: (0, s.default)(a.master.uri, a.media().uri),
  49148. withCredentials: a.withCredentials
  49149. }, function(e, t) {
  49150. if (a.request) return e ? a.playlistRequestError(a.request, a.media().uri,
  49151. "HAVE_METADATA") : void a.haveMetadata(a.request, a.media().uri)
  49152. }))
  49153. })
  49154. }
  49155. return function(e, t) {
  49156. if ("function" != typeof t && null !== t) throw new TypeError(
  49157. "Super expression must either be null or a function, not " + typeof t);
  49158. e.prototype = Object.create(t && t.prototype, {
  49159. constructor: {
  49160. value: e,
  49161. enumerable: !1,
  49162. writable: !0,
  49163. configurable: !0
  49164. }
  49165. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  49166. }(t, o.EventTarget), r(t, [{
  49167. key: "playlistRequestError",
  49168. value: function(e, t, i) {
  49169. this.request = null, i && (this.state = i), this.error = {
  49170. playlist: this.master.playlists[t],
  49171. status: e.status,
  49172. message: "HLS playlist request error at URL: " + t,
  49173. responseText: e.responseText,
  49174. code: e.status >= 500 ? 4 : 2
  49175. }, this.trigger("error")
  49176. }
  49177. }, {
  49178. key: "haveMetadata",
  49179. value: function(e, t) {
  49180. var i = this;
  49181. this.request = null, this.state = "HAVE_METADATA";
  49182. var r = new u.default.Parser;
  49183. r.push(e.responseText), r.end(), r.manifest.uri = t, r.manifest.attributes = r
  49184. .manifest.attributes || {};
  49185. var n = h(this.master, r.manifest);
  49186. this.targetDuration = r.manifest.targetDuration, n ? (this.master = n, this.media_ =
  49187. this.master.playlists[r.manifest.uri]) : this.trigger("playlistunchanged"), this
  49188. .media().endList || (l.default.clearTimeout(this.mediaUpdateTimeout), this
  49189. .mediaUpdateTimeout = l.default.setTimeout(function() {
  49190. i.trigger("mediaupdatetimeout")
  49191. }, m(this.media(), !!n))), this.trigger("loadedplaylist")
  49192. }
  49193. }, {
  49194. key: "dispose",
  49195. value: function() {
  49196. this.stopRequest(), l.default.clearTimeout(this.mediaUpdateTimeout)
  49197. }
  49198. }, {
  49199. key: "stopRequest",
  49200. value: function() {
  49201. if (this.request) {
  49202. var e = this.request;
  49203. this.request = null, e.onreadystatechange = null, e.abort()
  49204. }
  49205. }
  49206. }, {
  49207. key: "media",
  49208. value: function(e) {
  49209. var t = this;
  49210. if (!e) return this.media_;
  49211. if ("HAVE_NOTHING" === this.state) throw new Error(
  49212. "Cannot switch media playlist from " + this.state);
  49213. var i = this.state;
  49214. if ("string" == typeof e) {
  49215. if (!this.master.playlists[e]) throw new Error("Unknown playlist URI: " + e);
  49216. e = this.master.playlists[e]
  49217. }
  49218. var r = !this.media_ || e.uri !== this.media_.uri;
  49219. if (this.master.playlists[e.uri].endList) return this.request && (this.request
  49220. .onreadystatechange = null, this.request.abort(), this.request = null), this
  49221. .state = "HAVE_METADATA", this.media_ = e, void(r && (this.trigger(
  49222. "mediachanging"), this.trigger("mediachange")));
  49223. if (r) {
  49224. if (this.state = "SWITCHING_MEDIA", this.request) {
  49225. if (e.resolvedUri === this.request.url) return;
  49226. this.request.onreadystatechange = null, this.request.abort(), this.request =
  49227. null
  49228. }
  49229. this.media_ && this.trigger("mediachanging"), this.request = this.hls_.xhr({
  49230. uri: e.resolvedUri,
  49231. withCredentials: this.withCredentials
  49232. }, function(r, n) {
  49233. if (t.request) {
  49234. if (e.resolvedUri = t.resolveManifestRedirect(e.resolvedUri, n), r)
  49235. return t.playlistRequestError(t.request, e.uri, i);
  49236. t.haveMetadata(n, e.uri), "HAVE_MASTER" === i ? t.trigger(
  49237. "loadedmetadata") : t.trigger("mediachange")
  49238. }
  49239. })
  49240. }
  49241. }
  49242. }, {
  49243. key: "resolveManifestRedirect",
  49244. value: function(e, t) {
  49245. return this.handleManifestRedirects && t.responseURL && e !== t.responseURL ? t
  49246. .responseURL : e
  49247. }
  49248. }, {
  49249. key: "pause",
  49250. value: function() {
  49251. this.stopRequest(), l.default.clearTimeout(this.mediaUpdateTimeout),
  49252. "HAVE_NOTHING" === this.state && (this.started = !1), "SWITCHING_MEDIA" === this
  49253. .state ? this.media_ ? this.state = "HAVE_METADATA" : this.state = "HAVE_MASTER" :
  49254. "HAVE_CURRENT_METADATA" === this.state && (this.state = "HAVE_METADATA")
  49255. }
  49256. }, {
  49257. key: "load",
  49258. value: function(e) {
  49259. var t = this;
  49260. l.default.clearTimeout(this.mediaUpdateTimeout);
  49261. var i = this.media();
  49262. if (e) {
  49263. var r = i ? i.targetDuration / 2 * 1e3 : 5e3;
  49264. this.mediaUpdateTimeout = l.default.setTimeout(function() {
  49265. return t.load()
  49266. }, r)
  49267. } else this.started ? i && !i.endList ? this.trigger("mediaupdatetimeout") : this
  49268. .trigger("loadedplaylist") : this.start()
  49269. }
  49270. }, {
  49271. key: "start",
  49272. value: function() {
  49273. var e = this;
  49274. this.started = !0, this.request = this.hls_.xhr({
  49275. uri: this.srcUrl,
  49276. withCredentials: this.withCredentials
  49277. }, function(t, i) {
  49278. if (e.request) {
  49279. if (e.request = null, t) return e.error = {
  49280. status: i.status,
  49281. message: "HLS playlist request error at URL: " + e.srcUrl,
  49282. responseText: i.responseText,
  49283. code: 2
  49284. }, "HAVE_NOTHING" === e.state && (e.started = !1), e.trigger("error");
  49285. var r = new u.default.Parser;
  49286. return r.push(i.responseText), r.end(), e.state = "HAVE_MASTER", e.srcUrl =
  49287. e.resolveManifestRedirect(e.srcUrl, i), r.manifest.uri = e.srcUrl, r
  49288. .manifest.playlists ? (e.master = r.manifest, f(e.master), p(e.master), e
  49289. .trigger("loadedplaylist"), void(e.request || e.media(r.manifest
  49290. .playlists[0]))) : (e.master = {
  49291. mediaGroups: {
  49292. AUDIO: {},
  49293. VIDEO: {},
  49294. "CLOSED-CAPTIONS": {},
  49295. SUBTITLES: {}
  49296. },
  49297. uri: l.default.location.href,
  49298. playlists: [{
  49299. uri: e.srcUrl,
  49300. resolvedUri: e.srcUrl,
  49301. attributes: {}
  49302. }]
  49303. }, e.master.playlists[e.srcUrl] = e.master.playlists[0], e.haveMetadata(
  49304. i, e.srcUrl), e.trigger("loadedmetadata"))
  49305. }
  49306. })
  49307. }
  49308. }]), t
  49309. }();
  49310. i.default = g
  49311. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  49312. typeof window ? window : {})
  49313. }, {
  49314. "./resolve-url": 15,
  49315. "global/window": 32,
  49316. "m3u8-parser": 33
  49317. }],
  49318. 10: [function(e, t, i) {
  49319. "use strict";
  49320. function r(e) {
  49321. return e && e.__esModule ? e : {
  49322. default: e
  49323. }
  49324. }
  49325. Object.defineProperty(i, "__esModule", {
  49326. value: !0
  49327. });
  49328. var n = r(e("./config")),
  49329. a = r(e("./playlist")),
  49330. s = e("./util/codecs.js"),
  49331. o = function(e, t) {
  49332. var i;
  49333. return e && (i = window.getComputedStyle(e)) ? i[t] : ""
  49334. },
  49335. u = function(e, t) {
  49336. var i = e.slice();
  49337. e.sort(function(e, r) {
  49338. var n = t(e, r);
  49339. return 0 === n ? i.indexOf(e) - i.indexOf(r) : n
  49340. })
  49341. },
  49342. l = function(e, t) {
  49343. var i = void 0,
  49344. r = void 0;
  49345. return e.attributes.BANDWIDTH && (i = e.attributes.BANDWIDTH), i = i || window.Number.MAX_VALUE, t
  49346. .attributes.BANDWIDTH && (r = t.attributes.BANDWIDTH), i - (r = r || window.Number.MAX_VALUE)
  49347. };
  49348. i.comparePlaylistBandwidth = l;
  49349. i.comparePlaylistResolution = function(e, t) {
  49350. var i = void 0,
  49351. r = void 0;
  49352. return e.attributes.RESOLUTION && e.attributes.RESOLUTION.width && (i = e.attributes.RESOLUTION
  49353. .width), i = i || window.Number.MAX_VALUE, t.attributes.RESOLUTION && t.attributes.RESOLUTION
  49354. .width && (r = t.attributes.RESOLUTION.width), i === (r = r || window.Number.MAX_VALUE) && e
  49355. .attributes.BANDWIDTH && t.attributes.BANDWIDTH ? e.attributes.BANDWIDTH - t.attributes
  49356. .BANDWIDTH : i - r
  49357. };
  49358. var d = function(e, t, i, r) {
  49359. var s = e.playlists.map(function(e) {
  49360. var t, i;
  49361. return t = e.attributes.RESOLUTION && e.attributes.RESOLUTION.width, i = e.attributes
  49362. .RESOLUTION && e.attributes.RESOLUTION.height, {
  49363. bandwidth: e.attributes.BANDWIDTH || window.Number.MAX_VALUE,
  49364. width: t,
  49365. height: i,
  49366. playlist: e
  49367. }
  49368. });
  49369. u(s, function(e, t) {
  49370. return e.bandwidth - t.bandwidth
  49371. });
  49372. var o = (s = s.filter(function(e) {
  49373. return !a.default.isIncompatible(e.playlist)
  49374. })).filter(function(e) {
  49375. return a.default.isEnabled(e.playlist)
  49376. });
  49377. o.length || (o = s.filter(function(e) {
  49378. return !a.default.isDisabled(e.playlist)
  49379. }));
  49380. var l = o.filter(function(e) {
  49381. return e.bandwidth * n.default.BANDWIDTH_VARIANCE < t
  49382. }),
  49383. d = l[l.length - 1],
  49384. c = l.filter(function(e) {
  49385. return e.bandwidth === d.bandwidth
  49386. })[0],
  49387. h = l.filter(function(e) {
  49388. return e.width && e.height
  49389. });
  49390. u(h, function(e, t) {
  49391. return e.width - t.width
  49392. });
  49393. var f = h.filter(function(e) {
  49394. return e.width === i && e.height === r
  49395. });
  49396. d = f[f.length - 1];
  49397. var p = f.filter(function(e) {
  49398. return e.bandwidth === d.bandwidth
  49399. })[0],
  49400. m = void 0,
  49401. g = void 0,
  49402. v = void 0;
  49403. p || (g = (m = h.filter(function(e) {
  49404. return e.width > i || e.height > r
  49405. })).filter(function(e) {
  49406. return e.width === m[0].width && e.height === m[0].height
  49407. }), d = g[g.length - 1], v = g.filter(function(e) {
  49408. return e.bandwidth === d.bandwidth
  49409. })[0]);
  49410. var y = v || p || c || o[0] || s[0];
  49411. return y ? y.playlist : null
  49412. };
  49413. i.simpleSelector = d;
  49414. i.lastBandwidthSelector = function() {
  49415. return d(this.playlists.master, this.systemBandwidth, parseInt(o(this.tech_.el(), "width"), 10),
  49416. parseInt(o(this.tech_.el(), "height"), 10))
  49417. };
  49418. i.movingAverageBandwidthSelector = function(e) {
  49419. var t = -1;
  49420. if (e < 0 || e > 1) throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  49421. return function() {
  49422. return t < 0 && (t = this.systemBandwidth), t = e * this.systemBandwidth + (1 - e) * t, d(this
  49423. .playlists.master, t, parseInt(o(this.tech_.el(), "width"), 10), parseInt(o(this.tech_.el(),
  49424. "height"), 10))
  49425. }
  49426. };
  49427. i.minRebufferMaxBandwidthSelector = function(e) {
  49428. var t = e.master,
  49429. i = e.currentTime,
  49430. r = e.bandwidth,
  49431. n = e.duration,
  49432. s = e.segmentDuration,
  49433. o = e.timeUntilRebuffer,
  49434. d = e.currentTimeline,
  49435. c = e.syncController,
  49436. h = t.playlists.filter(function(e) {
  49437. return !a.default.isIncompatible(e)
  49438. }),
  49439. f = h.filter(a.default.isEnabled);
  49440. f.length || (f = h.filter(function(e) {
  49441. return !a.default.isDisabled(e)
  49442. }));
  49443. var p = f.filter(a.default.hasAttribute.bind(null, "BANDWIDTH")).map(function(e) {
  49444. var t = c.getSyncPoint(e, n, d, i) ? 1 : 2;
  49445. return {
  49446. playlist: e,
  49447. rebufferingImpact: a.default.estimateSegmentRequestTime(s, r, e) * t - o
  49448. }
  49449. }),
  49450. m = p.filter(function(e) {
  49451. return e.rebufferingImpact <= 0
  49452. });
  49453. return u(m, function(e, t) {
  49454. return l(t.playlist, e.playlist)
  49455. }), m.length ? m[0] : (u(p, function(e, t) {
  49456. return e.rebufferingImpact - t.rebufferingImpact
  49457. }), p[0] || null)
  49458. };
  49459. i.lowestBitrateCompatibleVariantSelector = function() {
  49460. var e = this.playlists.master.playlists.filter(a.default.isEnabled);
  49461. return u(e, function(e, t) {
  49462. return l(e, t)
  49463. }), e.filter(function(e) {
  49464. return (0, s.parseCodecs)(e.attributes.CODECS).videoCodec
  49465. })[0] || null
  49466. }
  49467. }, {
  49468. "./config": 3,
  49469. "./playlist": 11,
  49470. "./util/codecs.js": 19
  49471. }],
  49472. 11: [function(e, t, i) {
  49473. (function(t) {
  49474. "use strict";
  49475. Object.defineProperty(i, "__esModule", {
  49476. value: !0
  49477. });
  49478. var r, n = "undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null,
  49479. a = e("global/window"),
  49480. s = (r = a) && r.__esModule ? r : {
  49481. default: r
  49482. },
  49483. o = function(e, t, i) {
  49484. var r, n;
  49485. return void 0 === t && (t = e.mediaSequence + e.segments.length), t < e.mediaSequence ? 0 : (r =
  49486. function(e, t) {
  49487. var i = 0,
  49488. r = t - e.mediaSequence,
  49489. n = e.segments[r];
  49490. if (n) {
  49491. if (void 0 !== n.start) return {
  49492. result: n.start,
  49493. precise: !0
  49494. };
  49495. if (void 0 !== n.end) return {
  49496. result: n.end - n.duration,
  49497. precise: !0
  49498. }
  49499. }
  49500. for (; r--;) {
  49501. if (void 0 !== (n = e.segments[r]).end) return {
  49502. result: i + n.end,
  49503. precise: !0
  49504. };
  49505. if (i += n.duration, void 0 !== n.start) return {
  49506. result: i + n.start,
  49507. precise: !0
  49508. }
  49509. }
  49510. return {
  49511. result: i,
  49512. precise: !1
  49513. }
  49514. }(e, t)).precise ? r.result : (n = function(e, t) {
  49515. for (var i = 0, r = void 0, n = t - e.mediaSequence; n < e.segments.length; n++) {
  49516. if (void 0 !== (r = e.segments[n]).start) return {
  49517. result: r.start - i,
  49518. precise: !0
  49519. };
  49520. if (i += r.duration, void 0 !== r.end) return {
  49521. result: r.end - i,
  49522. precise: !0
  49523. }
  49524. }
  49525. return {
  49526. result: -1,
  49527. precise: !1
  49528. }
  49529. }(e, t)).precise ? n.result : r.result + i
  49530. },
  49531. u = function(e, t, i) {
  49532. if (!e) return 0;
  49533. if ("number" != typeof i && (i = 0), void 0 === t) {
  49534. if (e.totalDuration) return e.totalDuration;
  49535. if (!e.endList) return s.default.Infinity
  49536. }
  49537. return o(e, t, i)
  49538. };
  49539. i.duration = u;
  49540. var l = function(e, t, i) {
  49541. var r = 0;
  49542. if (t > i) {
  49543. var n = [i, t];
  49544. t = n[0], i = n[1]
  49545. }
  49546. if (t < 0) {
  49547. for (var a = t; a < Math.min(0, i); a++) r += e.targetDuration;
  49548. t = 0
  49549. }
  49550. for (a = t; a < i; a++) r += e.segments[a].duration;
  49551. return r
  49552. };
  49553. i.sumDurations = l;
  49554. var d = function(e) {
  49555. if (!e.segments.length) return 0;
  49556. for (var t = e.segments.length - 1, i = e.segments[t].duration || e.targetDuration, r = i + 2 *
  49557. e.targetDuration; t-- && !((i += e.segments[t].duration) >= r););
  49558. return Math.max(0, t)
  49559. };
  49560. i.safeLiveIndex = d;
  49561. var c = function(e, t, i) {
  49562. if (!e || !e.segments) return null;
  49563. if (e.endList) return u(e);
  49564. if (null === t) return null;
  49565. t = t || 0;
  49566. var r = i ? d(e) : e.segments.length;
  49567. return o(e, e.mediaSequence + r, t)
  49568. };
  49569. i.playlistEnd = c;
  49570. var h = function(e, t) {
  49571. var i = t || 0,
  49572. r = c(e, t, !0);
  49573. return null === r ? (0, n.createTimeRange)() : (0, n.createTimeRange)(i, r)
  49574. };
  49575. i.seekable = h;
  49576. var f = function(e) {
  49577. return e - Math.floor(e) == 0
  49578. },
  49579. p = function(e, t) {
  49580. if (f(t)) return t + .1 * e;
  49581. for (var i = t.toString().split(".")[1].length, r = 1; r <= i; r++) {
  49582. var n = Math.pow(10, r),
  49583. a = t * n;
  49584. if (f(a) || r === i) return (a + e) / n
  49585. }
  49586. },
  49587. m = p.bind(null, 1),
  49588. g = p.bind(null, -1),
  49589. v = function(e, t, i, r) {
  49590. var n = void 0,
  49591. a = void 0,
  49592. s = e.segments.length,
  49593. o = t - r;
  49594. if (o < 0) {
  49595. if (i > 0)
  49596. for (n = i - 1; n >= 0; n--)
  49597. if (a = e.segments[n], (o += g(a.duration)) > 0) return {
  49598. mediaIndex: n,
  49599. startTime: r - l(e, i, n)
  49600. };
  49601. return {
  49602. mediaIndex: 0,
  49603. startTime: t
  49604. }
  49605. }
  49606. if (i < 0) {
  49607. for (n = i; n < 0; n++)
  49608. if ((o -= e.targetDuration) < 0) return {
  49609. mediaIndex: 0,
  49610. startTime: t
  49611. };
  49612. i = 0
  49613. }
  49614. for (n = i; n < s; n++)
  49615. if (a = e.segments[n], (o -= m(a.duration)) < 0) return {
  49616. mediaIndex: n,
  49617. startTime: r + l(e, i, n)
  49618. };
  49619. return {
  49620. mediaIndex: s - 1,
  49621. startTime: t
  49622. }
  49623. };
  49624. i.getMediaInfoForTime = v;
  49625. var y = function(e) {
  49626. return e.excludeUntil && e.excludeUntil > Date.now()
  49627. };
  49628. i.isBlacklisted = y;
  49629. var _ = function(e) {
  49630. return e.excludeUntil && e.excludeUntil === 1 / 0
  49631. };
  49632. i.isIncompatible = _;
  49633. var b = function(e) {
  49634. var t = y(e);
  49635. return !e.disabled && !t
  49636. };
  49637. i.isEnabled = b;
  49638. var w = function(e) {
  49639. return e.disabled
  49640. };
  49641. i.isDisabled = w;
  49642. var E = function(e) {
  49643. for (var t = 0; t < e.segments.length; t++)
  49644. if (e.segments[t].key) return !0;
  49645. return !1
  49646. };
  49647. i.isAes = E;
  49648. var T = function(e) {
  49649. for (var t = 0; t < e.segments.length; t++)
  49650. if (e.segments[t].map) return !0;
  49651. return !1
  49652. };
  49653. i.isFmp4 = T;
  49654. var S = function(e, t) {
  49655. return t.attributes && t.attributes[e]
  49656. };
  49657. i.hasAttribute = S;
  49658. var A = function(e, t, i) {
  49659. var r = arguments.length <= 3 || void 0 === arguments[3] ? 0 : arguments[3];
  49660. return S("BANDWIDTH", i) ? (e * i.attributes.BANDWIDTH - 8 * r) / t : NaN
  49661. };
  49662. i.estimateSegmentRequestTime = A;
  49663. var k = function(e, t) {
  49664. if (1 === e.playlists.length) return !0;
  49665. var i = t.attributes.BANDWIDTH || Number.MAX_VALUE;
  49666. return 0 === e.playlists.filter(function(e) {
  49667. return !!b(e) && (e.attributes.BANDWIDTH || 0) < i
  49668. }).length
  49669. };
  49670. i.isLowestEnabledRendition = k, i.default = {
  49671. duration: u,
  49672. seekable: h,
  49673. safeLiveIndex: d,
  49674. getMediaInfoForTime: v,
  49675. isEnabled: b,
  49676. isDisabled: w,
  49677. isBlacklisted: y,
  49678. isIncompatible: _,
  49679. playlistEnd: c,
  49680. isAes: E,
  49681. isFmp4: T,
  49682. hasAttribute: S,
  49683. estimateSegmentRequestTime: A,
  49684. isLowestEnabledRendition: k
  49685. }
  49686. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  49687. typeof window ? window : {})
  49688. }, {
  49689. "global/window": 32
  49690. }],
  49691. 12: [function(e, t, i) {
  49692. (function(e) {
  49693. "use strict";
  49694. Object.defineProperty(i, "__esModule", {
  49695. value: !0
  49696. });
  49697. var r = function() {
  49698. return function(e, t) {
  49699. if (Array.isArray(e)) return e;
  49700. if (Symbol.iterator in Object(e)) return function(e, t) {
  49701. var i = [],
  49702. r = !0,
  49703. n = !1,
  49704. a = void 0;
  49705. try {
  49706. for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s
  49707. .value), !t || i.length !== t); r = !0);
  49708. } catch (e) {
  49709. n = !0, a = e
  49710. } finally {
  49711. try {
  49712. !r && o.return && o.return()
  49713. } finally {
  49714. if (n) throw a
  49715. }
  49716. }
  49717. return i
  49718. }(e, t);
  49719. throw new TypeError("Invalid attempt to destructure non-iterable instance")
  49720. }
  49721. }();
  49722. var n, a = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null,
  49723. s = (n = a) && n.__esModule ? n : {
  49724. default: n
  49725. },
  49726. o = function(e, t) {
  49727. var i = [],
  49728. r = void 0;
  49729. if (e && e.length)
  49730. for (r = 0; r < e.length; r++) t(e.start(r), e.end(r)) && i.push([e.start(r), e.end(r)]);
  49731. return s.default.createTimeRanges(i)
  49732. },
  49733. u = function(e, t) {
  49734. var i = null,
  49735. r = null,
  49736. n = 0,
  49737. a = [],
  49738. o = [];
  49739. if (!(e && e.length && t && t.length)) return s.default.createTimeRange();
  49740. for (var u = e.length; u--;) a.push({
  49741. time: e.start(u),
  49742. type: "start"
  49743. }), a.push({
  49744. time: e.end(u),
  49745. type: "end"
  49746. });
  49747. for (u = t.length; u--;) a.push({
  49748. time: t.start(u),
  49749. type: "start"
  49750. }), a.push({
  49751. time: t.end(u),
  49752. type: "end"
  49753. });
  49754. for (a.sort(function(e, t) {
  49755. return e.time - t.time
  49756. }), u = 0; u < a.length; u++) "start" === a[u].type ? 2 === ++n && (i = a[u].time) : "end" ===
  49757. a[u].type && 1 === --n && (r = a[u].time), null !== i && null !== r && (o.push([i, r]), i =
  49758. null, r = null);
  49759. return s.default.createTimeRanges(o)
  49760. };
  49761. i.default = {
  49762. findRange: function(e, t) {
  49763. return o(e, function(e, i) {
  49764. return e - 1 / 30 <= t && i + 1 / 30 >= t
  49765. })
  49766. },
  49767. findNextRange: function(e, t) {
  49768. return o(e, function(e) {
  49769. return e - 1 / 30 >= t
  49770. })
  49771. },
  49772. findGaps: function(e) {
  49773. if (e.length < 2) return s.default.createTimeRanges();
  49774. for (var t = [], i = 1; i < e.length; i++) {
  49775. var r = e.end(i - 1),
  49776. n = e.start(i);
  49777. t.push([r, n])
  49778. }
  49779. return s.default.createTimeRanges(t)
  49780. },
  49781. findSoleUncommonTimeRangesEnd: function(e, t) {
  49782. var i = void 0,
  49783. r = void 0,
  49784. n = void 0,
  49785. a = [],
  49786. s = [],
  49787. o = function(e) {
  49788. return e[0] <= n && e[1] >= n
  49789. };
  49790. if (e)
  49791. for (i = 0; i < e.length; i++) r = e.start(i), n = e.end(i), s.push([r, n]);
  49792. if (t)
  49793. for (i = 0; i < t.length; i++) r = t.start(i), n = t.end(i), s.some(o) || a.push(n);
  49794. return 1 !== a.length ? null : a[0]
  49795. },
  49796. getSegmentBufferedPercent: function(e, t, i, n) {
  49797. var a, o, l, d, c, h = e + t,
  49798. f = s.default.createTimeRanges([
  49799. [e, h]
  49800. ]),
  49801. p = s.default.createTimeRanges([
  49802. [(a = e, o = [i, h], l = r(o, 2), d = l[0], c = l[1], Math.min(Math.max(d, a), c)), h]
  49803. ]);
  49804. if (p.start(0) === p.end(0)) return 0;
  49805. var m = function(e, t, i, r) {
  49806. for (var n = t.end(0) - t.start(0), a = n - (e.end(0) - e.start(0)), s = u(e, r), o = u(
  49807. t, r), l = 0, d = 0, c = s.length; c--;) l += s.end(c) - s.start(c), s.start(c) ===
  49808. i && (l += a);
  49809. for (c = o.length; c--;) d += o.end(c) - o.start(c);
  49810. return Math.max(l, d) / n * 100
  49811. }(p, f, i, n);
  49812. return isNaN(m) || m === 1 / 0 || m === -1 / 0 ? 0 : m
  49813. },
  49814. TIME_FUDGE_FACTOR: 1 / 30,
  49815. SAFE_TIME_DELTA: .1,
  49816. printableRange: function(e) {
  49817. var t = [];
  49818. if (!e || !e.length) return "";
  49819. for (var i = 0; i < e.length; i++) t.push(e.start(i) + " => " + e.end(i));
  49820. return t.join(", ")
  49821. },
  49822. timeUntilRebuffer: function(e, t) {
  49823. var i = arguments.length <= 2 || void 0 === arguments[2] ? 1 : arguments[2];
  49824. return ((e.length ? e.end(e.length - 1) : 0) - t) / i
  49825. }
  49826. }, t.exports = i.default
  49827. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  49828. typeof window ? window : {})
  49829. }, {}],
  49830. 13: [function(e, t, i) {
  49831. (function(e) {
  49832. "use strict";
  49833. Object.defineProperty(i, "__esModule", {
  49834. value: !0
  49835. });
  49836. var r, n = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null,
  49837. a = (r = n) && r.__esModule ? r : {
  49838. default: r
  49839. },
  49840. s = {
  49841. errorInterval: 30,
  49842. getSource: function(e) {
  49843. return e(this.tech({
  49844. IWillNotUseThisInPlugins: !0
  49845. }).currentSource_)
  49846. }
  49847. };
  49848. i.default = function(e) {
  49849. ! function e(t, i) {
  49850. var r = 0,
  49851. n = 0,
  49852. o = a.default.mergeOptions(s, i);
  49853. t.ready(function() {
  49854. t.trigger({
  49855. type: "usage",
  49856. name: "hls-error-reload-initialized"
  49857. })
  49858. });
  49859. var u = function() {
  49860. n && t.currentTime(n)
  49861. },
  49862. l = function(e) {
  49863. null !== e && void 0 !== e && (n = t.duration() !== 1 / 0 && t.currentTime() || 0, t.one(
  49864. "loadedmetadata", u), t.src(e), t.trigger({
  49865. type: "usage",
  49866. name: "hls-error-reload"
  49867. }), t.play())
  49868. },
  49869. d = function() {
  49870. if (Date.now() - r < 1e3 * o.errorInterval) t.trigger({
  49871. type: "usage",
  49872. name: "hls-error-reload-canceled"
  49873. });
  49874. else {
  49875. if (o.getSource && "function" == typeof o.getSource) return r = Date.now(), o.getSource
  49876. .call(t, l);
  49877. a.default.log.error(
  49878. "ERROR: reloadSourceOnError - The option getSource must be a function!")
  49879. }
  49880. },
  49881. c = function e() {
  49882. t.off("loadedmetadata", u), t.off("error", d), t.off("dispose", e)
  49883. };
  49884. t.on("error", d), t.on("dispose", c), t.reloadSourceOnError = function(i) {
  49885. c(), e(t, i)
  49886. }
  49887. }(this, e)
  49888. }, t.exports = i.default
  49889. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  49890. typeof window ? window : {})
  49891. }, {}],
  49892. 14: [function(e, t, i) {
  49893. "use strict";
  49894. Object.defineProperty(i, "__esModule", {
  49895. value: !0
  49896. });
  49897. var r = e("./playlist.js"),
  49898. n = function e(t, i, n) {
  49899. ! function(e, t) {
  49900. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  49901. }(this, e);
  49902. var a, s, o, u = t.masterPlaylistController_.fastQualityChange_.bind(t.masterPlaylistController_);
  49903. if (i.attributes.RESOLUTION) {
  49904. var l = i.attributes.RESOLUTION;
  49905. this.width = l.width, this.height = l.height
  49906. }
  49907. this.bandwidth = i.attributes.BANDWIDTH, this.id = n, this.enabled = (a = t.playlists, s = i.uri,
  49908. o = u,
  49909. function(e) {
  49910. var t = a.master.playlists[s],
  49911. i = (0, r.isIncompatible)(t),
  49912. n = (0, r.isEnabled)(t);
  49913. return void 0 === e ? n : (e ? delete t.disabled : t.disabled = !0, e === n || i || (o(), e ?
  49914. a.trigger("renditionenabled") : a.trigger("renditiondisabled")), e)
  49915. })
  49916. };
  49917. i.default = function(e) {
  49918. var t = e.playlists;
  49919. e.representations = function() {
  49920. return t.master.playlists.filter(function(e) {
  49921. return !(0, r.isIncompatible)(e)
  49922. }).map(function(t, i) {
  49923. return new n(e, t, t.uri)
  49924. })
  49925. }
  49926. }, t.exports = i.default
  49927. }, {
  49928. "./playlist.js": 11
  49929. }],
  49930. 15: [function(e, t, i) {
  49931. "use strict";
  49932. function r(e) {
  49933. return e && e.__esModule ? e : {
  49934. default: e
  49935. }
  49936. }
  49937. Object.defineProperty(i, "__esModule", {
  49938. value: !0
  49939. });
  49940. var n = r(e("url-toolkit")),
  49941. a = r(e("global/window"));
  49942. i.default = function(e, t) {
  49943. return /^[a-z]+:/i.test(t) ? t : (/\/\//i.test(e) || (e = n.default.buildAbsoluteURL(a.default
  49944. .location.href, e)), n.default.buildAbsoluteURL(e, t))
  49945. }, t.exports = i.default
  49946. }, {
  49947. "global/window": 32,
  49948. "url-toolkit": 63
  49949. }],
  49950. 16: [function(e, t, i) {
  49951. (function(t) {
  49952. "use strict";
  49953. Object.defineProperty(i, "__esModule", {
  49954. value: !0
  49955. });
  49956. var r = function() {
  49957. function e(e, t) {
  49958. for (var i = 0; i < t.length; i++) {
  49959. var r = t[i];
  49960. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  49961. Object.defineProperty(e, r.key, r)
  49962. }
  49963. }
  49964. return function(t, i, r) {
  49965. return i && e(t.prototype, i), r && e(t, r), t
  49966. }
  49967. }(),
  49968. n = function(e, t, i) {
  49969. for (var r = !0; r;) {
  49970. var n = e,
  49971. a = t,
  49972. s = i;
  49973. r = !1, null === n && (n = Function.prototype);
  49974. var o = Object.getOwnPropertyDescriptor(n, a);
  49975. if (void 0 !== o) {
  49976. if ("value" in o) return o.value;
  49977. var u = o.get;
  49978. if (void 0 === u) return;
  49979. return u.call(s)
  49980. }
  49981. var l = Object.getPrototypeOf(n);
  49982. if (null === l) return;
  49983. e = l, t = a, i = s, r = !0, o = l = void 0
  49984. }
  49985. };
  49986. function a(e) {
  49987. return e && e.__esModule ? e : {
  49988. default: e
  49989. }
  49990. }
  49991. var s = a(e("./playlist")),
  49992. o = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null),
  49993. u = a(e("./source-updater")),
  49994. l = a(e("./config")),
  49995. d = a(e("global/window")),
  49996. c = a(e("videojs-contrib-media-sources/es5/remove-cues-from-track.js")),
  49997. h = e("./bin-utils"),
  49998. f = e("./media-segment-request"),
  49999. p = e("./ranges"),
  50000. m = e("./playlist-selectors"),
  50001. g = function(e, t, i) {
  50002. if (!e || !t) return !1;
  50003. var r = i === e.segments.length;
  50004. return e.endList && "open" === t.readyState && r
  50005. },
  50006. v = function(e) {
  50007. return "number" == typeof e && isFinite(e)
  50008. },
  50009. y = function(e, t, i) {
  50010. return "main" === e && t && i ? i.containsAudio || i.containsVideo ? t.containsVideo && !i
  50011. .containsVideo ?
  50012. "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest." :
  50013. !t.containsVideo && i.containsVideo ?
  50014. "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest." :
  50015. null : "Neither audio nor video found in segment." : null
  50016. };
  50017. i.illegalMediaSwitch = y;
  50018. var _ = function(e, t, i) {
  50019. var r = void 0;
  50020. return r = e.length && e.start(0) > 0 && e.start(0) < t ? e.start(0) : t - 30, Math.min(r, t -
  50021. i)
  50022. };
  50023. i.safeBackBufferTrimTime = _;
  50024. var b = function(e) {
  50025. function t(e) {
  50026. var i = this,
  50027. r = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1];
  50028. if (function(e, t) {
  50029. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  50030. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), !e)
  50031. throw new TypeError("Initialization settings are required");
  50032. if ("function" != typeof e.currentTime) throw new TypeError(
  50033. "No currentTime getter specified");
  50034. if (!e.mediaSource) throw new TypeError("No MediaSource specified");
  50035. this.state = "INIT", this.bandwidth = e.bandwidth, this.throughput = {
  50036. rate: 0,
  50037. count: 0
  50038. }, this.roundTrip = NaN, this.resetStats_(), this.mediaIndex = null, this.hasPlayed_ = e
  50039. .hasPlayed, this.currentTime_ = e.currentTime, this.seekable_ = e.seekable, this.seeking_ =
  50040. e.seeking, this.duration_ = e.duration, this.mediaSource_ = e.mediaSource, this.hls_ = e
  50041. .hls, this.loaderType_ = e.loaderType, this.startingMedia_ = void 0, this
  50042. .segmentMetadataTrack_ = e.segmentMetadataTrack, this.goalBufferLength_ = e
  50043. .goalBufferLength, this.checkBufferTimeout_ = null, this.error_ = void 0, this
  50044. .currentTimeline_ = -1, this.pendingSegment_ = null, this.mimeType_ = null, this
  50045. .sourceUpdater_ = null, this.xhrOptions_ = null, this.activeInitSegmentId_ = null, this
  50046. .initSegments_ = {}, this.decrypter_ = e.decrypter, this.syncController_ = e.syncController,
  50047. this.syncPoint_ = {
  50048. segmentIndex: 0,
  50049. time: 0
  50050. }, this.syncController_.on("syncinfoupdate", function() {
  50051. return i.trigger("syncinfoupdate")
  50052. }), this.mediaSource_.addEventListener("sourceopen", function() {
  50053. return i.ended_ = !1
  50054. }), this.fetchAtBuffer_ = !1, r.debug && (this.logger_ = o.default.log.bind(o.default,
  50055. "segment-loader", this.loaderType_, "->"))
  50056. }
  50057. return function(e, t) {
  50058. if ("function" != typeof t && null !== t) throw new TypeError(
  50059. "Super expression must either be null or a function, not " + typeof t);
  50060. e.prototype = Object.create(t && t.prototype, {
  50061. constructor: {
  50062. value: e,
  50063. enumerable: !1,
  50064. writable: !0,
  50065. configurable: !0
  50066. }
  50067. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  50068. }(t, o["default"].EventTarget), r(t, [{
  50069. key: "resetStats_",
  50070. value: function() {
  50071. this.mediaBytesTransferred = 0, this.mediaRequests = 0, this.mediaRequestsAborted =
  50072. 0, this.mediaRequestsTimedout = 0, this.mediaRequestsErrored = 0, this
  50073. .mediaTransferDuration = 0, this.mediaSecondsLoaded = 0
  50074. }
  50075. }, {
  50076. key: "dispose",
  50077. value: function() {
  50078. this.state = "DISPOSED", this.pause(), this.abort_(), this.sourceUpdater_ && this
  50079. .sourceUpdater_.dispose(), this.resetStats_()
  50080. }
  50081. }, {
  50082. key: "abort",
  50083. value: function() {
  50084. "WAITING" === this.state ? (this.abort_(), this.state = "READY", this.paused() ||
  50085. this.monitorBuffer_()) : this.pendingSegment_ && (this.pendingSegment_ = null)
  50086. }
  50087. }, {
  50088. key: "abort_",
  50089. value: function() {
  50090. this.pendingSegment_ && this.pendingSegment_.abortRequests(), this.pendingSegment_ =
  50091. null
  50092. }
  50093. }, {
  50094. key: "error",
  50095. value: function(e) {
  50096. return void 0 !== e && (this.error_ = e), this.pendingSegment_ = null, this.error_
  50097. }
  50098. }, {
  50099. key: "endOfStream",
  50100. value: function() {
  50101. this.ended_ = !0, this.pause(), this.trigger("ended")
  50102. }
  50103. }, {
  50104. key: "buffered_",
  50105. value: function() {
  50106. return this.sourceUpdater_ ? this.sourceUpdater_.buffered() : o.default
  50107. .createTimeRanges()
  50108. }
  50109. }, {
  50110. key: "initSegment",
  50111. value: function(e) {
  50112. var t = !(arguments.length <= 1 || void 0 === arguments[1]) && arguments[1];
  50113. if (!e) return null;
  50114. var i = (0, h.initSegmentId)(e),
  50115. r = this.initSegments_[i];
  50116. return t && !r && e.bytes && (this.initSegments_[i] = r = {
  50117. resolvedUri: e.resolvedUri,
  50118. byterange: e.byterange,
  50119. bytes: e.bytes
  50120. }), r || e
  50121. }
  50122. }, {
  50123. key: "couldBeginLoading_",
  50124. value: function() {
  50125. return this.playlist_ && (this.sourceUpdater_ || this.mimeType_ && "INIT" === this
  50126. .state) && !this.paused()
  50127. }
  50128. }, {
  50129. key: "load",
  50130. value: function() {
  50131. if (this.monitorBuffer_(), this.playlist_) {
  50132. if (this.syncController_.setDateTimeMapping(this.playlist_), "INIT" === this
  50133. .state && this.couldBeginLoading_()) return this.init_();
  50134. !this.couldBeginLoading_() || "READY" !== this.state && "INIT" !== this.state || (
  50135. this.state = "READY")
  50136. }
  50137. }
  50138. }, {
  50139. key: "init_",
  50140. value: function() {
  50141. return this.state = "READY", this.sourceUpdater_ = new u.default(this.mediaSource_,
  50142. this.mimeType_), this.resetEverything(), this.monitorBuffer_()
  50143. }
  50144. }, {
  50145. key: "playlist",
  50146. value: function(e) {
  50147. var t = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1];
  50148. if (e) {
  50149. var i = this.playlist_,
  50150. r = this.pendingSegment_;
  50151. if (this.playlist_ = e, this.xhrOptions_ = t, this.hasPlayed_() || (e.syncInfo = {
  50152. mediaSequence: e.mediaSequence,
  50153. time: 0
  50154. }), this.trigger("syncinfoupdate"), "INIT" === this.state && this
  50155. .couldBeginLoading_()) return this.init_();
  50156. if (i && i.uri === e.uri) {
  50157. var n = e.mediaSequence - i.mediaSequence;
  50158. this.logger_("mediaSequenceDiff", n), null !== this.mediaIndex && (this
  50159. .mediaIndex -= n), r && (r.mediaIndex -= n, r.mediaIndex >= 0 && (r
  50160. .segment = e.segments[r.mediaIndex])), this.syncController_
  50161. .saveExpiredSegmentInfo(i, e)
  50162. } else null !== this.mediaIndex && this.resyncLoader()
  50163. }
  50164. }
  50165. }, {
  50166. key: "pause",
  50167. value: function() {
  50168. this.checkBufferTimeout_ && (d.default.clearTimeout(this.checkBufferTimeout_), this
  50169. .checkBufferTimeout_ = null)
  50170. }
  50171. }, {
  50172. key: "paused",
  50173. value: function() {
  50174. return null === this.checkBufferTimeout_
  50175. }
  50176. }, {
  50177. key: "mimeType",
  50178. value: function(e) {
  50179. this.mimeType_ || (this.mimeType_ = e, "INIT" === this.state && this
  50180. .couldBeginLoading_() && this.init_())
  50181. }
  50182. }, {
  50183. key: "resetEverything",
  50184. value: function() {
  50185. this.ended_ = !1, this.resetLoader(), this.remove(0, this.duration_()), this
  50186. .trigger("reseteverything")
  50187. }
  50188. }, {
  50189. key: "resetLoader",
  50190. value: function() {
  50191. this.fetchAtBuffer_ = !1, this.resyncLoader()
  50192. }
  50193. }, {
  50194. key: "resyncLoader",
  50195. value: function() {
  50196. this.mediaIndex = null, this.syncPoint_ = null, this.abort()
  50197. }
  50198. }, {
  50199. key: "remove",
  50200. value: function(e, t) {
  50201. this.sourceUpdater_ && this.sourceUpdater_.remove(e, t), (0, c.default)(e, t, this
  50202. .segmentMetadataTrack_)
  50203. }
  50204. }, {
  50205. key: "monitorBuffer_",
  50206. value: function() {
  50207. this.checkBufferTimeout_ && d.default.clearTimeout(this.checkBufferTimeout_), this
  50208. .checkBufferTimeout_ = d.default.setTimeout(this.monitorBufferTick_.bind(this), 1)
  50209. }
  50210. }, {
  50211. key: "monitorBufferTick_",
  50212. value: function() {
  50213. "READY" === this.state && this.fillBuffer_(), this.checkBufferTimeout_ && d.default
  50214. .clearTimeout(this.checkBufferTimeout_), this.checkBufferTimeout_ = d.default
  50215. .setTimeout(this.monitorBufferTick_.bind(this), 500)
  50216. }
  50217. }, {
  50218. key: "fillBuffer_",
  50219. value: function() {
  50220. if (!this.sourceUpdater_.updating()) {
  50221. this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this
  50222. .playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()));
  50223. var e = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this
  50224. .hasPlayed_(), this.currentTime_(), this.syncPoint_);
  50225. if (e) g(this.playlist_, this.mediaSource_, e.mediaIndex) ? this.endOfStream() : (
  50226. e.mediaIndex !== this.playlist_.segments.length - 1 || "ended" !== this
  50227. .mediaSource_.readyState || this.seeking_()) && ((e.timeline !== this
  50228. .currentTimeline_ || null !== e.startOfSegment && e.startOfSegment < this
  50229. .sourceUpdater_.timestampOffset()) && (this.syncController_.reset(), e
  50230. .timestampOffset = e.startOfSegment), this.loadSegment_(e))
  50231. }
  50232. }
  50233. }, {
  50234. key: "checkBuffer_",
  50235. value: function(e, t, i, r, n, a) {
  50236. var o = 0,
  50237. u = void 0;
  50238. e.length && (o = e.end(e.length - 1));
  50239. var l, d = Math.max(0, o - n);
  50240. if (!t.segments.length) return null;
  50241. if (d >= this.goalBufferLength_()) return null;
  50242. if (!r && d >= 1) return null;
  50243. if (this.logger_("checkBuffer_", "mediaIndex:", i, "hasPlayed:", r, "currentTime:",
  50244. n, "syncPoint:", a, "fetchAtBuffer:", this.fetchAtBuffer_, "bufferedTime:", d),
  50245. null === a) return i = this.getSyncSegmentCandidate_(t), this.logger_("getSync",
  50246. "mediaIndex:", i), this.generateSegmentInfo_(t, i, null, !0);
  50247. if (null !== i) {
  50248. this.logger_("walkForward", "mediaIndex:", i + 1);
  50249. var c = t.segments[i];
  50250. return u = c && c.end ? c.end : o, this.generateSegmentInfo_(t, i + 1, u, !1)
  50251. }
  50252. this.fetchAtBuffer_ ? (i = (l = s.default.getMediaInfoForTime(t, o, a.segmentIndex,
  50253. a.time)).mediaIndex, u = l.startTime) : (i = (l = s.default.getMediaInfoForTime(
  50254. t, n, a.segmentIndex, a.time)).mediaIndex, u = l.startTime);
  50255. return this.logger_("getMediaIndexForTime", "mediaIndex:", i, "startOfSegment:", u),
  50256. this.generateSegmentInfo_(t, i, u, !1)
  50257. }
  50258. }, {
  50259. key: "getSyncSegmentCandidate_",
  50260. value: function(e) {
  50261. var t = this;
  50262. if (-1 === this.currentTimeline_) return 0;
  50263. var i = e.segments.map(function(e, t) {
  50264. return {
  50265. timeline: e.timeline,
  50266. segmentIndex: t
  50267. }
  50268. }).filter(function(e) {
  50269. return e.timeline === t.currentTimeline_
  50270. });
  50271. return i.length ? i[Math.min(i.length - 1, 1)].segmentIndex : Math.max(e.segments
  50272. .length - 1, 0)
  50273. }
  50274. }, {
  50275. key: "generateSegmentInfo_",
  50276. value: function(e, t, i, r) {
  50277. if (t < 0 || t >= e.segments.length) return null;
  50278. var n = e.segments[t];
  50279. return {
  50280. requestId: "segment-loader-" + Math.random(),
  50281. uri: n.resolvedUri,
  50282. mediaIndex: t,
  50283. isSyncRequest: r,
  50284. startOfSegment: i,
  50285. playlist: e,
  50286. bytes: null,
  50287. encryptedBytes: null,
  50288. timestampOffset: null,
  50289. timeline: n.timeline,
  50290. duration: n.duration,
  50291. segment: n
  50292. }
  50293. }
  50294. }, {
  50295. key: "abortRequestEarly_",
  50296. value: function(e) {
  50297. if (this.hls_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_
  50298. .attributes.BANDWIDTH) return !1;
  50299. if (Date.now() - (e.firstBytesReceivedAt || Date.now()) < 1e3) return !1;
  50300. var t = this.currentTime_(),
  50301. i = e.bandwidth,
  50302. r = this.pendingSegment_.duration,
  50303. n = s.default.estimateSegmentRequestTime(r, i, this.playlist_, e.bytesReceived),
  50304. a = (0, p.timeUntilRebuffer)(this.buffered_(), t, this.hls_.tech_
  50305. .playbackRate()) - 1;
  50306. if (n <= a) return !1;
  50307. var o = (0, m.minRebufferMaxBandwidthSelector)({
  50308. master: this.hls_.playlists.master,
  50309. currentTime: t,
  50310. bandwidth: i,
  50311. duration: this.duration_(),
  50312. segmentDuration: r,
  50313. timeUntilRebuffer: a,
  50314. currentTimeline: this.currentTimeline_,
  50315. syncController: this.syncController_
  50316. });
  50317. if (o) {
  50318. var u = n - a - o.rebufferingImpact,
  50319. d = .5;
  50320. return a <= p.TIME_FUDGE_FACTOR && (d = 1), !o.playlist || o.playlist.uri === this
  50321. .playlist_.uri || u < d ? !1 : (this.bandwidth = o.playlist.attributes
  50322. .BANDWIDTH * l.default.BANDWIDTH_VARIANCE + 1, this.abort(), this.trigger(
  50323. "earlyabort"), !0)
  50324. }
  50325. }
  50326. }, {
  50327. key: "handleProgress_",
  50328. value: function(e, t) {
  50329. this.pendingSegment_ && t.requestId === this.pendingSegment_.requestId && !this
  50330. .abortRequestEarly_(t.stats) && this.trigger("progress")
  50331. }
  50332. }, {
  50333. key: "loadSegment_",
  50334. value: function(e) {
  50335. this.state = "WAITING", this.pendingSegment_ = e, this.trimBackBuffer_(e), e
  50336. .abortRequests = (0, f.mediaSegmentRequest)(this.hls_.xhr, this.xhrOptions_, this
  50337. .decrypter_, this.createSimplifiedSegmentObj_(e), this.handleProgress_.bind(
  50338. this), this.segmentRequestFinished_.bind(this))
  50339. }
  50340. }, {
  50341. key: "trimBackBuffer_",
  50342. value: function(e) {
  50343. var t = _(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration ||
  50344. 10);
  50345. t > 0 && this.remove(0, t)
  50346. }
  50347. }, {
  50348. key: "createSimplifiedSegmentObj_",
  50349. value: function(e) {
  50350. var t = e.segment,
  50351. i = {
  50352. resolvedUri: t.resolvedUri,
  50353. byterange: t.byterange,
  50354. requestId: e.requestId
  50355. };
  50356. if (t.key) {
  50357. var r = t.key.iv || new Uint32Array([0, 0, 0, e.mediaIndex + e.playlist
  50358. .mediaSequence
  50359. ]);
  50360. i.key = {
  50361. resolvedUri: t.key.resolvedUri,
  50362. iv: r
  50363. }
  50364. }
  50365. return t.map && (i.map = this.initSegment(t.map)), i
  50366. }
  50367. }, {
  50368. key: "segmentRequestFinished_",
  50369. value: function(e, t) {
  50370. if (this.mediaRequests += 1, t.stats && (this.mediaBytesTransferred += t.stats
  50371. .bytesReceived, this.mediaTransferDuration += t.stats.roundTripTime), this
  50372. .pendingSegment_) {
  50373. if (t.requestId === this.pendingSegment_.requestId) {
  50374. if (e) return this.pendingSegment_ = null, this.state = "READY", e.code === f
  50375. .REQUEST_ERRORS.ABORTED ? void(this.mediaRequestsAborted += 1) : (this
  50376. .pause(), e.code === f.REQUEST_ERRORS.TIMEOUT ? (this
  50377. .mediaRequestsTimedout += 1, this.bandwidth = 1, this.roundTrip = NaN,
  50378. void this.trigger("bandwidthupdate")) : (this.mediaRequestsErrored += 1,
  50379. this.error(e), void this.trigger("error")));
  50380. this.bandwidth = t.stats.bandwidth, this.roundTrip = t.stats.roundTripTime, t
  50381. .map && (t.map = this.initSegment(t.map, !0)), this.processSegmentResponse_(t)
  50382. }
  50383. } else this.mediaRequestsAborted += 1
  50384. }
  50385. }, {
  50386. key: "processSegmentResponse_",
  50387. value: function(e) {
  50388. var t = this.pendingSegment_;
  50389. t.bytes = e.bytes, e.map && (t.segment.map.bytes = e.map.bytes), t
  50390. .endOfAllRequests = e.endOfAllRequests, this.handleSegment_()
  50391. }
  50392. }, {
  50393. key: "handleSegment_",
  50394. value: function() {
  50395. var e = this;
  50396. if (this.pendingSegment_) {
  50397. var t = this.pendingSegment_,
  50398. i = t.segment,
  50399. r = this.syncController_.probeSegmentInfo(t);
  50400. void 0 === this.startingMedia_ && r && (r.containsAudio || r.containsVideo) && (
  50401. this.startingMedia_ = {
  50402. containsAudio: r.containsAudio,
  50403. containsVideo: r.containsVideo
  50404. });
  50405. var n = y(this.loaderType_, this.startingMedia_, r);
  50406. if (n) return this.error({
  50407. message: n,
  50408. blacklistDuration: 1 / 0
  50409. }), void this.trigger("error");
  50410. if (t.isSyncRequest) return this.trigger("syncinfoupdate"), this.pendingSegment_ =
  50411. null, void(this.state = "READY");
  50412. null !== t.timestampOffset && t.timestampOffset !== this.sourceUpdater_
  50413. .timestampOffset() && (this.sourceUpdater_.timestampOffset(t.timestampOffset),
  50414. this.trigger("timestampoffset"));
  50415. var a = this.syncController_.mappingForTimeline(t.timeline);
  50416. null !== a && this.trigger({
  50417. type: "segmenttimemapping",
  50418. mapping: a
  50419. }), this.state = "APPENDING", i.map && function() {
  50420. var t = (0, h.initSegmentId)(i.map);
  50421. if (!e.activeInitSegmentId_ || e.activeInitSegmentId_ !== t) {
  50422. var r = e.initSegment(i.map);
  50423. e.sourceUpdater_.appendBuffer(r.bytes, function() {
  50424. e.activeInitSegmentId_ = t
  50425. })
  50426. }
  50427. }(), t.byteLength = t.bytes.byteLength, "number" == typeof i.start &&
  50428. "number" == typeof i.end ? this.mediaSecondsLoaded += i.end - i.start : this
  50429. .mediaSecondsLoaded += i.duration, this.sourceUpdater_.appendBuffer(t.bytes,
  50430. this.handleUpdateEnd_.bind(this))
  50431. } else this.state = "READY"
  50432. }
  50433. }, {
  50434. key: "handleUpdateEnd_",
  50435. value: function() {
  50436. if (this.logger_("handleUpdateEnd_", "segmentInfo:", this.pendingSegment_), !this
  50437. .pendingSegment_) return this.state = "READY", void(this.paused() || this
  50438. .monitorBuffer_());
  50439. var e = this.pendingSegment_,
  50440. t = e.segment,
  50441. i = null !== this.mediaIndex;
  50442. (this.pendingSegment_ = null, this.recordThroughput_(e), this
  50443. .addSegmentMetadataCue_(e), this.state = "READY", this.mediaIndex = e.mediaIndex,
  50444. this.fetchAtBuffer_ = !0, this.currentTimeline_ = e.timeline, this.trigger(
  50445. "syncinfoupdate"), t.end && this.currentTime_() - t.end > 3 * e.playlist
  50446. .targetDuration) ? this.resetEverything(): (i && this.trigger("bandwidthupdate"),
  50447. this.trigger("progress"), g(e.playlist, this.mediaSource_, e.mediaIndex + 1) &&
  50448. this.endOfStream(), this.paused() || this.monitorBuffer_())
  50449. }
  50450. }, {
  50451. key: "recordThroughput_",
  50452. value: function(e) {
  50453. var t = this.throughput.rate,
  50454. i = Date.now() - e.endOfAllRequests + 1,
  50455. r = Math.floor(e.byteLength / i * 8 * 1e3);
  50456. this.throughput.rate += (r - t) / ++this.throughput.count
  50457. }
  50458. }, {
  50459. key: "logger_",
  50460. value: function() {}
  50461. }, {
  50462. key: "addSegmentMetadataCue_",
  50463. value: function(e) {
  50464. if (this.segmentMetadataTrack_) {
  50465. var t = e.segment,
  50466. i = t.start,
  50467. r = t.end;
  50468. if (v(i) && v(r)) {
  50469. (0, c.default)(i, r, this.segmentMetadataTrack_);
  50470. var n = d.default.WebKitDataCue || d.default.VTTCue,
  50471. a = {
  50472. bandwidth: e.playlist.attributes.BANDWIDTH,
  50473. resolution: e.playlist.attributes.RESOLUTION,
  50474. codecs: e.playlist.attributes.CODECS,
  50475. byteLength: e.byteLength,
  50476. uri: e.uri,
  50477. timeline: e.timeline,
  50478. playlist: e.playlist.uri,
  50479. start: i,
  50480. end: r
  50481. },
  50482. s = new n(i, r, JSON.stringify(a));
  50483. s.value = a, this.segmentMetadataTrack_.addCue(s)
  50484. }
  50485. }
  50486. }
  50487. }]), t
  50488. }();
  50489. i.default = b
  50490. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  50491. typeof window ? window : {})
  50492. }, {
  50493. "./bin-utils": 2,
  50494. "./config": 3,
  50495. "./media-segment-request": 7,
  50496. "./playlist": 11,
  50497. "./playlist-selectors": 10,
  50498. "./ranges": 12,
  50499. "./source-updater": 17,
  50500. "global/window": 32,
  50501. "videojs-contrib-media-sources/es5/remove-cues-from-track.js": 72
  50502. }],
  50503. 17: [function(e, t, i) {
  50504. (function(e) {
  50505. "use strict";
  50506. Object.defineProperty(i, "__esModule", {
  50507. value: !0
  50508. });
  50509. var r = function() {
  50510. function e(e, t) {
  50511. for (var i = 0; i < t.length; i++) {
  50512. var r = t[i];
  50513. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  50514. Object.defineProperty(e, r.key, r)
  50515. }
  50516. }
  50517. return function(t, i, r) {
  50518. return i && e(t.prototype, i), r && e(t, r), t
  50519. }
  50520. }();
  50521. var n, a = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null,
  50522. s = (n = a) && n.__esModule ? n : {
  50523. default: n
  50524. },
  50525. o = function() {},
  50526. u = function() {
  50527. function e(t, i) {
  50528. var r = this;
  50529. ! function(e, t) {
  50530. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  50531. }(this, e);
  50532. var n = function() {
  50533. r.sourceBuffer_ = t.addSourceBuffer(i), r.onUpdateendCallback_ = function() {
  50534. var e = r.pendingCallback_;
  50535. r.pendingCallback_ = null, e && e(), r.runCallback_()
  50536. }, r.sourceBuffer_.addEventListener("updateend", r.onUpdateendCallback_), r
  50537. .runCallback_()
  50538. };
  50539. this.callbacks_ = [], this.pendingCallback_ = null, this.timestampOffset_ = 0, this
  50540. .mediaSource = t, this.processedAppend_ = !1, "closed" === t.readyState ? t
  50541. .addEventListener("sourceopen", n) : n()
  50542. }
  50543. return r(e, [{
  50544. key: "abort",
  50545. value: function(e) {
  50546. var t = this;
  50547. this.processedAppend_ && this.queueCallback_(function() {
  50548. t.sourceBuffer_.abort()
  50549. }, e)
  50550. }
  50551. }, {
  50552. key: "appendBuffer",
  50553. value: function(e, t) {
  50554. var i = this;
  50555. this.processedAppend_ = !0, this.queueCallback_(function() {
  50556. i.sourceBuffer_.appendBuffer(e)
  50557. }, t)
  50558. }
  50559. }, {
  50560. key: "buffered",
  50561. value: function() {
  50562. return this.sourceBuffer_ ? this.sourceBuffer_.buffered : s.default
  50563. .createTimeRanges()
  50564. }
  50565. }, {
  50566. key: "remove",
  50567. value: function(e, t) {
  50568. var i = this;
  50569. this.processedAppend_ && this.queueCallback_(function() {
  50570. i.sourceBuffer_.remove(e, t)
  50571. }, o)
  50572. }
  50573. }, {
  50574. key: "updating",
  50575. value: function() {
  50576. return !this.sourceBuffer_ || this.sourceBuffer_.updating || this.pendingCallback_
  50577. }
  50578. }, {
  50579. key: "timestampOffset",
  50580. value: function(e) {
  50581. var t = this;
  50582. return void 0 !== e && (this.queueCallback_(function() {
  50583. t.sourceBuffer_.timestampOffset = e
  50584. }), this.timestampOffset_ = e), this.timestampOffset_
  50585. }
  50586. }, {
  50587. key: "queueCallback_",
  50588. value: function(e, t) {
  50589. this.callbacks_.push([e.bind(this), t]), this.runCallback_()
  50590. }
  50591. }, {
  50592. key: "runCallback_",
  50593. value: function() {
  50594. var e = void 0;
  50595. !this.updating() && this.callbacks_.length && (e = this.callbacks_.shift(), this
  50596. .pendingCallback_ = e[1], e[0]())
  50597. }
  50598. }, {
  50599. key: "dispose",
  50600. value: function() {
  50601. this.sourceBuffer_.removeEventListener("updateend", this.onUpdateendCallback_), this
  50602. .sourceBuffer_ && "open" === this.mediaSource.readyState && this.sourceBuffer_
  50603. .abort()
  50604. }
  50605. }]), e
  50606. }();
  50607. i.default = u, t.exports = i.default
  50608. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  50609. typeof window ? window : {})
  50610. }, {}],
  50611. 18: [function(e, t, i) {
  50612. (function(t) {
  50613. "use strict";
  50614. Object.defineProperty(i, "__esModule", {
  50615. value: !0
  50616. });
  50617. var r = function() {
  50618. function e(e, t) {
  50619. for (var i = 0; i < t.length; i++) {
  50620. var r = t[i];
  50621. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  50622. Object.defineProperty(e, r.key, r)
  50623. }
  50624. }
  50625. return function(t, i, r) {
  50626. return i && e(t.prototype, i), r && e(t, r), t
  50627. }
  50628. }(),
  50629. n = function(e, t, i) {
  50630. for (var r = !0; r;) {
  50631. var n = e,
  50632. a = t,
  50633. s = i;
  50634. r = !1, null === n && (n = Function.prototype);
  50635. var o = Object.getOwnPropertyDescriptor(n, a);
  50636. if (void 0 !== o) {
  50637. if ("value" in o) return o.value;
  50638. var u = o.get;
  50639. if (void 0 === u) return;
  50640. return u.call(s)
  50641. }
  50642. var l = Object.getPrototypeOf(n);
  50643. if (null === l) return;
  50644. e = l, t = a, i = s, r = !0, o = l = void 0
  50645. }
  50646. };
  50647. function a(e) {
  50648. return e && e.__esModule ? e : {
  50649. default: e
  50650. }
  50651. }
  50652. var s = a(e("mux.js/lib/mp4/probe")),
  50653. o = e("mux.js/lib/tools/ts-inspector.js"),
  50654. u = e("./playlist"),
  50655. l = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null),
  50656. d = [{
  50657. name: "VOD",
  50658. run: function(e, t, i, r, n) {
  50659. if (i !== 1 / 0) {
  50660. return {
  50661. time: 0,
  50662. segmentIndex: 0
  50663. }
  50664. }
  50665. return null
  50666. }
  50667. }, {
  50668. name: "ProgramDateTime",
  50669. run: function(e, t, i, r, n) {
  50670. return e.datetimeToDisplayTime && t.dateTimeObject ? {
  50671. time: t.dateTimeObject.getTime() / 1e3 + e.datetimeToDisplayTime,
  50672. segmentIndex: 0
  50673. } : null
  50674. }
  50675. }, {
  50676. name: "Segment",
  50677. run: function(e, t, i, r, n) {
  50678. var a = t.segments || [],
  50679. s = null,
  50680. o = null;
  50681. n = n || 0;
  50682. for (var u = 0; u < a.length; u++) {
  50683. var l = a[u];
  50684. if (l.timeline === r && void 0 !== l.start) {
  50685. var d = Math.abs(n - l.start);
  50686. if (null !== o && o < d) break;
  50687. (!s || null === o || o >= d) && (o = d, s = {
  50688. time: l.start,
  50689. segmentIndex: u
  50690. })
  50691. }
  50692. }
  50693. return s
  50694. }
  50695. }, {
  50696. name: "Discontinuity",
  50697. run: function(e, t, i, r, n) {
  50698. var a = null;
  50699. if (n = n || 0, t.discontinuityStarts && t.discontinuityStarts.length)
  50700. for (var s = null, o = 0; o < t.discontinuityStarts.length; o++) {
  50701. var u = t.discontinuityStarts[o],
  50702. l = t.discontinuitySequence + o + 1,
  50703. d = e.discontinuities[l];
  50704. if (d) {
  50705. var c = Math.abs(n - d.time);
  50706. if (null !== s && s < c) break;
  50707. (!a || null === s || s >= c) && (s = c, a = {
  50708. time: d.time,
  50709. segmentIndex: u
  50710. })
  50711. }
  50712. }
  50713. return a
  50714. }
  50715. }, {
  50716. name: "Playlist",
  50717. run: function(e, t, i, r, n) {
  50718. return t.syncInfo ? {
  50719. time: t.syncInfo.time,
  50720. segmentIndex: t.syncInfo.mediaSequence - t.mediaSequence
  50721. } : null
  50722. }
  50723. }];
  50724. i.syncPointStrategies = d;
  50725. var c = function(e) {
  50726. function t() {
  50727. var e = arguments.length <= 0 || void 0 === arguments[0] ? {} : arguments[0];
  50728. ! function(e, t) {
  50729. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  50730. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), this
  50731. .inspectCache_ = void 0, this.timelines = [], this.discontinuities = [], this
  50732. .datetimeToDisplayTime = null, e.debug && (this.logger_ = l.default.log.bind(l.default,
  50733. "sync-controller ->"))
  50734. }
  50735. return function(e, t) {
  50736. if ("function" != typeof t && null !== t) throw new TypeError(
  50737. "Super expression must either be null or a function, not " + typeof t);
  50738. e.prototype = Object.create(t && t.prototype, {
  50739. constructor: {
  50740. value: e,
  50741. enumerable: !1,
  50742. writable: !0,
  50743. configurable: !0
  50744. }
  50745. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  50746. }(t, l["default"].EventTarget), r(t, [{
  50747. key: "getSyncPoint",
  50748. value: function(e, t, i, r) {
  50749. var n = this.runStrategies_(e, t, i, r);
  50750. return n.length ? this.selectSyncPoint_(n, {
  50751. key: "time",
  50752. value: r
  50753. }) : null
  50754. }
  50755. }, {
  50756. key: "getExpiredTime",
  50757. value: function(e, t) {
  50758. if (!e || !e.segments) return null;
  50759. var i = this.runStrategies_(e, t, e.discontinuitySequence, 0);
  50760. if (!i.length) return null;
  50761. var r = this.selectSyncPoint_(i, {
  50762. key: "segmentIndex",
  50763. value: 0
  50764. });
  50765. return r.segmentIndex > 0 && (r.time *= -1), Math.abs(r.time + (0, u.sumDurations)(
  50766. e, r.segmentIndex, 0))
  50767. }
  50768. }, {
  50769. key: "runStrategies_",
  50770. value: function(e, t, i, r) {
  50771. for (var n = [], a = 0; a < d.length; a++) {
  50772. var s = d[a],
  50773. o = s.run(this, e, t, i, r);
  50774. o && (o.strategy = s.name, n.push({
  50775. strategy: s.name,
  50776. syncPoint: o
  50777. }), this.logger_("syncPoint found via <" + s.name + ">:", o))
  50778. }
  50779. return n
  50780. }
  50781. }, {
  50782. key: "selectSyncPoint_",
  50783. value: function(e, t) {
  50784. for (var i = e[0].syncPoint, r = Math.abs(e[0].syncPoint[t.key] - t.value), n = e[0]
  50785. .strategy, a = 1; a < e.length; a++) {
  50786. var s = Math.abs(e[a].syncPoint[t.key] - t.value);
  50787. s < r && (r = s, i = e[a].syncPoint, n = e[a].strategy)
  50788. }
  50789. return this.logger_("syncPoint with strategy <" + n + "> chosen: ", i), i
  50790. }
  50791. }, {
  50792. key: "saveExpiredSegmentInfo",
  50793. value: function(e, t) {
  50794. for (var i = t.mediaSequence - e.mediaSequence - 1; i >= 0; i--) {
  50795. var r = e.segments[i];
  50796. if (r && void 0 !== r.start) {
  50797. t.syncInfo = {
  50798. mediaSequence: e.mediaSequence + i,
  50799. time: r.start
  50800. }, this.logger_("playlist sync:", t.syncInfo), this.trigger("syncinfoupdate");
  50801. break
  50802. }
  50803. }
  50804. }
  50805. }, {
  50806. key: "setDateTimeMapping",
  50807. value: function(e) {
  50808. if (!this.datetimeToDisplayTime && e.dateTimeObject) {
  50809. var t = e.dateTimeObject.getTime() / 1e3;
  50810. this.datetimeToDisplayTime = -t
  50811. }
  50812. }
  50813. }, {
  50814. key: "reset",
  50815. value: function() {
  50816. this.inspectCache_ = void 0
  50817. }
  50818. }, {
  50819. key: "probeSegmentInfo",
  50820. value: function(e) {
  50821. var t = e.segment,
  50822. i = e.playlist,
  50823. r = void 0;
  50824. return (r = t.map ? this.probeMp4Segment_(e) : this.probeTsSegment_(e)) && this
  50825. .calculateSegmentTimeMapping_(e, r) && (this.saveDiscontinuitySyncInfo_(e), i
  50826. .syncInfo || (i.syncInfo = {
  50827. mediaSequence: i.mediaSequence + e.mediaIndex,
  50828. time: t.start
  50829. })), r
  50830. }
  50831. }, {
  50832. key: "probeMp4Segment_",
  50833. value: function(e) {
  50834. var t = e.segment,
  50835. i = s.default.timescale(t.map.bytes),
  50836. r = s.default.startTime(i, e.bytes);
  50837. return null !== e.timestampOffset && (e.timestampOffset -= r), {
  50838. start: r,
  50839. end: r + t.duration
  50840. }
  50841. }
  50842. }, {
  50843. key: "probeTsSegment_",
  50844. value: function(e) {
  50845. var t = (0, o.inspect)(e.bytes, this.inspectCache_),
  50846. i = void 0,
  50847. r = void 0;
  50848. return t ? (t.video && 2 === t.video.length ? (this.inspectCache_ = t.video[1].dts,
  50849. i = t.video[0].dtsTime, r = t.video[1].dtsTime) : t.audio && 2 === t.audio
  50850. .length && (this.inspectCache_ = t.audio[1].dts, i = t.audio[0].dtsTime, r = t
  50851. .audio[1].dtsTime), {
  50852. start: i,
  50853. end: r,
  50854. containsVideo: t.video && 2 === t.video.length,
  50855. containsAudio: t.audio && 2 === t.audio.length
  50856. }) : null
  50857. }
  50858. }, {
  50859. key: "timestampOffsetForTimeline",
  50860. value: function(e) {
  50861. return void 0 === this.timelines[e] ? null : this.timelines[e].time
  50862. }
  50863. }, {
  50864. key: "mappingForTimeline",
  50865. value: function(e) {
  50866. return void 0 === this.timelines[e] ? null : this.timelines[e].mapping
  50867. }
  50868. }, {
  50869. key: "calculateSegmentTimeMapping_",
  50870. value: function(e, t) {
  50871. var i = e.segment,
  50872. r = this.timelines[e.timeline];
  50873. if (null !== e.timestampOffset) this.logger_("tsO:", e.timestampOffset), r = {
  50874. time: e.startOfSegment,
  50875. mapping: e.startOfSegment - t.start
  50876. }, this.timelines[e.timeline] = r, this.trigger("timestampoffset"), i.start = e
  50877. .startOfSegment, i.end = t.end + r.mapping;
  50878. else {
  50879. if (!r) return !1;
  50880. i.start = t.start + r.mapping, i.end = t.end + r.mapping
  50881. }
  50882. return !0
  50883. }
  50884. }, {
  50885. key: "saveDiscontinuitySyncInfo_",
  50886. value: function(e) {
  50887. var t = e.playlist,
  50888. i = e.segment;
  50889. if (i.discontinuity) this.discontinuities[i.timeline] = {
  50890. time: i.start,
  50891. accuracy: 0
  50892. };
  50893. else if (t.discontinuityStarts.length)
  50894. for (var r = 0; r < t.discontinuityStarts.length; r++) {
  50895. var n = t.discontinuityStarts[r],
  50896. a = t.discontinuitySequence + r + 1,
  50897. s = n - e.mediaIndex,
  50898. o = Math.abs(s);
  50899. if (!this.discontinuities[a] || this.discontinuities[a].accuracy > o) {
  50900. var l = void 0;
  50901. l = s < 0 ? i.start - (0, u.sumDurations)(t, e.mediaIndex, n) : i.end + (0, u
  50902. .sumDurations)(t, e.mediaIndex + 1, n), this.discontinuities[a] = {
  50903. time: l,
  50904. accuracy: o
  50905. }
  50906. }
  50907. }
  50908. }
  50909. }, {
  50910. key: "logger_",
  50911. value: function() {}
  50912. }]), t
  50913. }();
  50914. i.default = c
  50915. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  50916. typeof window ? window : {})
  50917. }, {
  50918. "./playlist": 11,
  50919. "mux.js/lib/mp4/probe": 57,
  50920. "mux.js/lib/tools/ts-inspector.js": 59
  50921. }],
  50922. 19: [function(e, t, i) {
  50923. "use strict";
  50924. Object.defineProperty(i, "__esModule", {
  50925. value: !0
  50926. });
  50927. i.parseCodecs = function() {
  50928. var e, t = arguments.length <= 0 || void 0 === arguments[0] ? "" : arguments[0],
  50929. i = {
  50930. codecCount: 0
  50931. };
  50932. return i.codecCount = t.split(",").length, i.codecCount = i.codecCount || 2, (e =
  50933. /(^|\s|,)+(avc1)([^ ,]*)/i.exec(t)) && (i.videoCodec = e[2], i.videoObjectTypeIndicator = e[3]),
  50934. i.audioProfile = /(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(t), i.audioProfile = i
  50935. .audioProfile && i.audioProfile[2], i
  50936. }
  50937. }, {}],
  50938. 20: [function(e, t, i) {
  50939. (function(r) {
  50940. "use strict";
  50941. Object.defineProperty(i, "__esModule", {
  50942. value: !0
  50943. });
  50944. var n = function() {
  50945. function e(e, t) {
  50946. for (var i = 0; i < t.length; i++) {
  50947. var r = t[i];
  50948. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  50949. Object.defineProperty(e, r.key, r)
  50950. }
  50951. }
  50952. return function(t, i, r) {
  50953. return i && e(t.prototype, i), r && e(t, r), t
  50954. }
  50955. }(),
  50956. a = function(e, t, i) {
  50957. for (var r = !0; r;) {
  50958. var n = e,
  50959. a = t,
  50960. s = i;
  50961. r = !1, null === n && (n = Function.prototype);
  50962. var o = Object.getOwnPropertyDescriptor(n, a);
  50963. if (void 0 !== o) {
  50964. if ("value" in o) return o.value;
  50965. var u = o.get;
  50966. if (void 0 === u) return;
  50967. return u.call(s)
  50968. }
  50969. var l = Object.getPrototypeOf(n);
  50970. if (null === l) return;
  50971. e = l, t = a, i = s, r = !0, o = l = void 0
  50972. }
  50973. };
  50974. function s(e) {
  50975. return e && e.__esModule ? e : {
  50976. default: e
  50977. }
  50978. }
  50979. var o = s(e("./segment-loader")),
  50980. u = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null),
  50981. l = s(e("global/window")),
  50982. d = s(e("videojs-contrib-media-sources/es5/remove-cues-from-track.js")),
  50983. c = e("./bin-utils"),
  50984. h = new Uint8Array("\n\n".split("").map(function(e) {
  50985. return e.charCodeAt(0)
  50986. })),
  50987. f = function(e) {
  50988. return String.fromCharCode.apply(null, e)
  50989. },
  50990. p = function(e) {
  50991. function t(e) {
  50992. var i = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1];
  50993. ! function(e, t) {
  50994. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  50995. }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, e, i), this
  50996. .mediaSource_ = null, this.subtitlesTrack_ = null
  50997. }
  50998. return function(e, t) {
  50999. if ("function" != typeof t && null !== t) throw new TypeError(
  51000. "Super expression must either be null or a function, not " + typeof t);
  51001. e.prototype = Object.create(t && t.prototype, {
  51002. constructor: {
  51003. value: e,
  51004. enumerable: !1,
  51005. writable: !0,
  51006. configurable: !0
  51007. }
  51008. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  51009. }(t, o["default"]), n(t, [{
  51010. key: "buffered_",
  51011. value: function() {
  51012. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues.length) return u.default
  51013. .createTimeRanges();
  51014. var e = this.subtitlesTrack_.cues,
  51015. t = e[0].startTime,
  51016. i = e[e.length - 1].startTime;
  51017. return u.default.createTimeRanges([
  51018. [t, i]
  51019. ])
  51020. }
  51021. }, {
  51022. key: "initSegment",
  51023. value: function(e) {
  51024. var t = !(arguments.length <= 1 || void 0 === arguments[1]) && arguments[1];
  51025. if (!e) return null;
  51026. var i = (0, c.initSegmentId)(e),
  51027. r = this.initSegments_[i];
  51028. if (t && !r && e.bytes) {
  51029. var n = h.byteLength + e.bytes.byteLength,
  51030. a = new Uint8Array(n);
  51031. a.set(e.bytes), a.set(h, e.bytes.byteLength), this.initSegments_[i] = r = {
  51032. resolvedUri: e.resolvedUri,
  51033. byterange: e.byterange,
  51034. bytes: a
  51035. }
  51036. }
  51037. return r || e
  51038. }
  51039. }, {
  51040. key: "couldBeginLoading_",
  51041. value: function() {
  51042. return this.playlist_ && this.subtitlesTrack_ && !this.paused()
  51043. }
  51044. }, {
  51045. key: "init_",
  51046. value: function() {
  51047. return this.state = "READY", this.resetEverything(), this.monitorBuffer_()
  51048. }
  51049. }, {
  51050. key: "track",
  51051. value: function(e) {
  51052. return void 0 === e ? this.subtitlesTrack_ : (this.subtitlesTrack_ = e, "INIT" ===
  51053. this.state && this.couldBeginLoading_() && this.init_(), this.subtitlesTrack_)
  51054. }
  51055. }, {
  51056. key: "remove",
  51057. value: function(e, t) {
  51058. (0, d.default)(e, t, this.subtitlesTrack_)
  51059. }
  51060. }, {
  51061. key: "fillBuffer_",
  51062. value: function() {
  51063. var e = this;
  51064. this.syncPoint_ || (this.syncPoint_ = this.syncController_.getSyncPoint(this
  51065. .playlist_, this.duration_(), this.currentTimeline_, this.currentTime_()));
  51066. var t = this.checkBuffer_(this.buffered_(), this.playlist_, this.mediaIndex, this
  51067. .hasPlayed_(), this.currentTime_(), this.syncPoint_);
  51068. if (t = this.skipEmptySegments_(t)) {
  51069. if (null === this.syncController_.timestampOffsetForTimeline(t.timeline)) {
  51070. return this.syncController_.one("timestampoffset", function() {
  51071. e.state = "READY", e.paused() || e.monitorBuffer_()
  51072. }), void(this.state = "WAITING_ON_TIMELINE")
  51073. }
  51074. this.loadSegment_(t)
  51075. }
  51076. }
  51077. }, {
  51078. key: "skipEmptySegments_",
  51079. value: function(e) {
  51080. for (; e && e.segment.empty;) e = this.generateSegmentInfo_(e.playlist, e
  51081. .mediaIndex + 1, e.startOfSegment + e.duration, e.isSyncRequest);
  51082. return e
  51083. }
  51084. }, {
  51085. key: "handleSegment_",
  51086. value: function() {
  51087. var e = this;
  51088. if (this.pendingSegment_ && this.subtitlesTrack_) {
  51089. this.state = "APPENDING";
  51090. var t, i = this.pendingSegment_,
  51091. r = i.segment;
  51092. if ("function" != typeof l.default.WebVTT && this.subtitlesTrack_ && this
  51093. .subtitlesTrack_.tech_) {
  51094. var n = (t = function() {
  51095. e.handleSegment_()
  51096. }, e.state = "WAITING_ON_VTTJS", e.subtitlesTrack_.tech_.one("vttjsloaded",
  51097. t), e.subtitlesTrack_.tech_.one("vttjserror", function() {
  51098. e.subtitlesTrack_.tech_.off("vttjsloaded", t), e.error({
  51099. message: "Error loading vtt.js"
  51100. }), e.state = "READY", e.pause(), e.trigger("error")
  51101. }), {
  51102. v: void 0
  51103. });
  51104. if ("object" == typeof n) return n.v
  51105. }
  51106. r.requested = !0;
  51107. try {
  51108. this.parseVTTCues_(i)
  51109. } catch (e) {
  51110. return this.error({
  51111. message: e.message
  51112. }), this.state = "READY", this.pause(), this.trigger("error")
  51113. }
  51114. if (this.updateTimeMapping_(i, this.syncController_.timelines[i.timeline], this
  51115. .playlist_), i.isSyncRequest) return this.trigger("syncinfoupdate"), this
  51116. .pendingSegment_ = null, void(this.state = "READY");
  51117. i.byteLength = i.bytes.byteLength, this.mediaSecondsLoaded += r.duration, i.cues
  51118. .length && this.remove(i.cues[0].endTime, i.cues[i.cues.length - 1].endTime), i
  51119. .cues.forEach(function(t) {
  51120. e.subtitlesTrack_.addCue(t)
  51121. }), this.handleUpdateEnd_()
  51122. } else this.state = "READY"
  51123. }
  51124. }, {
  51125. key: "parseVTTCues_",
  51126. value: function(e) {
  51127. var t = void 0,
  51128. i = !1;
  51129. "function" == typeof l.default.TextDecoder ? t = new l.default.TextDecoder("utf8") :
  51130. (t = l.default.WebVTT.StringDecoder(), i = !0);
  51131. var r = new l.default.WebVTT.Parser(l.default, l.default.vttjs, t);
  51132. if (e.cues = [], e.timestampmap = {
  51133. MPEGTS: 0,
  51134. LOCAL: 0
  51135. }, r.oncue = e.cues.push.bind(e.cues), r.ontimestampmap = function(t) {
  51136. return e.timestampmap = t
  51137. }, r.onparsingerror = function(e) {
  51138. u.default.log.warn("Error encountered when parsing cues: " + e.message)
  51139. }, e.segment.map) {
  51140. var n = e.segment.map.bytes;
  51141. i && (n = f(n)), r.parse(n)
  51142. }
  51143. var a = e.bytes;
  51144. i && (a = f(a)), r.parse(a), r.flush()
  51145. }
  51146. }, {
  51147. key: "updateTimeMapping_",
  51148. value: function(e, t, i) {
  51149. var r = e.segment;
  51150. if (t)
  51151. if (e.cues.length) {
  51152. var n = e.timestampmap,
  51153. a = n.MPEGTS / 9e4 - n.LOCAL + t.mapping;
  51154. if (e.cues.forEach(function(e) {
  51155. e.startTime += a, e.endTime += a
  51156. }), !i.syncInfo) {
  51157. var s = e.cues[0].startTime,
  51158. o = e.cues[e.cues.length - 1].startTime;
  51159. i.syncInfo = {
  51160. mediaSequence: i.mediaSequence + e.mediaIndex,
  51161. time: Math.min(s, o - r.duration)
  51162. }
  51163. }
  51164. } else r.empty = !0
  51165. }
  51166. }]), t
  51167. }();
  51168. i.default = p, t.exports = i.default
  51169. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  51170. typeof window ? window : {})
  51171. }, {
  51172. "./bin-utils": 2,
  51173. "./segment-loader": 16,
  51174. "global/window": 32,
  51175. "videojs-contrib-media-sources/es5/remove-cues-from-track.js": 72
  51176. }],
  51177. 21: [function(e, t, i) {
  51178. (function(e) {
  51179. "use strict";
  51180. Object.defineProperty(i, "__esModule", {
  51181. value: !0
  51182. });
  51183. var r, n = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null,
  51184. a = (r = n) && r.__esModule ? r : {
  51185. default: r
  51186. };
  51187. i.default = function() {
  51188. return function e(t, i) {
  51189. t = (0, n.mergeOptions)({
  51190. timeout: 45e3
  51191. }, t);
  51192. var r = e.beforeRequest || a.default.Hls.xhr.beforeRequest;
  51193. if (r && "function" == typeof r) {
  51194. var s = r(t);
  51195. s && (t = s)
  51196. }
  51197. var o = (0, n.xhr)(t, function(e, t) {
  51198. var r = o.response;
  51199. !e && r && (o.responseTime = Date.now(), o.roundTripTime = o.responseTime - o
  51200. .requestTime, o.bytesReceived = r.byteLength || r.length, o.bandwidth || (o
  51201. .bandwidth = Math.floor(o.bytesReceived / o.roundTripTime * 8 * 1e3))), e &&
  51202. "ETIMEDOUT" === e.code && (o.timedout = !0), e || o.aborted || 200 === t
  51203. .statusCode || 206 === t.statusCode || 0 === t.statusCode || (e = new Error(
  51204. "XHR Failed with a response of: " + (o && (r || o.responseText)))), i(e, o)
  51205. }),
  51206. u = o.abort;
  51207. return o.abort = function() {
  51208. return o.aborted = !0, u.apply(o, arguments)
  51209. }, o.uri = t.uri, o.requestTime = Date.now(), o
  51210. }
  51211. }, t.exports = i.default
  51212. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  51213. typeof window ? window : {})
  51214. }, {}],
  51215. 22: [function(e, t, i) {
  51216. "use strict";
  51217. Object.defineProperty(i, "__esModule", {
  51218. value: !0
  51219. });
  51220. var r = function() {
  51221. function e(e, t) {
  51222. for (var i = 0; i < t.length; i++) {
  51223. var r = t[i];
  51224. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51225. Object.defineProperty(e, r.key, r)
  51226. }
  51227. }
  51228. return function(t, i, r) {
  51229. return i && e(t.prototype, i), r && e(t, r), t
  51230. }
  51231. }();
  51232. var n = function() {
  51233. var e = [
  51234. [
  51235. [],
  51236. [],
  51237. [],
  51238. [],
  51239. []
  51240. ],
  51241. [
  51242. [],
  51243. [],
  51244. [],
  51245. [],
  51246. []
  51247. ]
  51248. ],
  51249. t = e[0],
  51250. i = e[1],
  51251. r = t[4],
  51252. n = i[4],
  51253. a = void 0,
  51254. s = void 0,
  51255. o = void 0,
  51256. u = [],
  51257. l = [],
  51258. d = void 0,
  51259. c = void 0,
  51260. h = void 0,
  51261. f = void 0,
  51262. p = void 0;
  51263. for (a = 0; a < 256; a++) l[(u[a] = a << 1 ^ 283 * (a >> 7)) ^ a] = a;
  51264. for (s = o = 0; !r[s]; s ^= d || 1, o = l[o] || 1)
  51265. for (h = (h = o ^ o << 1 ^ o << 2 ^ o << 3 ^ o << 4) >> 8 ^ 255 & h ^ 99, r[s] = h, n[h] = s, p =
  51266. 16843009 * u[c = u[d = u[s]]] ^ 65537 * c ^ 257 * d ^ 16843008 * s, f = 257 * u[h] ^ 16843008 *
  51267. h, a = 0; a < 4; a++) t[a][s] = f = f << 24 ^ f >>> 8, i[a][h] = p = p << 24 ^ p >>> 8;
  51268. for (a = 0; a < 5; a++) t[a] = t[a].slice(0), i[a] = i[a].slice(0);
  51269. return e
  51270. },
  51271. a = null,
  51272. s = function() {
  51273. function e(t) {
  51274. ! function(e, t) {
  51275. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51276. }(this, e), a || (a = n()), this._tables = [
  51277. [a[0][0].slice(), a[0][1].slice(), a[0][2].slice(), a[0][3].slice(), a[0][4].slice()],
  51278. [a[1][0].slice(), a[1][1].slice(), a[1][2].slice(), a[1][3].slice(), a[1][4].slice()]
  51279. ];
  51280. var i = void 0,
  51281. r = void 0,
  51282. s = void 0,
  51283. o = void 0,
  51284. u = void 0,
  51285. l = this._tables[0][4],
  51286. d = this._tables[1],
  51287. c = t.length,
  51288. h = 1;
  51289. if (4 !== c && 6 !== c && 8 !== c) throw new Error("Invalid aes key size");
  51290. for (o = t.slice(0), u = [], this._key = [o, u], i = c; i < 4 * c + 28; i++) s = o[i - 1], (i %
  51291. c == 0 || 8 === c && i % c == 4) && (s = l[s >>> 24] << 24 ^ l[s >> 16 & 255] << 16 ^ l[s >>
  51292. 8 & 255] << 8 ^ l[255 & s], i % c == 0 && (s = s << 8 ^ s >>> 24 ^ h << 24, h = h << 1 ^
  51293. 283 * (h >> 7))), o[i] = o[i - c] ^ s;
  51294. for (r = 0; i; r++, i--) s = o[3 & r ? i : i - 4], u[r] = i <= 4 || r < 4 ? s : d[0][l[s >>>
  51295. 24]] ^ d[1][l[s >> 16 & 255]] ^ d[2][l[s >> 8 & 255]] ^ d[3][l[255 & s]]
  51296. }
  51297. return r(e, [{
  51298. key: "decrypt",
  51299. value: function(e, t, i, r, n, a) {
  51300. var s = this._key[1],
  51301. o = e ^ s[0],
  51302. u = r ^ s[1],
  51303. l = i ^ s[2],
  51304. d = t ^ s[3],
  51305. c = void 0,
  51306. h = void 0,
  51307. f = void 0,
  51308. p = s.length / 4 - 2,
  51309. m = void 0,
  51310. g = 4,
  51311. v = this._tables[1],
  51312. y = v[0],
  51313. _ = v[1],
  51314. b = v[2],
  51315. w = v[3],
  51316. E = v[4];
  51317. for (m = 0; m < p; m++) c = y[o >>> 24] ^ _[u >> 16 & 255] ^ b[l >> 8 & 255] ^ w[255 &
  51318. d] ^ s[g], h = y[u >>> 24] ^ _[l >> 16 & 255] ^ b[d >> 8 & 255] ^ w[255 & o] ^ s[g +
  51319. 1], f = y[l >>> 24] ^ _[d >> 16 & 255] ^ b[o >> 8 & 255] ^ w[255 & u] ^ s[g + 2],
  51320. d = y[d >>> 24] ^ _[o >> 16 & 255] ^ b[u >> 8 & 255] ^ w[255 & l] ^ s[g + 3], g += 4,
  51321. o = c, u = h, l = f;
  51322. for (m = 0; m < 4; m++) n[(3 & -m) + a] = E[o >>> 24] << 24 ^ E[u >> 16 & 255] << 16 ^
  51323. E[l >> 8 & 255] << 8 ^ E[255 & d] ^ s[g++], c = o, o = u, u = l, l = d, d = c
  51324. }
  51325. }]), e
  51326. }();
  51327. i.default = s, t.exports = i.default
  51328. }, {}],
  51329. 23: [function(e, t, i) {
  51330. "use strict";
  51331. Object.defineProperty(i, "__esModule", {
  51332. value: !0
  51333. });
  51334. var r = function() {
  51335. function e(e, t) {
  51336. for (var i = 0; i < t.length; i++) {
  51337. var r = t[i];
  51338. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51339. Object.defineProperty(e, r.key, r)
  51340. }
  51341. }
  51342. return function(t, i, r) {
  51343. return i && e(t.prototype, i), r && e(t, r), t
  51344. }
  51345. }(),
  51346. n = function(e, t, i) {
  51347. for (var r = !0; r;) {
  51348. var n = e,
  51349. a = t,
  51350. s = i;
  51351. r = !1, null === n && (n = Function.prototype);
  51352. var o = Object.getOwnPropertyDescriptor(n, a);
  51353. if (void 0 !== o) {
  51354. if ("value" in o) return o.value;
  51355. var u = o.get;
  51356. if (void 0 === u) return;
  51357. return u.call(s)
  51358. }
  51359. var l = Object.getPrototypeOf(n);
  51360. if (null === l) return;
  51361. e = l, t = a, i = s, r = !0, o = l = void 0
  51362. }
  51363. };
  51364. var a, s = e("./stream"),
  51365. o = (a = s) && a.__esModule ? a : {
  51366. default: a
  51367. },
  51368. u = function(e) {
  51369. function t() {
  51370. ! function(e, t) {
  51371. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51372. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, o.default), this
  51373. .jobs = [], this.delay = 1, this.timeout_ = null
  51374. }
  51375. return function(e, t) {
  51376. if ("function" != typeof t && null !== t) throw new TypeError(
  51377. "Super expression must either be null or a function, not " + typeof t);
  51378. e.prototype = Object.create(t && t.prototype, {
  51379. constructor: {
  51380. value: e,
  51381. enumerable: !1,
  51382. writable: !0,
  51383. configurable: !0
  51384. }
  51385. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  51386. }(t, o["default"]), r(t, [{
  51387. key: "processJob_",
  51388. value: function() {
  51389. this.jobs.shift()(), this.jobs.length ? this.timeout_ = setTimeout(this.processJob_
  51390. .bind(this), this.delay) : this.timeout_ = null
  51391. }
  51392. }, {
  51393. key: "push",
  51394. value: function(e) {
  51395. this.jobs.push(e), this.timeout_ || (this.timeout_ = setTimeout(this.processJob_.bind(
  51396. this), this.delay))
  51397. }
  51398. }]), t
  51399. }();
  51400. i.default = u, t.exports = i.default
  51401. }, {
  51402. "./stream": 26
  51403. }],
  51404. 24: [function(e, t, i) {
  51405. "use strict";
  51406. Object.defineProperty(i, "__esModule", {
  51407. value: !0
  51408. });
  51409. var r = function() {
  51410. function e(e, t) {
  51411. for (var i = 0; i < t.length; i++) {
  51412. var r = t[i];
  51413. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51414. Object.defineProperty(e, r.key, r)
  51415. }
  51416. }
  51417. return function(t, i, r) {
  51418. return i && e(t.prototype, i), r && e(t, r), t
  51419. }
  51420. }();
  51421. function n(e) {
  51422. return e && e.__esModule ? e : {
  51423. default: e
  51424. }
  51425. }
  51426. var a = n(e("./aes")),
  51427. s = n(e("./async-stream")),
  51428. o = e("pkcs7"),
  51429. u = function(e) {
  51430. return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
  51431. },
  51432. l = function(e, t, i) {
  51433. var r = new Int32Array(e.buffer, e.byteOffset, e.byteLength >> 2),
  51434. n = new a.default(Array.prototype.slice.call(t)),
  51435. s = new Uint8Array(e.byteLength),
  51436. o = new Int32Array(s.buffer),
  51437. l = void 0,
  51438. d = void 0,
  51439. c = void 0,
  51440. h = void 0,
  51441. f = void 0,
  51442. p = void 0,
  51443. m = void 0,
  51444. g = void 0,
  51445. v = void 0;
  51446. for (l = i[0], d = i[1], c = i[2], h = i[3], v = 0; v < r.length; v += 4) f = u(r[v]), p = u(r[v +
  51447. 1]), m = u(r[v + 2]), g = u(r[v + 3]), n.decrypt(f, p, m, g, o, v), o[v] = u(o[v] ^ l), o[v +
  51448. 1] = u(o[v + 1] ^ d), o[v + 2] = u(o[v + 2] ^ c), o[v + 3] = u(o[v + 3] ^ h), l = f, d = p, c = m,
  51449. h = g;
  51450. return s
  51451. };
  51452. i.decrypt = l;
  51453. var d = function() {
  51454. function e(t, i, r, n) {
  51455. ! function(e, t) {
  51456. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51457. }(this, e);
  51458. var a = e.STEP,
  51459. l = new Int32Array(t.buffer),
  51460. d = new Uint8Array(t.byteLength),
  51461. c = 0;
  51462. for (this.asyncStream_ = new s.default, this.asyncStream_.push(this.decryptChunk_(l.subarray(c,
  51463. c + a), i, r, d)), c = a; c < l.length; c += a) r = new Uint32Array([u(l[c - 4]), u(l[c - 3]),
  51464. u(l[c - 2]), u(l[c - 1])
  51465. ]), this.asyncStream_.push(this.decryptChunk_(l.subarray(c, c + a), i, r, d));
  51466. this.asyncStream_.push(function() {
  51467. n(null, (0, o.unpad)(d))
  51468. })
  51469. }
  51470. return r(e, [{
  51471. key: "decryptChunk_",
  51472. value: function(e, t, i, r) {
  51473. return function() {
  51474. var n = l(e, t, i);
  51475. r.set(n, e.byteOffset)
  51476. }
  51477. }
  51478. }], [{
  51479. key: "STEP",
  51480. get: function() {
  51481. return 32e3
  51482. }
  51483. }]), e
  51484. }();
  51485. i.Decrypter = d, i.default = {
  51486. Decrypter: d,
  51487. decrypt: l
  51488. }
  51489. }, {
  51490. "./aes": 22,
  51491. "./async-stream": 23,
  51492. pkcs7: 28
  51493. }],
  51494. 25: [function(e, t, i) {
  51495. "use strict";
  51496. Object.defineProperty(i, "__esModule", {
  51497. value: !0
  51498. });
  51499. var r, n = e("./decrypter"),
  51500. a = e("./async-stream"),
  51501. s = (r = a) && r.__esModule ? r : {
  51502. default: r
  51503. };
  51504. i.default = {
  51505. decrypt: n.decrypt,
  51506. Decrypter: n.Decrypter,
  51507. AsyncStream: s.default
  51508. }, t.exports = i.default
  51509. }, {
  51510. "./async-stream": 23,
  51511. "./decrypter": 24
  51512. }],
  51513. 26: [function(e, t, i) {
  51514. "use strict";
  51515. Object.defineProperty(i, "__esModule", {
  51516. value: !0
  51517. });
  51518. var r = function() {
  51519. function e(e, t) {
  51520. for (var i = 0; i < t.length; i++) {
  51521. var r = t[i];
  51522. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51523. Object.defineProperty(e, r.key, r)
  51524. }
  51525. }
  51526. return function(t, i, r) {
  51527. return i && e(t.prototype, i), r && e(t, r), t
  51528. }
  51529. }();
  51530. var n = function() {
  51531. function e() {
  51532. ! function(e, t) {
  51533. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51534. }(this, e), this.listeners = {}
  51535. }
  51536. return r(e, [{
  51537. key: "on",
  51538. value: function(e, t) {
  51539. this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
  51540. }
  51541. }, {
  51542. key: "off",
  51543. value: function(e, t) {
  51544. var i;
  51545. return !!this.listeners[e] && (i = this.listeners[e].indexOf(t), this.listeners[e]
  51546. .splice(i, 1), i > -1)
  51547. }
  51548. }, {
  51549. key: "trigger",
  51550. value: function(e) {
  51551. var t = void 0,
  51552. i = void 0,
  51553. r = void 0,
  51554. n = void 0;
  51555. if (t = this.listeners[e])
  51556. if (2 === arguments.length)
  51557. for (r = t.length, i = 0; i < r; ++i) t[i].call(this, arguments[1]);
  51558. else
  51559. for (n = Array.prototype.slice.call(arguments, 1), r = t.length, i = 0; i < r; ++i)
  51560. t[i].apply(this, n)
  51561. }
  51562. }, {
  51563. key: "dispose",
  51564. value: function() {
  51565. this.listeners = {}
  51566. }
  51567. }, {
  51568. key: "pipe",
  51569. value: function(e) {
  51570. this.on("data", function(t) {
  51571. e.push(t)
  51572. })
  51573. }
  51574. }]), e
  51575. }();
  51576. i.default = n, t.exports = i.default
  51577. }, {}],
  51578. 27: [function(e, t, i) {
  51579. "use strict";
  51580. var r;
  51581. t.exports = function(e) {
  51582. var t = r[e.byteLength % 16 || 0],
  51583. i = new Uint8Array(e.byteLength + t.length);
  51584. return i.set(e), i.set(t, e.byteLength), i
  51585. }, r = [
  51586. [16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16],
  51587. [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15],
  51588. [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14],
  51589. [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13],
  51590. [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12],
  51591. [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11],
  51592. [10, 10, 10, 10, 10, 10, 10, 10, 10, 10],
  51593. [9, 9, 9, 9, 9, 9, 9, 9, 9],
  51594. [8, 8, 8, 8, 8, 8, 8, 8],
  51595. [7, 7, 7, 7, 7, 7, 7],
  51596. [6, 6, 6, 6, 6, 6],
  51597. [5, 5, 5, 5, 5],
  51598. [4, 4, 4, 4],
  51599. [3, 3, 3],
  51600. [2, 2],
  51601. [1]
  51602. ]
  51603. }, {}],
  51604. 28: [function(e, t, i) {
  51605. "use strict";
  51606. i.pad = e("./pad.js"), i.unpad = e("./unpad.js")
  51607. }, {
  51608. "./pad.js": 27,
  51609. "./unpad.js": 29
  51610. }],
  51611. 29: [function(e, t, i) {
  51612. "use strict";
  51613. t.exports = function(e) {
  51614. return e.subarray(0, e.byteLength - e[e.byteLength - 1])
  51615. }
  51616. }, {}],
  51617. 30: [function(e, t, i) {}, {}],
  51618. 31: [function(e, t, i) {
  51619. (function(i) {
  51620. var r, n = void 0 !== i ? i : "undefined" != typeof window ? window : {},
  51621. a = e("min-document");
  51622. "undefined" != typeof document ? r = document : (r = n["__GLOBAL_DOCUMENT_CACHE@4"]) || (r = n[
  51623. "__GLOBAL_DOCUMENT_CACHE@4"] = a), t.exports = r
  51624. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  51625. typeof window ? window : {})
  51626. }, {
  51627. "min-document": 30
  51628. }],
  51629. 32: [function(e, t, i) {
  51630. (function(e) {
  51631. var i;
  51632. i = "undefined" != typeof window ? window : void 0 !== e ? e : "undefined" != typeof self ? self :
  51633. {}, t.exports = i
  51634. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  51635. typeof window ? window : {})
  51636. }, {}],
  51637. 33: [function(e, t, i) {
  51638. "use strict";
  51639. var r = s(e("./line-stream")),
  51640. n = s(e("./parse-stream")),
  51641. a = s(e("./parser"));
  51642. function s(e) {
  51643. return e && e.__esModule ? e : {
  51644. default: e
  51645. }
  51646. }
  51647. t.exports = {
  51648. LineStream: r.default,
  51649. ParseStream: n.default,
  51650. Parser: a.default
  51651. }
  51652. }, {
  51653. "./line-stream": 34,
  51654. "./parse-stream": 35,
  51655. "./parser": 36
  51656. }],
  51657. 34: [function(e, t, i) {
  51658. "use strict";
  51659. Object.defineProperty(i, "__esModule", {
  51660. value: !0
  51661. });
  51662. var r, n = function() {
  51663. function e(e, t) {
  51664. for (var i = 0; i < t.length; i++) {
  51665. var r = t[i];
  51666. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51667. Object.defineProperty(e, r.key, r)
  51668. }
  51669. }
  51670. return function(t, i, r) {
  51671. return i && e(t.prototype, i), r && e(t, r), t
  51672. }
  51673. }(),
  51674. a = e("./stream"),
  51675. s = (r = a) && r.__esModule ? r : {
  51676. default: r
  51677. };
  51678. var o = function(e) {
  51679. function t() {
  51680. ! function(e, t) {
  51681. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51682. }(this, t);
  51683. var e = function(e, t) {
  51684. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  51685. return !t || "object" != typeof t && "function" != typeof t ? e : t
  51686. }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
  51687. return e.buffer = "", e
  51688. }
  51689. return function(e, t) {
  51690. if ("function" != typeof t && null !== t) throw new TypeError(
  51691. "Super expression must either be null or a function, not " + typeof t);
  51692. e.prototype = Object.create(t && t.prototype, {
  51693. constructor: {
  51694. value: e,
  51695. enumerable: !1,
  51696. writable: !0,
  51697. configurable: !0
  51698. }
  51699. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  51700. }(t, s["default"]), n(t, [{
  51701. key: "push",
  51702. value: function(e) {
  51703. var t = void 0;
  51704. for (this.buffer += e, t = this.buffer.indexOf("\n"); t > -1; t = this.buffer.indexOf(
  51705. "\n")) this.trigger("data", this.buffer.substring(0, t)), this.buffer = this.buffer
  51706. .substring(t + 1)
  51707. }
  51708. }]), t
  51709. }();
  51710. i.default = o
  51711. }, {
  51712. "./stream": 37
  51713. }],
  51714. 35: [function(e, t, i) {
  51715. "use strict";
  51716. Object.defineProperty(i, "__esModule", {
  51717. value: !0
  51718. });
  51719. var r, n = function() {
  51720. return function(e, t) {
  51721. if (Array.isArray(e)) return e;
  51722. if (Symbol.iterator in Object(e)) return function(e, t) {
  51723. var i = [],
  51724. r = !0,
  51725. n = !1,
  51726. a = void 0;
  51727. try {
  51728. for (var s, o = e[Symbol.iterator](); !(r = (s = o.next()).done) && (i.push(s.value), !
  51729. t || i.length !== t); r = !0);
  51730. } catch (e) {
  51731. n = !0, a = e
  51732. } finally {
  51733. try {
  51734. !r && o.return && o.return()
  51735. } finally {
  51736. if (n) throw a
  51737. }
  51738. }
  51739. return i
  51740. }(e, t);
  51741. throw new TypeError("Invalid attempt to destructure non-iterable instance")
  51742. }
  51743. }(),
  51744. a = function() {
  51745. function e(e, t) {
  51746. for (var i = 0; i < t.length; i++) {
  51747. var r = t[i];
  51748. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51749. Object.defineProperty(e, r.key, r)
  51750. }
  51751. }
  51752. return function(t, i, r) {
  51753. return i && e(t.prototype, i), r && e(t, r), t
  51754. }
  51755. }(),
  51756. s = e("./stream"),
  51757. o = (r = s) && r.__esModule ? r : {
  51758. default: r
  51759. };
  51760. var u = function(e) {
  51761. for (var t = e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')), i = {}, r = t.length, n =
  51762. void 0; r--;) "" !== t[r] && ((n = /([^=]*)=(.*)/.exec(t[r]).slice(1))[0] = n[0].replace(
  51763. /^\s+|\s+$/g, ""), n[1] = n[1].replace(/^\s+|\s+$/g, ""), n[1] = n[1].replace(
  51764. /^['"](.*)['"]$/g, "$1"), i[n[0]] = n[1]);
  51765. return i
  51766. },
  51767. l = function(e) {
  51768. function t() {
  51769. return function(e, t) {
  51770. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51771. }(this, t),
  51772. function(e, t) {
  51773. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  51774. return !t || "object" != typeof t && "function" != typeof t ? e : t
  51775. }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this))
  51776. }
  51777. return function(e, t) {
  51778. if ("function" != typeof t && null !== t) throw new TypeError(
  51779. "Super expression must either be null or a function, not " + typeof t);
  51780. e.prototype = Object.create(t && t.prototype, {
  51781. constructor: {
  51782. value: e,
  51783. enumerable: !1,
  51784. writable: !0,
  51785. configurable: !0
  51786. }
  51787. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  51788. }(t, o["default"]), a(t, [{
  51789. key: "push",
  51790. value: function(e) {
  51791. var t = void 0,
  51792. i = void 0;
  51793. if (0 !== (e = e.replace(/^[\u0000\s]+|[\u0000\s]+$/g, "")).length)
  51794. if ("#" === e[0])
  51795. if (0 === e.indexOf("#EXT"))
  51796. if (e = e.replace("\r", ""), t = /^#EXTM3U/.exec(e)) this.trigger("data", {
  51797. type: "tag",
  51798. tagType: "m3u"
  51799. });
  51800. else {
  51801. if (t = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e)) return i = {
  51802. type: "tag",
  51803. tagType: "inf"
  51804. }, t[1] && (i.duration = parseFloat(t[1])), t[2] && (i.title = t[2]),
  51805. void this.trigger("data", i);
  51806. if (t = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e)) return i = {
  51807. type: "tag",
  51808. tagType: "targetduration"
  51809. }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i);
  51810. if (t = /^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(e)) return i = {
  51811. type: "tag",
  51812. tagType: "totalduration"
  51813. }, t[1] && (i.duration = parseInt(t[1], 10)), void this.trigger("data", i);
  51814. if (t = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(e)) return i = {
  51815. type: "tag",
  51816. tagType: "version"
  51817. }, t[1] && (i.version = parseInt(t[1], 10)), void this.trigger("data", i);
  51818. if (t = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
  51819. type: "tag",
  51820. tagType: "media-sequence"
  51821. }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i);
  51822. if (t = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e)) return i = {
  51823. type: "tag",
  51824. tagType: "discontinuity-sequence"
  51825. }, t[1] && (i.number = parseInt(t[1], 10)), void this.trigger("data", i);
  51826. if (t = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e)) return i = {
  51827. type: "tag",
  51828. tagType: "playlist-type"
  51829. }, t[1] && (i.playlistType = t[1]), void this.trigger("data", i);
  51830. if (t = /^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(e)) return i = {
  51831. type: "tag",
  51832. tagType: "byterange"
  51833. }, t[1] && (i.length = parseInt(t[1], 10)), t[2] && (i.offset = parseInt(t[
  51834. 2], 10)), void this.trigger("data", i);
  51835. if (t = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e)) return i = {
  51836. type: "tag",
  51837. tagType: "allow-cache"
  51838. }, t[1] && (i.allowed = !/NO/.test(t[1])), void this.trigger("data", i);
  51839. if (t = /^#EXT-X-MAP:?(.*)$/.exec(e)) {
  51840. if (i = {
  51841. type: "tag",
  51842. tagType: "map"
  51843. }, t[1]) {
  51844. var r = u(t[1]);
  51845. if (r.URI && (i.uri = r.URI), r.BYTERANGE) {
  51846. var a = r.BYTERANGE.split("@"),
  51847. s = n(a, 2),
  51848. o = s[0],
  51849. l = s[1];
  51850. i.byterange = {}, o && (i.byterange.length = parseInt(o, 10)), l && (i
  51851. .byterange.offset = parseInt(l, 10))
  51852. }
  51853. }
  51854. this.trigger("data", i)
  51855. } else if (t = /^#EXT-X-STREAM-INF:?(.*)$/.exec(e)) {
  51856. if (i = {
  51857. type: "tag",
  51858. tagType: "stream-inf"
  51859. }, t[1]) {
  51860. if (i.attributes = u(t[1]), i.attributes.RESOLUTION) {
  51861. var d = i.attributes.RESOLUTION.split("x"),
  51862. c = {};
  51863. d[0] && (c.width = parseInt(d[0], 10)), d[1] && (c.height = parseInt(d[1],
  51864. 10)), i.attributes.RESOLUTION = c
  51865. }
  51866. i.attributes.BANDWIDTH && (i.attributes.BANDWIDTH = parseInt(i.attributes
  51867. .BANDWIDTH, 10)), i.attributes["PROGRAM-ID"] && (i.attributes[
  51868. "PROGRAM-ID"] = parseInt(i.attributes["PROGRAM-ID"], 10))
  51869. }
  51870. this.trigger("data", i)
  51871. } else {
  51872. if (t = /^#EXT-X-MEDIA:?(.*)$/.exec(e)) return i = {
  51873. type: "tag",
  51874. tagType: "media"
  51875. }, t[1] && (i.attributes = u(t[1])), void this.trigger("data", i);
  51876. if (t = /^#EXT-X-ENDLIST/.exec(e)) this.trigger("data", {
  51877. type: "tag",
  51878. tagType: "endlist"
  51879. });
  51880. else if (t = /^#EXT-X-DISCONTINUITY/.exec(e)) this.trigger("data", {
  51881. type: "tag",
  51882. tagType: "discontinuity"
  51883. });
  51884. else {
  51885. if (t = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e)) return i = {
  51886. type: "tag",
  51887. tagType: "program-date-time"
  51888. }, t[1] && (i.dateTimeString = t[1], i.dateTimeObject = new Date(t[1])),
  51889. void this.trigger("data", i);
  51890. if (t = /^#EXT-X-KEY:?(.*)$/.exec(e)) return i = {
  51891. type: "tag",
  51892. tagType: "key"
  51893. }, t[1] && (i.attributes = u(t[1]), i.attributes.IV && ("0x" === i
  51894. .attributes.IV.substring(0, 2).toLowerCase() && (i.attributes.IV = i
  51895. .attributes.IV.substring(2)), i.attributes.IV = i.attributes.IV
  51896. .match(/.{8}/g), i.attributes.IV[0] = parseInt(i.attributes.IV[0],
  51897. 16), i.attributes.IV[1] = parseInt(i.attributes.IV[1], 16), i
  51898. .attributes.IV[2] = parseInt(i.attributes.IV[2], 16), i.attributes
  51899. .IV[3] = parseInt(i.attributes.IV[3], 16), i.attributes.IV =
  51900. new Uint32Array(i.attributes.IV))), void this.trigger("data", i);
  51901. if (t = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e)) return i = {
  51902. type: "tag",
  51903. tagType: "cue-out-cont"
  51904. }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i);
  51905. if (t = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(e)) return i = {
  51906. type: "tag",
  51907. tagType: "cue-out"
  51908. }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i);
  51909. if (t = /^#EXT-X-CUE-IN:?(.*)?$/.exec(e)) return i = {
  51910. type: "tag",
  51911. tagType: "cue-in"
  51912. }, t[1] ? i.data = t[1] : i.data = "", void this.trigger("data", i);
  51913. this.trigger("data", {
  51914. type: "tag",
  51915. data: e.slice(4)
  51916. })
  51917. }
  51918. }
  51919. }
  51920. else this.trigger("data", {
  51921. type: "comment",
  51922. text: e.slice(1)
  51923. });
  51924. else this.trigger("data", {
  51925. type: "uri",
  51926. uri: e
  51927. })
  51928. }
  51929. }]), t
  51930. }();
  51931. i.default = l
  51932. }, {
  51933. "./stream": 37
  51934. }],
  51935. 36: [function(e, t, i) {
  51936. "use strict";
  51937. Object.defineProperty(i, "__esModule", {
  51938. value: !0
  51939. });
  51940. var r = Object.assign || function(e) {
  51941. for (var t = 1; t < arguments.length; t++) {
  51942. var i = arguments[t];
  51943. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  51944. }
  51945. return e
  51946. },
  51947. n = function() {
  51948. function e(e, t) {
  51949. for (var i = 0; i < t.length; i++) {
  51950. var r = t[i];
  51951. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  51952. Object.defineProperty(e, r.key, r)
  51953. }
  51954. }
  51955. return function(t, i, r) {
  51956. return i && e(t.prototype, i), r && e(t, r), t
  51957. }
  51958. }(),
  51959. a = u(e("./stream")),
  51960. s = u(e("./line-stream")),
  51961. o = u(e("./parse-stream"));
  51962. function u(e) {
  51963. return e && e.__esModule ? e : {
  51964. default: e
  51965. }
  51966. }
  51967. var l = function(e) {
  51968. function t() {
  51969. ! function(e, t) {
  51970. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  51971. }(this, t);
  51972. var e = function(e, t) {
  51973. if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  51974. return !t || "object" != typeof t && "function" != typeof t ? e : t
  51975. }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this));
  51976. e.lineStream = new s.default, e.parseStream = new o.default, e.lineStream.pipe(e.parseStream);
  51977. var i = e,
  51978. n = [],
  51979. a = {},
  51980. u = void 0,
  51981. l = void 0,
  51982. d = {
  51983. AUDIO: {},
  51984. VIDEO: {},
  51985. "CLOSED-CAPTIONS": {},
  51986. SUBTITLES: {}
  51987. },
  51988. c = 0;
  51989. return e.manifest = {
  51990. allowCache: !0,
  51991. discontinuityStarts: [],
  51992. segments: []
  51993. }, e.parseStream.on("data", function(e) {
  51994. var t = void 0,
  51995. s = void 0;
  51996. ({
  51997. tag: function() {
  51998. (({
  51999. "allow-cache": function() {
  52000. this.manifest.allowCache = e.allowed, "allowed" in e || (this.trigger(
  52001. "info", {
  52002. message: "defaulting allowCache to YES"
  52003. }), this.manifest.allowCache = !0)
  52004. },
  52005. byterange: function() {
  52006. var t = {};
  52007. "length" in e && (a.byterange = t, t.length = e.length, "offset" in e || (
  52008. this.trigger("info", {
  52009. message: "defaulting offset to zero"
  52010. }), e.offset = 0)), "offset" in e && (a.byterange = t, t.offset = e
  52011. .offset)
  52012. },
  52013. endlist: function() {
  52014. this.manifest.endList = !0
  52015. },
  52016. inf: function() {
  52017. "mediaSequence" in this.manifest || (this.manifest.mediaSequence = 0, this
  52018. .trigger("info", {
  52019. message: "defaulting media sequence to zero"
  52020. })), "discontinuitySequence" in this.manifest || (this.manifest
  52021. .discontinuitySequence = 0, this.trigger("info", {
  52022. message: "defaulting discontinuity sequence to zero"
  52023. })), e.duration > 0 && (a.duration = e.duration), 0 === e.duration &&
  52024. (a.duration = .01, this.trigger("info", {
  52025. message: "updating zero segment duration to a small value"
  52026. })), this.manifest.segments = n
  52027. },
  52028. key: function() {
  52029. e.attributes ? "NONE" !== e.attributes.METHOD ? e.attributes.URI ? (e
  52030. .attributes.METHOD || this.trigger("warn", {
  52031. message: "defaulting key method to AES-128"
  52032. }), l = {
  52033. method: e.attributes.METHOD || "AES-128",
  52034. uri: e.attributes.URI
  52035. }, void 0 !== e.attributes.IV && (l.iv = e.attributes.IV)) : this
  52036. .trigger("warn", {
  52037. message: "ignoring key declaration without URI"
  52038. }) : l = null : this.trigger("warn", {
  52039. message: "ignoring key declaration without attribute list"
  52040. })
  52041. },
  52042. "media-sequence": function() {
  52043. isFinite(e.number) ? this.manifest.mediaSequence = e.number : this
  52044. .trigger("warn", {
  52045. message: "ignoring invalid media sequence: " + e.number
  52046. })
  52047. },
  52048. "discontinuity-sequence": function() {
  52049. isFinite(e.number) ? (this.manifest.discontinuitySequence = e.number, c =
  52050. e.number) : this.trigger("warn", {
  52051. message: "ignoring invalid discontinuity sequence: " + e.number
  52052. })
  52053. },
  52054. "playlist-type": function() {
  52055. /VOD|EVENT/.test(e.playlistType) ? this.manifest.playlistType = e
  52056. .playlistType : this.trigger("warn", {
  52057. message: "ignoring unknown playlist type: " + e.playlist
  52058. })
  52059. },
  52060. map: function() {
  52061. u = {}, e.uri && (u.uri = e.uri), e.byterange && (u.byterange = e
  52062. .byterange)
  52063. },
  52064. "stream-inf": function() {
  52065. this.manifest.playlists = n, this.manifest.mediaGroups = this.manifest
  52066. .mediaGroups || d, e.attributes ? (a.attributes || (a.attributes = {}),
  52067. r(a.attributes, e.attributes)) : this.trigger("warn", {
  52068. message: "ignoring empty stream-inf attributes"
  52069. })
  52070. },
  52071. media: function() {
  52072. if (this.manifest.mediaGroups = this.manifest.mediaGroups || d, e
  52073. .attributes && e.attributes.TYPE && e.attributes["GROUP-ID"] && e
  52074. .attributes.NAME) {
  52075. var i = this.manifest.mediaGroups[e.attributes.TYPE];
  52076. i[e.attributes["GROUP-ID"]] = i[e.attributes["GROUP-ID"]] || {}, t = i[e
  52077. .attributes["GROUP-ID"]], (s = {
  52078. default: /yes/i.test(e.attributes.DEFAULT)
  52079. }).default ? s.autoselect = !0 : s.autoselect = /yes/i.test(e
  52080. .attributes.AUTOSELECT), e.attributes.LANGUAGE && (s.language = e
  52081. .attributes.LANGUAGE), e.attributes.URI && (s.uri = e.attributes
  52082. .URI), e.attributes["INSTREAM-ID"] && (s.instreamId = e.attributes[
  52083. "INSTREAM-ID"]), e.attributes.CHARACTERISTICS && (s
  52084. .characteristics = e.attributes.CHARACTERISTICS), e.attributes
  52085. .FORCED && (s.forced = /yes/i.test(e.attributes.FORCED)), t[e
  52086. .attributes.NAME] = s
  52087. } else this.trigger("warn", {
  52088. message: "ignoring incomplete or missing media group"
  52089. })
  52090. },
  52091. discontinuity: function() {
  52092. c += 1, a.discontinuity = !0, this.manifest.discontinuityStarts.push(n
  52093. .length)
  52094. },
  52095. "program-date-time": function() {
  52096. this.manifest.dateTimeString = e.dateTimeString, this.manifest
  52097. .dateTimeObject = e.dateTimeObject
  52098. },
  52099. targetduration: function() {
  52100. !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
  52101. message: "ignoring invalid target duration: " + e.duration
  52102. }) : this.manifest.targetDuration = e.duration
  52103. },
  52104. totalduration: function() {
  52105. !isFinite(e.duration) || e.duration < 0 ? this.trigger("warn", {
  52106. message: "ignoring invalid total duration: " + e.duration
  52107. }) : this.manifest.totalDuration = e.duration
  52108. },
  52109. "cue-out": function() {
  52110. a.cueOut = e.data
  52111. },
  52112. "cue-out-cont": function() {
  52113. a.cueOutCont = e.data
  52114. },
  52115. "cue-in": function() {
  52116. a.cueIn = e.data
  52117. }
  52118. })[e.tagType] || function() {}).call(i)
  52119. },
  52120. uri: function() {
  52121. a.uri = e.uri, n.push(a), !this.manifest.targetDuration || "duration" in a || (this
  52122. .trigger("warn", {
  52123. message: "defaulting segment duration to the target duration"
  52124. }), a.duration = this.manifest.targetDuration), l && (a.key = l), a.timeline =
  52125. c, u && (a.map = u), a = {}
  52126. },
  52127. comment: function() {}
  52128. })[e.type].call(i)
  52129. }), e
  52130. }
  52131. return function(e, t) {
  52132. if ("function" != typeof t && null !== t) throw new TypeError(
  52133. "Super expression must either be null or a function, not " + typeof t);
  52134. e.prototype = Object.create(t && t.prototype, {
  52135. constructor: {
  52136. value: e,
  52137. enumerable: !1,
  52138. writable: !0,
  52139. configurable: !0
  52140. }
  52141. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  52142. }(t, a["default"]), n(t, [{
  52143. key: "push",
  52144. value: function(e) {
  52145. this.lineStream.push(e)
  52146. }
  52147. }, {
  52148. key: "end",
  52149. value: function() {
  52150. this.lineStream.push("\n")
  52151. }
  52152. }]), t
  52153. }();
  52154. i.default = l
  52155. }, {
  52156. "./line-stream": 34,
  52157. "./parse-stream": 35,
  52158. "./stream": 37
  52159. }],
  52160. 37: [function(e, t, i) {
  52161. "use strict";
  52162. Object.defineProperty(i, "__esModule", {
  52163. value: !0
  52164. });
  52165. var r = function() {
  52166. function e(e, t) {
  52167. for (var i = 0; i < t.length; i++) {
  52168. var r = t[i];
  52169. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  52170. Object.defineProperty(e, r.key, r)
  52171. }
  52172. }
  52173. return function(t, i, r) {
  52174. return i && e(t.prototype, i), r && e(t, r), t
  52175. }
  52176. }();
  52177. var n = function() {
  52178. function e() {
  52179. ! function(e, t) {
  52180. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  52181. }(this, e), this.listeners = {}
  52182. }
  52183. return r(e, [{
  52184. key: "on",
  52185. value: function(e, t) {
  52186. this.listeners[e] || (this.listeners[e] = []), this.listeners[e].push(t)
  52187. }
  52188. }, {
  52189. key: "off",
  52190. value: function(e, t) {
  52191. if (!this.listeners[e]) return !1;
  52192. var i = this.listeners[e].indexOf(t);
  52193. return this.listeners[e].splice(i, 1), i > -1
  52194. }
  52195. }, {
  52196. key: "trigger",
  52197. value: function(e) {
  52198. var t = this.listeners[e],
  52199. i = void 0,
  52200. r = void 0,
  52201. n = void 0;
  52202. if (t)
  52203. if (2 === arguments.length)
  52204. for (r = t.length, i = 0; i < r; ++i) t[i].call(this, arguments[1]);
  52205. else
  52206. for (n = Array.prototype.slice.call(arguments, 1), r = t.length, i = 0; i < r; ++i)
  52207. t[i].apply(this, n)
  52208. }
  52209. }, {
  52210. key: "dispose",
  52211. value: function() {
  52212. this.listeners = {}
  52213. }
  52214. }, {
  52215. key: "pipe",
  52216. value: function(e) {
  52217. this.on("data", function(t) {
  52218. e.push(t)
  52219. })
  52220. }
  52221. }]), e
  52222. }();
  52223. i.default = n
  52224. }, {}],
  52225. 38: [function(e, t, i) {
  52226. "use strict";
  52227. var r, n = e("../utils/stream.js");
  52228. (r = function() {
  52229. var e = new Uint8Array,
  52230. t = 0;
  52231. r.prototype.init.call(this), this.setTimestamp = function(e) {
  52232. t = e
  52233. }, this.parseId3TagSize = function(e, t) {
  52234. var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
  52235. return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10
  52236. }, this.parseAdtsSize = function(e, t) {
  52237. var i = (224 & e[t + 5]) >> 5,
  52238. r = e[t + 4] << 3;
  52239. return 6144 & e[t + 3] | r | i
  52240. }, this.push = function(i) {
  52241. var r, n, a, s, o = 0,
  52242. u = 0;
  52243. for (e.length ? (s = e.length, (e = new Uint8Array(i.byteLength + s)).set(e.subarray(0, s)), e
  52244. .set(i, s)) : e = i; e.length - u >= 3;)
  52245. if (e[u] !== "I".charCodeAt(0) || e[u + 1] !== "D".charCodeAt(0) || e[u + 2] !== "3"
  52246. .charCodeAt(0))
  52247. if (!0 & e[u] && 240 == (240 & e[u + 1])) {
  52248. if (e.length - u < 7) break;
  52249. if ((o = this.parseAdtsSize(e, u)) > e.length) break;
  52250. a = {
  52251. type: "audio",
  52252. data: e.subarray(u, u + o),
  52253. pts: t,
  52254. dts: t
  52255. }, this.trigger("data", a), u += o
  52256. } else u++;
  52257. else {
  52258. if (e.length - u < 10) break;
  52259. if ((o = this.parseId3TagSize(e, u)) > e.length) break;
  52260. n = {
  52261. type: "timed-metadata",
  52262. data: e.subarray(u, u + o)
  52263. }, this.trigger("data", n), u += o
  52264. }
  52265. r = e.length - u, e = r > 0 ? e.subarray(u) : new Uint8Array
  52266. }
  52267. }).prototype = new n, t.exports = r
  52268. }, {
  52269. "../utils/stream.js": 62
  52270. }],
  52271. 39: [function(e, t, i) {
  52272. "use strict";
  52273. var r = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350],
  52274. n = function(e) {
  52275. return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
  52276. };
  52277. t.exports = {
  52278. parseId3TagSize: function(e, t) {
  52279. var i = e[t + 6] << 21 | e[t + 7] << 14 | e[t + 8] << 7 | e[t + 9];
  52280. return (16 & e[t + 5]) >> 4 ? i + 20 : i + 10
  52281. },
  52282. parseAdtsSize: function(e, t) {
  52283. var i = (224 & e[t + 5]) >> 5,
  52284. r = e[t + 4] << 3;
  52285. return 6144 & e[t + 3] | r | i
  52286. },
  52287. parseType: function(e, t) {
  52288. return e[t] === "I".charCodeAt(0) && e[t + 1] === "D".charCodeAt(0) && e[t + 2] === "3"
  52289. .charCodeAt(0) ? "timed-metadata" : !0 & e[t] && 240 == (240 & e[t + 1]) ? "audio" : null
  52290. },
  52291. parseSampleRate: function(e) {
  52292. for (var t = 0; t + 5 < e.length;) {
  52293. if (255 === e[t] && 240 == (246 & e[t + 1])) return r[(60 & e[t + 2]) >>> 2];
  52294. t++
  52295. }
  52296. return null
  52297. },
  52298. parseAacTimestamp: function(e) {
  52299. var t, i, r;
  52300. t = 10, 64 & e[5] && (t += 4, t += n(e.subarray(10, 14)));
  52301. do {
  52302. if ((i = n(e.subarray(t + 4, t + 8))) < 1) return null;
  52303. if ("PRIV" === String.fromCharCode(e[t], e[t + 1], e[t + 2], e[t + 3])) {
  52304. r = e.subarray(t + 10, t + i + 10);
  52305. for (var a = 0; a < r.byteLength; a++)
  52306. if (0 === r[a]) {
  52307. if ("com.apple.streaming.transportStreamTimestamp" === unescape(function(e, t, i) {
  52308. var r, n = "";
  52309. for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2);
  52310. return n
  52311. }(r, 0, a))) {
  52312. var s = r.subarray(a + 1),
  52313. o = (1 & s[3]) << 30 | s[4] << 22 | s[5] << 14 | s[6] << 6 | s[7] >>> 2;
  52314. return o *= 4, o += 3 & s[7]
  52315. }
  52316. break
  52317. }
  52318. }
  52319. t += 10, t += i
  52320. } while (t < e.byteLength);
  52321. return null
  52322. }
  52323. }
  52324. }, {}],
  52325. 40: [function(e, t, i) {
  52326. "use strict";
  52327. var r, n = e("../utils/stream.js"),
  52328. a = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  52329. (r = function() {
  52330. var e;
  52331. r.prototype.init.call(this), this.push = function(t) {
  52332. var i, r, n, s, o, u, l = 0,
  52333. d = 0;
  52334. if ("audio" === t.type)
  52335. for (e ? (s = e, (e = new Uint8Array(s.byteLength + t.data.byteLength)).set(s), e.set(t.data,
  52336. s.byteLength)) : e = t.data; l + 5 < e.length;)
  52337. if (255 === e[l] && 240 == (246 & e[l + 1])) {
  52338. if (r = 2 * (1 & ~e[l + 1]), i = (3 & e[l + 3]) << 11 | e[l + 4] << 3 | (224 & e[l +
  52339. 5]) >> 5, u = 9e4 * (o = 1024 * (1 + (3 & e[l + 6]))) / a[(60 & e[l + 2]) >>> 2], n =
  52340. l + i, e.byteLength < n) return;
  52341. if (this.trigger("data", {
  52342. pts: t.pts + d * u,
  52343. dts: t.dts + d * u,
  52344. sampleCount: o,
  52345. audioobjecttype: 1 + (e[l + 2] >>> 6 & 3),
  52346. channelcount: (1 & e[l + 2]) << 2 | (192 & e[l + 3]) >>> 6,
  52347. samplerate: a[(60 & e[l + 2]) >>> 2],
  52348. samplingfrequencyindex: (60 & e[l + 2]) >>> 2,
  52349. samplesize: 16,
  52350. data: e.subarray(l + 7 + r, n)
  52351. }), e.byteLength === n) return void(e = void 0);
  52352. d++, e = e.subarray(n)
  52353. } else l++
  52354. }, this.flush = function() {
  52355. this.trigger("done")
  52356. }
  52357. }).prototype = new n, t.exports = r
  52358. }, {
  52359. "../utils/stream.js": 62
  52360. }],
  52361. 41: [function(e, t, i) {
  52362. "use strict";
  52363. var r, n, a, s = e("../utils/stream.js"),
  52364. o = e("../utils/exp-golomb.js");
  52365. (n = function() {
  52366. var e, t, i = 0;
  52367. n.prototype.init.call(this), this.push = function(r) {
  52368. var n;
  52369. for (t ? ((n = new Uint8Array(t.byteLength + r.data.byteLength)).set(t), n.set(r.data, t
  52370. .byteLength), t = n) : t = r.data; i < t.byteLength - 3; i++)
  52371. if (1 === t[i + 2]) {
  52372. e = i + 5;
  52373. break
  52374. } for (; e < t.byteLength;) switch (t[e]) {
  52375. case 0:
  52376. if (0 !== t[e - 1]) {
  52377. e += 2;
  52378. break
  52379. }
  52380. if (0 !== t[e - 2]) {
  52381. e++;
  52382. break
  52383. }
  52384. i + 3 !== e - 2 && this.trigger("data", t.subarray(i + 3, e - 2));
  52385. do {
  52386. e++
  52387. } while (1 !== t[e] && e < t.length);
  52388. i = e - 2, e += 3;
  52389. break;
  52390. case 1:
  52391. if (0 !== t[e - 1] || 0 !== t[e - 2]) {
  52392. e += 3;
  52393. break
  52394. }
  52395. this.trigger("data", t.subarray(i + 3, e - 2)), i = e - 2, e += 3;
  52396. break;
  52397. default:
  52398. e += 3
  52399. }
  52400. t = t.subarray(i), e -= i, i = 0
  52401. }, this.flush = function() {
  52402. t && t.byteLength > 3 && this.trigger("data", t.subarray(i + 3)), t = null, i = 0, this.trigger(
  52403. "done")
  52404. }
  52405. }).prototype = new s, a = {
  52406. 100: !0,
  52407. 110: !0,
  52408. 122: !0,
  52409. 244: !0,
  52410. 44: !0,
  52411. 83: !0,
  52412. 86: !0,
  52413. 118: !0,
  52414. 128: !0,
  52415. 138: !0,
  52416. 139: !0,
  52417. 134: !0
  52418. }, (r = function() {
  52419. var e, t, i, s, u, l, d, c = new n;
  52420. r.prototype.init.call(this), e = this, this.push = function(e) {
  52421. "video" === e.type && (t = e.trackId, i = e.pts, s = e.dts, c.push(e))
  52422. }, c.on("data", function(r) {
  52423. var n = {
  52424. trackId: t,
  52425. pts: i,
  52426. dts: s,
  52427. data: r
  52428. };
  52429. switch (31 & r[0]) {
  52430. case 5:
  52431. n.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  52432. break;
  52433. case 6:
  52434. n.nalUnitType = "sei_rbsp", n.escapedRBSP = u(r.subarray(1));
  52435. break;
  52436. case 7:
  52437. n.nalUnitType = "seq_parameter_set_rbsp", n.escapedRBSP = u(r.subarray(1)), n.config =
  52438. l(n.escapedRBSP);
  52439. break;
  52440. case 8:
  52441. n.nalUnitType = "pic_parameter_set_rbsp";
  52442. break;
  52443. case 9:
  52444. n.nalUnitType = "access_unit_delimiter_rbsp"
  52445. }
  52446. e.trigger("data", n)
  52447. }), c.on("done", function() {
  52448. e.trigger("done")
  52449. }), this.flush = function() {
  52450. c.flush()
  52451. }, d = function(e, t) {
  52452. var i, r = 8,
  52453. n = 8;
  52454. for (i = 0; i < e; i++) 0 !== n && (n = (r + t.readExpGolomb() + 256) % 256), r = 0 === n ?
  52455. r : n
  52456. }, u = function(e) {
  52457. for (var t, i, r = e.byteLength, n = [], a = 1; a < r - 2;) 0 === e[a] && 0 === e[a + 1] &&
  52458. 3 === e[a + 2] ? (n.push(a + 2), a += 2) : a++;
  52459. if (0 === n.length) return e;
  52460. t = r - n.length, i = new Uint8Array(t);
  52461. var s = 0;
  52462. for (a = 0; a < t; s++, a++) s === n[0] && (s++, n.shift()), i[a] = e[s];
  52463. return i
  52464. }, l = function(e) {
  52465. var t, i, r, n, s, u, l, c, h, f, p, m, g, v = 0,
  52466. y = 0,
  52467. _ = 0,
  52468. b = 0,
  52469. w = 1;
  52470. if (i = (t = new o(e)).readUnsignedByte(), n = t.readUnsignedByte(), r = t.readUnsignedByte(),
  52471. t.skipUnsignedExpGolomb(), a[i] && (3 === (s = t.readUnsignedExpGolomb()) && t.skipBits(1),
  52472. t.skipUnsignedExpGolomb(), t.skipUnsignedExpGolomb(), t.skipBits(1), t.readBoolean()))
  52473. for (p = 3 !== s ? 8 : 12, g = 0; g < p; g++) t.readBoolean() && d(g < 6 ? 16 : 64, t);
  52474. if (t.skipUnsignedExpGolomb(), 0 === (u = t.readUnsignedExpGolomb())) t
  52475. .readUnsignedExpGolomb();
  52476. else if (1 === u)
  52477. for (t.skipBits(1), t.skipExpGolomb(), t.skipExpGolomb(), l = t.readUnsignedExpGolomb(), g =
  52478. 0; g < l; g++) t.skipExpGolomb();
  52479. if (t.skipUnsignedExpGolomb(), t.skipBits(1), c = t.readUnsignedExpGolomb(), h = t
  52480. .readUnsignedExpGolomb(), 0 === (f = t.readBits(1)) && t.skipBits(1), t.skipBits(1), t
  52481. .readBoolean() && (v = t.readUnsignedExpGolomb(), y = t.readUnsignedExpGolomb(), _ = t
  52482. .readUnsignedExpGolomb(), b = t.readUnsignedExpGolomb()), t.readBoolean() && t
  52483. .readBoolean()) {
  52484. switch (t.readUnsignedByte()) {
  52485. case 1:
  52486. m = [1, 1];
  52487. break;
  52488. case 2:
  52489. m = [12, 11];
  52490. break;
  52491. case 3:
  52492. m = [10, 11];
  52493. break;
  52494. case 4:
  52495. m = [16, 11];
  52496. break;
  52497. case 5:
  52498. m = [40, 33];
  52499. break;
  52500. case 6:
  52501. m = [24, 11];
  52502. break;
  52503. case 7:
  52504. m = [20, 11];
  52505. break;
  52506. case 8:
  52507. m = [32, 11];
  52508. break;
  52509. case 9:
  52510. m = [80, 33];
  52511. break;
  52512. case 10:
  52513. m = [18, 11];
  52514. break;
  52515. case 11:
  52516. m = [15, 11];
  52517. break;
  52518. case 12:
  52519. m = [64, 33];
  52520. break;
  52521. case 13:
  52522. m = [160, 99];
  52523. break;
  52524. case 14:
  52525. m = [4, 3];
  52526. break;
  52527. case 15:
  52528. m = [3, 2];
  52529. break;
  52530. case 16:
  52531. m = [2, 1];
  52532. break;
  52533. case 255:
  52534. m = [t.readUnsignedByte() << 8 | t.readUnsignedByte(), t.readUnsignedByte() << 8 | t
  52535. .readUnsignedByte()
  52536. ]
  52537. }
  52538. m && (w = m[0] / m[1])
  52539. }
  52540. return {
  52541. profileIdc: i,
  52542. levelIdc: r,
  52543. profileCompatibility: n,
  52544. width: Math.ceil((16 * (c + 1) - 2 * v - 2 * y) * w),
  52545. height: (2 - f) * (h + 1) * 16 - 2 * _ - 2 * b
  52546. }
  52547. }
  52548. }).prototype = new s, t.exports = {
  52549. H264Stream: r,
  52550. NalByteStream: n
  52551. }
  52552. }, {
  52553. "../utils/exp-golomb.js": 61,
  52554. "../utils/stream.js": 62
  52555. }],
  52556. 42: [function(e, t, i) {
  52557. var r, n = [33, 16, 5, 32, 164, 27],
  52558. a = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252],
  52559. s = function(e) {
  52560. for (var t = []; e--;) t.push(0);
  52561. return t
  52562. },
  52563. o = {
  52564. 96000: [n, [227, 64], s(154), [56]],
  52565. 88200: [n, [231], s(170), [56]],
  52566. 64000: [n, [248, 192], s(240), [56]],
  52567. 48000: [n, [255, 192], s(268), [55, 148, 128], s(54), [112]],
  52568. 44100: [n, [255, 192], s(268), [55, 163, 128], s(84), [112]],
  52569. 32000: [n, [255, 192], s(268), [55, 234], s(226), [112]],
  52570. 24000: [n, [255, 192], s(268), [55, 255, 128], s(268), [111, 112], s(126), [224]],
  52571. 16000: [n, [255, 192], s(268), [55, 255, 128], s(268), [111, 255], s(269), [223, 108], s(195), [1,
  52572. 192
  52573. ]],
  52574. 12000: [a, s(268), [3, 127, 248], s(268), [6, 255, 240], s(268), [13, 255, 224], s(268), [27, 253,
  52575. 128
  52576. ], s(259), [56]],
  52577. 11025: [a, s(268), [3, 127, 248], s(268), [6, 255, 240], s(268), [13, 255, 224], s(268), [27, 255,
  52578. 192
  52579. ], s(268), [55, 175, 128], s(108), [112]],
  52580. 8000: [a, s(268), [3, 121, 16], s(47), [7]]
  52581. };
  52582. t.exports = (r = o, Object.keys(r).reduce(function(e, t) {
  52583. return e[t] = new Uint8Array(r[t].reduce(function(e, t) {
  52584. return e.concat(t)
  52585. }, [])), e
  52586. }, {}))
  52587. }, {}],
  52588. 43: [function(e, t, i) {
  52589. "use strict";
  52590. var r = e("../utils/stream.js"),
  52591. n = function(e) {
  52592. this.numberOfTracks = 0, this.metadataStream = e.metadataStream, this.videoTags = [], this
  52593. .audioTags = [], this.videoTrack = null, this.audioTrack = null, this.pendingCaptions = [], this
  52594. .pendingMetadata = [], this.pendingTracks = 0, this.processedTracks = 0, n.prototype.init.call(
  52595. this), this.push = function(e) {
  52596. return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (
  52597. "video" === e.track.type && (this.videoTrack = e.track, this.videoTags = e.tags, this
  52598. .pendingTracks++), void("audio" === e.track.type && (this.audioTrack = e.track, this
  52599. .audioTags = e.tags, this.pendingTracks++)))
  52600. }
  52601. };
  52602. n.prototype = new r, n.prototype.flush = function(e) {
  52603. var t, i, r, n, a = {
  52604. tags: {},
  52605. captions: [],
  52606. captionStreams: {},
  52607. metadata: []
  52608. };
  52609. if (this.pendingTracks < this.numberOfTracks) {
  52610. if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return;
  52611. if (0 === this.pendingTracks && (this.processedTracks++, this.processedTracks < this
  52612. .numberOfTracks)) return
  52613. }
  52614. if (this.processedTracks += this.pendingTracks, this.pendingTracks = 0, !(this.processedTracks <
  52615. this.numberOfTracks)) {
  52616. for (this.videoTrack ? n = this.videoTrack.timelineStartInfo.pts : this.audioTrack && (n = this
  52617. .audioTrack.timelineStartInfo.pts), a.tags.videoTags = this.videoTags, a.tags.audioTags = this
  52618. .audioTags, r = 0; r < this.pendingCaptions.length; r++)(i = this.pendingCaptions[r])
  52619. .startTime = i.startPts - n, i.startTime /= 9e4, i.endTime = i.endPts - n, i.endTime /= 9e4, a
  52620. .captionStreams[i.stream] = !0, a.captions.push(i);
  52621. for (r = 0; r < this.pendingMetadata.length; r++)(t = this.pendingMetadata[r]).cueTime = t.pts -
  52622. n, t.cueTime /= 9e4, a.metadata.push(t);
  52623. a.metadata.dispatchType = this.metadataStream.dispatchType, this.videoTrack = null, this
  52624. .audioTrack = null, this.videoTags = [], this.audioTags = [], this.pendingCaptions.length = 0,
  52625. this.pendingMetadata.length = 0, this.pendingTracks = 0, this.processedTracks = 0, this.trigger(
  52626. "data", a), this.trigger("done")
  52627. }
  52628. }, t.exports = n
  52629. }, {
  52630. "../utils/stream.js": 62
  52631. }],
  52632. 44: [function(e, t, i) {
  52633. "use strict";
  52634. var r = e("./flv-tag.js");
  52635. t.exports = function(e, t, i) {
  52636. var n, a, s, o = new Uint8Array(9),
  52637. u = new DataView(o.buffer);
  52638. return e = e || 0, t = void 0 === t || t, i = void 0 === i || i, u.setUint8(0, 70), u.setUint8(1,
  52639. 76), u.setUint8(2, 86), u.setUint8(3, 1), u.setUint8(4, (t ? 4 : 0) | (i ? 1 : 0)), u.setUint32(
  52640. 5, o.byteLength), e <= 0 ? ((a = new Uint8Array(o.byteLength + 4)).set(o), a.set([0, 0, 0, 0], o
  52641. .byteLength), a) : ((n = new r(r.METADATA_TAG)).pts = n.dts = 0, n.writeMetaDataDouble(
  52642. "duration", e), s = n.finalize().length, (a = new Uint8Array(o.byteLength + s)).set(o), a.set(
  52643. u.byteLength, s), a)
  52644. }
  52645. }, {
  52646. "./flv-tag.js": 45
  52647. }],
  52648. 45: [function(e, t, i) {
  52649. "use strict";
  52650. var r;
  52651. (r = function(e, t) {
  52652. var i, n = 0,
  52653. a = 16384,
  52654. s = function(e, t) {
  52655. var i, r = e.position + t;
  52656. r < e.bytes.byteLength || ((i = new Uint8Array(2 * r)).set(e.bytes.subarray(0, e.position), 0),
  52657. e.bytes = i, e.view = new DataView(e.bytes.buffer))
  52658. },
  52659. o = r.widthBytes || new Uint8Array("width".length),
  52660. u = r.heightBytes || new Uint8Array("height".length),
  52661. l = r.videocodecidBytes || new Uint8Array("videocodecid".length);
  52662. if (!r.widthBytes) {
  52663. for (i = 0; i < "width".length; i++) o[i] = "width".charCodeAt(i);
  52664. for (i = 0; i < "height".length; i++) u[i] = "height".charCodeAt(i);
  52665. for (i = 0; i < "videocodecid".length; i++) l[i] = "videocodecid".charCodeAt(i);
  52666. r.widthBytes = o, r.heightBytes = u, r.videocodecidBytes = l
  52667. }
  52668. switch (this.keyFrame = !1, e) {
  52669. case r.VIDEO_TAG:
  52670. this.length = 16, a *= 6;
  52671. break;
  52672. case r.AUDIO_TAG:
  52673. this.length = 13, this.keyFrame = !0;
  52674. break;
  52675. case r.METADATA_TAG:
  52676. this.length = 29, this.keyFrame = !0;
  52677. break;
  52678. default:
  52679. throw new Error("Unknown FLV tag type")
  52680. }
  52681. this.bytes = new Uint8Array(a), this.view = new DataView(this.bytes.buffer), this.bytes[0] = e, this
  52682. .position = this.length, this.keyFrame = t, this.pts = 0, this.dts = 0, this.writeBytes =
  52683. function(e, t, i) {
  52684. var r, n = t || 0;
  52685. r = n + (i = i || e.byteLength), s(this, i), this.bytes.set(e.subarray(n, r), this.position),
  52686. this.position += i, this.length = Math.max(this.length, this.position)
  52687. }, this.writeByte = function(e) {
  52688. s(this, 1), this.bytes[this.position] = e, this.position++, this.length = Math.max(this.length,
  52689. this.position)
  52690. }, this.writeShort = function(e) {
  52691. s(this, 2), this.view.setUint16(this.position, e), this.position += 2, this.length = Math.max(
  52692. this.length, this.position)
  52693. }, this.negIndex = function(e) {
  52694. return this.bytes[this.length - e]
  52695. }, this.nalUnitSize = function() {
  52696. return 0 === n ? 0 : this.length - (n + 4)
  52697. }, this.startNalUnit = function() {
  52698. if (n > 0) throw new Error("Attempted to create new NAL wihout closing the old one");
  52699. n = this.length, this.length += 4, this.position = this.length
  52700. }, this.endNalUnit = function(e) {
  52701. var t, i;
  52702. this.length === n + 4 ? this.length -= 4 : n > 0 && (t = n + 4, i = this.length - t, this
  52703. .position = n, this.view.setUint32(this.position, i), this.position = this.length, e && e
  52704. .push(this.bytes.subarray(t, t + i))), n = 0
  52705. }, this.writeMetaDataDouble = function(e, t) {
  52706. var i;
  52707. if (s(this, 2 + e.length + 9), this.view.setUint16(this.position, e.length), this.position += 2,
  52708. "width" === e) this.bytes.set(o, this.position), this.position += 5;
  52709. else if ("height" === e) this.bytes.set(u, this.position), this.position += 6;
  52710. else if ("videocodecid" === e) this.bytes.set(l, this.position), this.position += 12;
  52711. else
  52712. for (i = 0; i < e.length; i++) this.bytes[this.position] = e.charCodeAt(i), this.position++;
  52713. this.position++, this.view.setFloat64(this.position, t), this.position += 8, this.length = Math
  52714. .max(this.length, this.position), ++n
  52715. }, this.writeMetaDataBoolean = function(e, t) {
  52716. var i;
  52717. for (s(this, 2), this.view.setUint16(this.position, e.length), this.position += 2, i = 0; i < e
  52718. .length; i++) s(this, 1), this.bytes[this.position] = e.charCodeAt(i), this.position++;
  52719. s(this, 2), this.view.setUint8(this.position, 1), this.position++, this.view.setUint8(this
  52720. .position, t ? 1 : 0), this.position++, this.length = Math.max(this.length, this.position),
  52721. ++n
  52722. }, this.finalize = function() {
  52723. var e, i;
  52724. switch (this.bytes[0]) {
  52725. case r.VIDEO_TAG:
  52726. this.bytes[11] = 7 | (this.keyFrame || t ? 16 : 32), this.bytes[12] = t ? 0 : 1, e = this
  52727. .pts - this.dts, this.bytes[13] = (16711680 & e) >>> 16, this.bytes[14] = (65280 & e) >>>
  52728. 8, this.bytes[15] = (255 & e) >>> 0;
  52729. break;
  52730. case r.AUDIO_TAG:
  52731. this.bytes[11] = 175, this.bytes[12] = t ? 0 : 1;
  52732. break;
  52733. case r.METADATA_TAG:
  52734. this.position = 11, this.view.setUint8(this.position, 2), this.position++, this.view
  52735. .setUint16(this.position, 10), this.position += 2, this.bytes.set([111, 110, 77, 101, 116,
  52736. 97, 68, 97, 116, 97
  52737. ], this.position), this.position += 10, this.bytes[this.position] = 8, this.position++,
  52738. this.view.setUint32(this.position, n), this.position = this.length, this.bytes.set([0, 0,
  52739. 9
  52740. ], this.position), this.position += 3, this.length = this.position
  52741. }
  52742. return i = this.length - 11, this.bytes[1] = (16711680 & i) >>> 16, this.bytes[2] = (65280 &
  52743. i) >>> 8, this.bytes[3] = (255 & i) >>> 0, this.bytes[4] = (16711680 & this.dts) >>> 16, this
  52744. .bytes[5] = (65280 & this.dts) >>> 8, this.bytes[6] = (255 & this.dts) >>> 0, this.bytes[7] =
  52745. (4278190080 & this.dts) >>> 24, this.bytes[8] = 0, this.bytes[9] = 0, this.bytes[10] = 0, s(
  52746. this, 4), this.view.setUint32(this.length, this.length), this.length += 4, this.position +=
  52747. 4, this.bytes = this.bytes.subarray(0, this.length), this.frameTime = r.frameTime(this.bytes),
  52748. this
  52749. }
  52750. }).AUDIO_TAG = 8, r.VIDEO_TAG = 9, r.METADATA_TAG = 18, r.isAudioFrame = function(e) {
  52751. return r.AUDIO_TAG === e[0]
  52752. }, r.isVideoFrame = function(e) {
  52753. return r.VIDEO_TAG === e[0]
  52754. }, r.isMetaData = function(e) {
  52755. return r.METADATA_TAG === e[0]
  52756. }, r.isKeyFrame = function(e) {
  52757. return r.isVideoFrame(e) ? 23 === e[11] : !!r.isAudioFrame(e) || !!r.isMetaData(e)
  52758. }, r.frameTime = function(e) {
  52759. var t = e[4] << 16;
  52760. return t |= e[5] << 8, t |= e[6] << 0, t |= e[7] << 24
  52761. }, t.exports = r
  52762. }, {}],
  52763. 46: [function(e, t, i) {
  52764. t.exports = {
  52765. tag: e("./flv-tag"),
  52766. Transmuxer: e("./transmuxer"),
  52767. getFlvHeader: e("./flv-header")
  52768. }
  52769. }, {
  52770. "./flv-header": 44,
  52771. "./flv-tag": 45,
  52772. "./transmuxer": 48
  52773. }],
  52774. 47: [function(e, t, i) {
  52775. "use strict";
  52776. t.exports = function() {
  52777. var e = this;
  52778. this.list = [], this.push = function(e) {
  52779. this.list.push({
  52780. bytes: e.bytes,
  52781. dts: e.dts,
  52782. pts: e.pts,
  52783. keyFrame: e.keyFrame,
  52784. metaDataTag: e.metaDataTag
  52785. })
  52786. }, Object.defineProperty(this, "length", {
  52787. get: function() {
  52788. return e.list.length
  52789. }
  52790. })
  52791. }
  52792. }, {}],
  52793. 48: [function(e, t, i) {
  52794. "use strict";
  52795. var r, n, a, s, o, u, l = e("../utils/stream.js"),
  52796. d = e("./flv-tag.js"),
  52797. c = e("../m2ts/m2ts.js"),
  52798. h = e("../codecs/adts.js"),
  52799. f = e("../codecs/h264").H264Stream,
  52800. p = e("./coalesce-stream.js"),
  52801. m = e("./tag-list.js");
  52802. s = function(e, t) {
  52803. "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts ? e.timelineStartInfo.pts = t.pts :
  52804. e.timelineStartInfo.pts = Math.min(e.timelineStartInfo.pts, t.pts)), "number" == typeof t.dts &&
  52805. (void 0 === e.timelineStartInfo.dts ? e.timelineStartInfo.dts = t.dts : e.timelineStartInfo.dts =
  52806. Math.min(e.timelineStartInfo.dts, t.dts))
  52807. }, o = function(e, t) {
  52808. var i = new d(d.METADATA_TAG);
  52809. return i.dts = t, i.pts = t, i.writeMetaDataDouble("videocodecid", 7), i.writeMetaDataDouble(
  52810. "width", e.width), i.writeMetaDataDouble("height", e.height), i
  52811. }, u = function(e, t) {
  52812. var i, r = new d(d.VIDEO_TAG, !0);
  52813. for (r.dts = t, r.pts = t, r.writeByte(1), r.writeByte(e.profileIdc), r.writeByte(e
  52814. .profileCompatibility), r.writeByte(e.levelIdc), r.writeByte(255), r.writeByte(225), r
  52815. .writeShort(e.sps[0].length), r.writeBytes(e.sps[0]), r.writeByte(e.pps.length), i = 0; i < e.pps
  52816. .length; ++i) r.writeShort(e.pps[i].length), r.writeBytes(e.pps[i]);
  52817. return r
  52818. }, (a = function(e) {
  52819. var t, i = [],
  52820. r = [];
  52821. a.prototype.init.call(this), this.push = function(t) {
  52822. s(e, t), e && (e.audioobjecttype = t.audioobjecttype, e.channelcount = t.channelcount, e
  52823. .samplerate = t.samplerate, e.samplingfrequencyindex = t.samplingfrequencyindex, e
  52824. .samplesize = t.samplesize, e.extraData = e.audioobjecttype << 11 | e
  52825. .samplingfrequencyindex << 7 | e.channelcount << 3), t.pts = Math.round(t.pts / 90), t
  52826. .dts = Math.round(t.dts / 90), i.push(t)
  52827. }, this.flush = function() {
  52828. var n, a, s, o = new m;
  52829. if (0 !== i.length) {
  52830. for (s = -1 / 0; i.length;) n = i.shift(), r.length && n.pts >= r[0] && (s = r.shift(), this
  52831. .writeMetaDataTags(o, s)), (e.extraData !== t || n.pts - s >= 1e3) && (this
  52832. .writeMetaDataTags(o, n.pts), t = e.extraData, s = n.pts), (a = new d(d.AUDIO_TAG))
  52833. .pts = n.pts, a.dts = n.dts, a.writeBytes(n.data), o.push(a.finalize());
  52834. r.length = 0, t = null, this.trigger("data", {
  52835. track: e,
  52836. tags: o.list
  52837. }), this.trigger("done", "AudioSegmentStream")
  52838. } else this.trigger("done", "AudioSegmentStream")
  52839. }, this.writeMetaDataTags = function(t, i) {
  52840. var r;
  52841. (r = new d(d.METADATA_TAG)).pts = i, r.dts = i, r.writeMetaDataDouble("audiocodecid", 10), r
  52842. .writeMetaDataBoolean("stereo", 2 === e.channelcount), r.writeMetaDataDouble(
  52843. "audiosamplerate", e.samplerate), r.writeMetaDataDouble("audiosamplesize", 16), t.push(r
  52844. .finalize()), (r = new d(d.AUDIO_TAG, !0)).pts = i, r.dts = i, r.view.setUint16(r
  52845. .position, e.extraData), r.position += 2, r.length = Math.max(r.length, r.position), t
  52846. .push(r.finalize())
  52847. }, this.onVideoKeyFrame = function(e) {
  52848. r.push(e)
  52849. }
  52850. }).prototype = new l, (n = function(e) {
  52851. var t, i, r = [];
  52852. n.prototype.init.call(this), this.finishFrame = function(r, n) {
  52853. if (n) {
  52854. if (t && e && e.newMetadata && (n.keyFrame || 0 === r.length)) {
  52855. var a = o(t, n.dts).finalize(),
  52856. s = u(e, n.dts).finalize();
  52857. a.metaDataTag = s.metaDataTag = !0, r.push(a), r.push(s), e.newMetadata = !1, this
  52858. .trigger("keyframe", n.dts)
  52859. }
  52860. n.endNalUnit(), r.push(n.finalize()), i = null
  52861. }
  52862. }, this.push = function(t) {
  52863. s(e, t), t.pts = Math.round(t.pts / 90), t.dts = Math.round(t.dts / 90), r.push(t)
  52864. }, this.flush = function() {
  52865. for (var n, a = new m; r.length && "access_unit_delimiter_rbsp" !== r[0].nalUnitType;) r
  52866. .shift();
  52867. if (0 !== r.length) {
  52868. for (; r.length;) "seq_parameter_set_rbsp" === (n = r.shift()).nalUnitType ? (e
  52869. .newMetadata = !0, t = n.config, e.width = t.width, e.height = t.height, e.sps = [n
  52870. .data], e.profileIdc = t.profileIdc, e.levelIdc = t.levelIdc, e.profileCompatibility =
  52871. t.profileCompatibility, i.endNalUnit()) : "pic_parameter_set_rbsp" === n.nalUnitType ? (
  52872. e.newMetadata = !0, e.pps = [n.data], i.endNalUnit()) : "access_unit_delimiter_rbsp" ===
  52873. n.nalUnitType ? (i && this.finishFrame(a, i), (i = new d(d.VIDEO_TAG)).pts = n.pts, i
  52874. .dts = n.dts) : ("slice_layer_without_partitioning_rbsp_idr" === n.nalUnitType && (i
  52875. .keyFrame = !0), i.endNalUnit()), i.startNalUnit(), i.writeBytes(n.data);
  52876. i && this.finishFrame(a, i), this.trigger("data", {
  52877. track: e,
  52878. tags: a.list
  52879. }), this.trigger("done", "VideoSegmentStream")
  52880. } else this.trigger("done", "VideoSegmentStream")
  52881. }
  52882. }).prototype = new l, (r = function(e) {
  52883. var t, i, s, o, u, l, d, m, g, v, y, _, b = this;
  52884. r.prototype.init.call(this), e = e || {}, this.metadataStream = new c.MetadataStream, e
  52885. .metadataStream = this.metadataStream, t = new c.TransportPacketStream, i = new c
  52886. .TransportParseStream, s = new c.ElementaryStream, o = new c.TimestampRolloverStream("video"),
  52887. u = new c.TimestampRolloverStream("audio"), l = new c.TimestampRolloverStream("timed-metadata"),
  52888. d = new h, m = new f, _ = new p(e), t.pipe(i).pipe(s), s.pipe(o).pipe(m), s.pipe(u).pipe(d), s
  52889. .pipe(l).pipe(this.metadataStream).pipe(_), y = new c.CaptionStream, m.pipe(y).pipe(_), s.on(
  52890. "data",
  52891. function(e) {
  52892. var t, i, r;
  52893. if ("metadata" === e.type) {
  52894. for (t = e.tracks.length; t--;) "video" === e.tracks[t].type ? i = e.tracks[t] :
  52895. "audio" === e.tracks[t].type && (r = e.tracks[t]);
  52896. i && !g && (_.numberOfTracks++, g = new n(i), m.pipe(g).pipe(_)), r && !v && (_
  52897. .numberOfTracks++, v = new a(r), d.pipe(v).pipe(_), g && g.on("keyframe", v
  52898. .onVideoKeyFrame))
  52899. }
  52900. }), this.push = function(e) {
  52901. t.push(e)
  52902. }, this.flush = function() {
  52903. t.flush()
  52904. }, this.resetCaptions = function() {
  52905. y.reset()
  52906. }, _.on("data", function(e) {
  52907. b.trigger("data", e)
  52908. }), _.on("done", function() {
  52909. b.trigger("done")
  52910. })
  52911. }).prototype = new l, t.exports = r
  52912. }, {
  52913. "../codecs/adts.js": 40,
  52914. "../codecs/h264": 41,
  52915. "../m2ts/m2ts.js": 50,
  52916. "../utils/stream.js": 62,
  52917. "./coalesce-stream.js": 43,
  52918. "./flv-tag.js": 45,
  52919. "./tag-list.js": 47
  52920. }],
  52921. 49: [function(e, t, i) {
  52922. "use strict";
  52923. var r = e("../utils/stream"),
  52924. n = function() {
  52925. n.prototype.init.call(this), this.captionPackets_ = [], this.ccStreams_ = [new l(0, 0), new l(0, 1),
  52926. new l(1, 0), new l(1, 1)
  52927. ], this.reset(), this.ccStreams_.forEach(function(e) {
  52928. e.on("data", this.trigger.bind(this, "data")), e.on("done", this.trigger.bind(this, "done"))
  52929. }, this)
  52930. };
  52931. n.prototype = new r, n.prototype.push = function(e) {
  52932. var t, i;
  52933. "sei_rbsp" === e.nalUnitType && 4 === (t = function(e) {
  52934. for (var t = 0, i = {
  52935. payloadType: -1,
  52936. payloadSize: 0
  52937. }, r = 0, n = 0; t < e.byteLength && 128 !== e[t];) {
  52938. for (; 255 === e[t];) r += 255, t++;
  52939. for (r += e[t++]; 255 === e[t];) n += 255, t++;
  52940. if (n += e[t++], !i.payload && 4 === r) {
  52941. i.payloadType = r, i.payloadSize = n, i.payload = e.subarray(t, t + n);
  52942. break
  52943. }
  52944. t += n, r = 0, n = 0
  52945. }
  52946. return i
  52947. }(e.escapedRBSP)).payloadType && (i = function(e) {
  52948. return 181 !== e.payload[0] ? null : 49 != (e.payload[1] << 8 | e.payload[2]) ? null :
  52949. "GA94" !== String.fromCharCode(e.payload[3], e.payload[4], e.payload[5], e.payload[6]) ?
  52950. null : 3 !== e.payload[7] ? null : e.payload.subarray(8, e.payload.length - 1)
  52951. }(t)) && (e.dts < this.latestDts_ ? this.ignoreNextEqualDts_ = !0 : e.dts === this.latestDts_ &&
  52952. this.ignoreNextEqualDts_ ? this.ignoreNextEqualDts_ = !1 : (this.captionPackets_ = this
  52953. .captionPackets_.concat(function(e, t) {
  52954. var i, r, n, a, s = [];
  52955. if (!(64 & t[0])) return s;
  52956. for (r = 31 & t[0], i = 0; i < r; i++) a = {
  52957. type: 3 & t[2 + (n = 3 * i)],
  52958. pts: e
  52959. }, 4 & t[n + 2] && (a.ccData = t[n + 3] << 8 | t[n + 4], s.push(a));
  52960. return s
  52961. }(e.pts, i)), this.latestDts_ = e.dts))
  52962. }, n.prototype.flush = function() {
  52963. this.captionPackets_.length ? (this.captionPackets_.forEach(function(e, t) {
  52964. e.presortIndex = t
  52965. }), this.captionPackets_.sort(function(e, t) {
  52966. return e.pts === t.pts ? e.presortIndex - t.presortIndex : e.pts - t.pts
  52967. }), this.captionPackets_.forEach(function(e) {
  52968. e.type < 2 && this.dispatchCea608Packet(e)
  52969. }, this), this.captionPackets_.length = 0, this.ccStreams_.forEach(function(e) {
  52970. e.flush()
  52971. }, this)) : this.ccStreams_.forEach(function(e) {
  52972. e.flush()
  52973. }, this)
  52974. }, n.prototype.reset = function() {
  52975. this.latestDts_ = null, this.ignoreNextEqualDts_ = !1, this.activeCea608Channel_ = [null, null],
  52976. this.ccStreams_.forEach(function(e) {
  52977. e.reset()
  52978. })
  52979. }, n.prototype.dispatchCea608Packet = function(e) {
  52980. this.setsChannel1Active(e) ? this.activeCea608Channel_[e.type] = 0 : this.setsChannel2Active(e) && (
  52981. this.activeCea608Channel_[e.type] = 1), null !== this.activeCea608Channel_[e.type] && this
  52982. .ccStreams_[(e.type << 1) + this.activeCea608Channel_[e.type]].push(e)
  52983. }, n.prototype.setsChannel1Active = function(e) {
  52984. return 4096 == (30720 & e.ccData)
  52985. }, n.prototype.setsChannel2Active = function(e) {
  52986. return 6144 == (30720 & e.ccData)
  52987. };
  52988. var a = {
  52989. 42: 225,
  52990. 92: 233,
  52991. 94: 237,
  52992. 95: 243,
  52993. 96: 250,
  52994. 123: 231,
  52995. 124: 247,
  52996. 125: 209,
  52997. 126: 241,
  52998. 127: 9608,
  52999. 304: 174,
  53000. 305: 176,
  53001. 306: 189,
  53002. 307: 191,
  53003. 308: 8482,
  53004. 309: 162,
  53005. 310: 163,
  53006. 311: 9834,
  53007. 312: 224,
  53008. 313: 160,
  53009. 314: 232,
  53010. 315: 226,
  53011. 316: 234,
  53012. 317: 238,
  53013. 318: 244,
  53014. 319: 251,
  53015. 544: 193,
  53016. 545: 201,
  53017. 546: 211,
  53018. 547: 218,
  53019. 548: 220,
  53020. 549: 252,
  53021. 550: 8216,
  53022. 551: 161,
  53023. 552: 42,
  53024. 553: 39,
  53025. 554: 8212,
  53026. 555: 169,
  53027. 556: 8480,
  53028. 557: 8226,
  53029. 558: 8220,
  53030. 559: 8221,
  53031. 560: 192,
  53032. 561: 194,
  53033. 562: 199,
  53034. 563: 200,
  53035. 564: 202,
  53036. 565: 203,
  53037. 566: 235,
  53038. 567: 206,
  53039. 568: 207,
  53040. 569: 239,
  53041. 570: 212,
  53042. 571: 217,
  53043. 572: 249,
  53044. 573: 219,
  53045. 574: 171,
  53046. 575: 187,
  53047. 800: 195,
  53048. 801: 227,
  53049. 802: 205,
  53050. 803: 204,
  53051. 804: 236,
  53052. 805: 210,
  53053. 806: 242,
  53054. 807: 213,
  53055. 808: 245,
  53056. 809: 123,
  53057. 810: 125,
  53058. 811: 92,
  53059. 812: 94,
  53060. 813: 95,
  53061. 814: 124,
  53062. 815: 126,
  53063. 816: 196,
  53064. 817: 228,
  53065. 818: 214,
  53066. 819: 246,
  53067. 820: 223,
  53068. 821: 165,
  53069. 822: 164,
  53070. 823: 9474,
  53071. 824: 197,
  53072. 825: 229,
  53073. 826: 216,
  53074. 827: 248,
  53075. 828: 9484,
  53076. 829: 9488,
  53077. 830: 9492,
  53078. 831: 9496
  53079. },
  53080. s = function(e) {
  53081. return null === e ? "" : (e = a[e] || e, String.fromCharCode(e))
  53082. },
  53083. o = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152],
  53084. u = function() {
  53085. for (var e = [], t = 15; t--;) e.push("");
  53086. return e
  53087. },
  53088. l = function(e, t) {
  53089. l.prototype.init.call(this), this.field_ = e || 0, this.dataChannel_ = t || 0, this.name_ = "CC" + (
  53090. 1 + (this.field_ << 1 | this.dataChannel_)), this.setConstants(), this.reset(), this.push =
  53091. function(e) {
  53092. var t, i, r, n, a;
  53093. if ((t = 32639 & e.ccData) !== this.lastControlCode_) {
  53094. if (4096 == (61440 & t) ? this.lastControlCode_ = t : t !== this.PADDING_ && (this
  53095. .lastControlCode_ = null), r = t >>> 8, n = 255 & t, t !== this.PADDING_)
  53096. if (t === this.RESUME_CAPTION_LOADING_) this.mode_ = "popOn";
  53097. else if (t === this.END_OF_CAPTION_) this.clearFormatting(e.pts), this.flushDisplayed(e
  53098. .pts), i = this.displayed_, this.displayed_ = this.nonDisplayed_, this.nonDisplayed_ = i,
  53099. this.startPts_ = e.pts;
  53100. else if (t === this.ROLL_UP_2_ROWS_) this.topRow_ = 13, this.mode_ = "rollUp";
  53101. else if (t === this.ROLL_UP_3_ROWS_) this.topRow_ = 12, this.mode_ = "rollUp";
  53102. else if (t === this.ROLL_UP_4_ROWS_) this.topRow_ = 11, this.mode_ = "rollUp";
  53103. else if (t === this.CARRIAGE_RETURN_) this.clearFormatting(e.pts), this.flushDisplayed(e.pts),
  53104. this.shiftRowsUp_(), this.startPts_ = e.pts;
  53105. else if (t === this.BACKSPACE_) "popOn" === this.mode_ ? this.nonDisplayed_[14] = this
  53106. .nonDisplayed_[14].slice(0, -1) : this.displayed_[14] = this.displayed_[14].slice(0, -1);
  53107. else if (t === this.ERASE_DISPLAYED_MEMORY_) this.flushDisplayed(e.pts), this.displayed_ =
  53108. u();
  53109. else if (t === this.ERASE_NON_DISPLAYED_MEMORY_) this.nonDisplayed_ = u();
  53110. else if (t === this.RESUME_DIRECT_CAPTIONING_) this.mode_ = "paintOn";
  53111. else if (this.isSpecialCharacter(r, n)) a = s((r = (3 & r) << 8) | n), this[this.mode_](e.pts,
  53112. a), this.column_++;
  53113. else if (this.isExtCharacter(r, n)) "popOn" === this.mode_ ? this.nonDisplayed_[this.row_] =
  53114. this.nonDisplayed_[this.row_].slice(0, -1) : this.displayed_[14] = this.displayed_[14]
  53115. .slice(0, -1), a = s((r = (3 & r) << 8) | n), this[this.mode_](e.pts, a), this.column_++;
  53116. else if (this.isMidRowCode(r, n)) this.clearFormatting(e.pts), this[this.mode_](e.pts, " "),
  53117. this.column_++, 14 == (14 & n) && this.addFormatting(e.pts, ["i"]), 1 == (1 & n) && this
  53118. .addFormatting(e.pts, ["u"]);
  53119. else if (this.isOffsetControlCode(r, n)) this.column_ += 3 & n;
  53120. else if (this.isPAC(r, n)) {
  53121. var l = o.indexOf(7968 & t);
  53122. l !== this.row_ && (this.clearFormatting(e.pts), this.row_ = l), 1 & n && -1 === this
  53123. .formatting_.indexOf("u") && this.addFormatting(e.pts, ["u"]), 16 == (16 & t) && (this
  53124. .column_ = 4 * ((14 & t) >> 1)), this.isColorPAC(n) && 14 == (14 & n) && this
  53125. .addFormatting(e.pts, ["i"])
  53126. } else this.isNormalChar(r) && (0 === n && (n = null), a = s(r), a += s(n), this[this.mode_](e
  53127. .pts, a), this.column_ += a.length)
  53128. } else this.lastControlCode_ = null
  53129. }
  53130. };
  53131. l.prototype = new r, l.prototype.flushDisplayed = function(e) {
  53132. var t = this.displayed_.map(function(e) {
  53133. return e.trim()
  53134. }).join("\n").replace(/^\n+|\n+$/g, "");
  53135. t.length && this.trigger("data", {
  53136. startPts: this.startPts_,
  53137. endPts: e,
  53138. text: t,
  53139. stream: this.name_
  53140. })
  53141. }, l.prototype.reset = function() {
  53142. this.mode_ = "popOn", this.topRow_ = 0, this.startPts_ = 0, this.displayed_ = u(), this
  53143. .nonDisplayed_ = u(), this.lastControlCode_ = null, this.column_ = 0, this.row_ = 14, this
  53144. .formatting_ = []
  53145. }, l.prototype.setConstants = function() {
  53146. 0 === this.dataChannel_ ? (this.BASE_ = 16, this.EXT_ = 17, this.CONTROL_ = (20 | this.field_) << 8,
  53147. this.OFFSET_ = 23) : 1 === this.dataChannel_ && (this.BASE_ = 24, this.EXT_ = 25, this
  53148. .CONTROL_ = (28 | this.field_) << 8, this.OFFSET_ = 31), this.PADDING_ = 0, this
  53149. .RESUME_CAPTION_LOADING_ = 32 | this.CONTROL_, this.END_OF_CAPTION_ = 47 | this.CONTROL_, this
  53150. .ROLL_UP_2_ROWS_ = 37 | this.CONTROL_, this.ROLL_UP_3_ROWS_ = 38 | this.CONTROL_, this
  53151. .ROLL_UP_4_ROWS_ = 39 | this.CONTROL_, this.CARRIAGE_RETURN_ = 45 | this.CONTROL_, this
  53152. .RESUME_DIRECT_CAPTIONING_ = 41 | this.CONTROL_, this.BACKSPACE_ = 33 | this.CONTROL_, this
  53153. .ERASE_DISPLAYED_MEMORY_ = 44 | this.CONTROL_, this.ERASE_NON_DISPLAYED_MEMORY_ = 46 | this
  53154. .CONTROL_
  53155. }, l.prototype.isSpecialCharacter = function(e, t) {
  53156. return e === this.EXT_ && t >= 48 && t <= 63
  53157. }, l.prototype.isExtCharacter = function(e, t) {
  53158. return (e === this.EXT_ + 1 || e === this.EXT_ + 2) && t >= 32 && t <= 63
  53159. }, l.prototype.isMidRowCode = function(e, t) {
  53160. return e === this.EXT_ && t >= 32 && t <= 47
  53161. }, l.prototype.isOffsetControlCode = function(e, t) {
  53162. return e === this.OFFSET_ && t >= 33 && t <= 35
  53163. }, l.prototype.isPAC = function(e, t) {
  53164. return e >= this.BASE_ && e < this.BASE_ + 8 && t >= 64 && t <= 127
  53165. }, l.prototype.isColorPAC = function(e) {
  53166. return e >= 64 && e <= 79 || e >= 96 && e <= 127
  53167. }, l.prototype.isNormalChar = function(e) {
  53168. return e >= 32 && e <= 127
  53169. }, l.prototype.addFormatting = function(e, t) {
  53170. this.formatting_ = this.formatting_.concat(t);
  53171. var i = t.reduce(function(e, t) {
  53172. return e + "<" + t + ">"
  53173. }, "");
  53174. this[this.mode_](e, i)
  53175. }, l.prototype.clearFormatting = function(e) {
  53176. if (this.formatting_.length) {
  53177. var t = this.formatting_.reverse().reduce(function(e, t) {
  53178. return e + "</" + t + ">"
  53179. }, "");
  53180. this.formatting_ = [], this[this.mode_](e, t)
  53181. }
  53182. }, l.prototype.popOn = function(e, t) {
  53183. var i = this.nonDisplayed_[this.row_];
  53184. i += t, this.nonDisplayed_[this.row_] = i
  53185. }, l.prototype.rollUp = function(e, t) {
  53186. var i = this.displayed_[14];
  53187. i += t, this.displayed_[14] = i
  53188. }, l.prototype.shiftRowsUp_ = function() {
  53189. var e;
  53190. for (e = 0; e < this.topRow_; e++) this.displayed_[e] = "";
  53191. for (e = this.topRow_; e < 14; e++) this.displayed_[e] = this.displayed_[e + 1];
  53192. this.displayed_[14] = ""
  53193. }, l.prototype.paintOn = function() {}, t.exports = {
  53194. CaptionStream: n,
  53195. Cea608Stream: l
  53196. }
  53197. }, {
  53198. "../utils/stream": 62
  53199. }],
  53200. 50: [function(e, t, i) {
  53201. "use strict";
  53202. var r, n, a, s = e("../utils/stream.js"),
  53203. o = e("./caption-stream"),
  53204. u = e("./stream-types"),
  53205. l = e("./timestamp-rollover-stream").TimestampRolloverStream,
  53206. d = e("./stream-types.js");
  53207. (r = function() {
  53208. var e = new Uint8Array(188),
  53209. t = 0;
  53210. r.prototype.init.call(this), this.push = function(i) {
  53211. var r, n = 0,
  53212. a = 188;
  53213. for (t ? ((r = new Uint8Array(i.byteLength + t)).set(e.subarray(0, t)), r.set(i, t), t = 0) :
  53214. r = i; a < r.byteLength;) 71 !== r[n] || 71 !== r[a] ? (n++, a++) : (this.trigger("data", r
  53215. .subarray(n, a)), n += 188, a += 188);
  53216. n < r.byteLength && (e.set(r.subarray(n), 0), t = r.byteLength - n)
  53217. }, this.flush = function() {
  53218. 188 === t && 71 === e[0] && (this.trigger("data", e), t = 0), this.trigger("done")
  53219. }
  53220. }).prototype = new s, (n = function() {
  53221. var e, t, i, r;
  53222. n.prototype.init.call(this), r = this, this.packetsWaitingForPmt = [], this.programMapTable =
  53223. void 0, e = function(e, r) {
  53224. var n = 0;
  53225. r.payloadUnitStartIndicator && (n += e[n] + 1), "pat" === r.type ? t(e.subarray(n), r) : i(e
  53226. .subarray(n), r)
  53227. }, t = function(e, t) {
  53228. t.section_number = e[7], t.last_section_number = e[8], r.pmtPid = (31 & e[10]) << 8 | e[11], t
  53229. .pmtPid = r.pmtPid
  53230. }, i = function(e, t) {
  53231. var i, n;
  53232. if (1 & e[5]) {
  53233. for (r.programMapTable = {
  53234. video: null,
  53235. audio: null,
  53236. "timed-metadata": {}
  53237. }, i = 3 + ((15 & e[1]) << 8 | e[2]) - 4, n = 12 + ((15 & e[10]) << 8 | e[11]); n < i;) {
  53238. var a = e[n],
  53239. s = (31 & e[n + 1]) << 8 | e[n + 2];
  53240. a === u.H264_STREAM_TYPE && null === r.programMapTable.video ? r.programMapTable.video =
  53241. s : a === u.ADTS_STREAM_TYPE && null === r.programMapTable.audio ? r.programMapTable
  53242. .audio = s : a === u.METADATA_STREAM_TYPE && (r.programMapTable["timed-metadata"][s] =
  53243. a), n += 5 + ((15 & e[n + 3]) << 8 | e[n + 4])
  53244. }
  53245. t.programMapTable = r.programMapTable
  53246. }
  53247. }, this.push = function(t) {
  53248. var i = {},
  53249. r = 4;
  53250. if (i.payloadUnitStartIndicator = !!(64 & t[1]), i.pid = 31 & t[1], i.pid <<= 8, i.pid |= t[
  53251. 2], (48 & t[3]) >>> 4 > 1 && (r += t[r] + 1), 0 === i.pid) i.type = "pat", e(t.subarray(r),
  53252. i), this.trigger("data", i);
  53253. else if (i.pid === this.pmtPid)
  53254. for (i.type = "pmt", e(t.subarray(r), i), this.trigger("data", i); this.packetsWaitingForPmt
  53255. .length;) this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  53256. else void 0 === this.programMapTable ? this.packetsWaitingForPmt.push([t, r, i]) : this
  53257. .processPes_(t, r, i)
  53258. }, this.processPes_ = function(e, t, i) {
  53259. i.pid === this.programMapTable.video ? i.streamType = u.H264_STREAM_TYPE : i.pid === this
  53260. .programMapTable.audio ? i.streamType = u.ADTS_STREAM_TYPE : i.streamType = this
  53261. .programMapTable["timed-metadata"][i.pid], i.type = "pes", i.data = e.subarray(t), this
  53262. .trigger("data", i)
  53263. }
  53264. }).prototype = new s, n.STREAM_TYPES = {
  53265. h264: 27,
  53266. adts: 15
  53267. }, (a = function() {
  53268. var e = this,
  53269. t = {
  53270. data: [],
  53271. size: 0
  53272. },
  53273. i = {
  53274. data: [],
  53275. size: 0
  53276. },
  53277. r = {
  53278. data: [],
  53279. size: 0
  53280. },
  53281. n = function(t, i, r) {
  53282. var n, a, s = new Uint8Array(t.size),
  53283. o = {
  53284. type: i
  53285. },
  53286. u = 0,
  53287. l = 0;
  53288. if (t.data.length && !(t.size < 9)) {
  53289. for (o.trackId = t.data[0].pid, u = 0; u < t.data.length; u++) a = t.data[u], s.set(a.data,
  53290. l), l += a.data.byteLength;
  53291. var d, c, h;
  53292. d = s, (c = o).packetLength = 6 + (d[4] << 8 | d[5]), c.dataAlignmentIndicator = 0 != (4 &
  53293. d[6]), 192 & (h = d[7]) && (c.pts = (14 & d[9]) << 27 | (255 & d[10]) << 20 | (254 & d[
  53294. 11]) << 12 | (255 & d[12]) << 5 | (254 & d[13]) >>> 3, c.pts *= 4, c.pts += (6 & d[
  53295. 13]) >>> 1, c.dts = c.pts, 64 & h && (c.dts = (14 & d[14]) << 27 | (255 & d[15]) <<
  53296. 20 | (254 & d[16]) << 12 | (255 & d[17]) << 5 | (254 & d[18]) >>> 3, c.dts *= 4, c
  53297. .dts += (6 & d[18]) >>> 1)), c.data = d.subarray(9 + d[8]), n = "video" === i || o
  53298. .packetLength <= t.size, (r || n) && (t.size = 0, t.data.length = 0), n && e.trigger(
  53299. "data", o)
  53300. }
  53301. };
  53302. a.prototype.init.call(this), this.push = function(a) {
  53303. ({
  53304. pat: function() {},
  53305. pes: function() {
  53306. var e, s;
  53307. switch (a.streamType) {
  53308. case u.H264_STREAM_TYPE:
  53309. case d.H264_STREAM_TYPE:
  53310. e = t, s = "video";
  53311. break;
  53312. case u.ADTS_STREAM_TYPE:
  53313. e = i, s = "audio";
  53314. break;
  53315. case u.METADATA_STREAM_TYPE:
  53316. e = r, s = "timed-metadata";
  53317. break;
  53318. default:
  53319. return
  53320. }
  53321. a.payloadUnitStartIndicator && n(e, s, !0), e.data.push(a), e.size += a.data
  53322. .byteLength
  53323. },
  53324. pmt: function() {
  53325. var t = {
  53326. type: "metadata",
  53327. tracks: []
  53328. },
  53329. i = a.programMapTable;
  53330. null !== i.video && t.tracks.push({
  53331. timelineStartInfo: {
  53332. baseMediaDecodeTime: 0
  53333. },
  53334. id: +i.video,
  53335. codec: "avc",
  53336. type: "video"
  53337. }), null !== i.audio && t.tracks.push({
  53338. timelineStartInfo: {
  53339. baseMediaDecodeTime: 0
  53340. },
  53341. id: +i.audio,
  53342. codec: "adts",
  53343. type: "audio"
  53344. }), e.trigger("data", t)
  53345. }
  53346. })[a.type]()
  53347. }, this.flush = function() {
  53348. n(t, "video"), n(i, "audio"), n(r, "timed-metadata"), this.trigger("done")
  53349. }
  53350. }).prototype = new s;
  53351. var c = {
  53352. PAT_PID: 0,
  53353. MP2T_PACKET_LENGTH: 188,
  53354. TransportPacketStream: r,
  53355. TransportParseStream: n,
  53356. ElementaryStream: a,
  53357. TimestampRolloverStream: l,
  53358. CaptionStream: o.CaptionStream,
  53359. Cea608Stream: o.Cea608Stream,
  53360. MetadataStream: e("./metadata-stream")
  53361. };
  53362. for (var h in u) u.hasOwnProperty(h) && (c[h] = u[h]);
  53363. t.exports = c
  53364. }, {
  53365. "../utils/stream.js": 62,
  53366. "./caption-stream": 49,
  53367. "./metadata-stream": 51,
  53368. "./stream-types": 53,
  53369. "./stream-types.js": 53,
  53370. "./timestamp-rollover-stream": 54
  53371. }],
  53372. 51: [function(e, t, i) {
  53373. "use strict";
  53374. var r, n = e("../utils/stream"),
  53375. a = e("./stream-types"),
  53376. s = function(e, t, i) {
  53377. var r, n = "";
  53378. for (r = t; r < i; r++) n += "%" + ("00" + e[r].toString(16)).slice(-2);
  53379. return n
  53380. },
  53381. o = function(e, t, i) {
  53382. return decodeURIComponent(s(e, t, i))
  53383. },
  53384. u = function(e) {
  53385. return e[0] << 21 | e[1] << 14 | e[2] << 7 | e[3]
  53386. },
  53387. l = {
  53388. TXXX: function(e) {
  53389. var t;
  53390. if (3 === e.data[0]) {
  53391. for (t = 1; t < e.data.length; t++)
  53392. if (0 === e.data[t]) {
  53393. e.description = o(e.data, 1, t), e.value = o(e.data, t + 1, e.data.length).replace(/\0*$/,
  53394. "");
  53395. break
  53396. } e.data = e.value
  53397. }
  53398. },
  53399. WXXX: function(e) {
  53400. var t;
  53401. if (3 === e.data[0])
  53402. for (t = 1; t < e.data.length; t++)
  53403. if (0 === e.data[t]) {
  53404. e.description = o(e.data, 1, t), e.url = o(e.data, t + 1, e.data.length);
  53405. break
  53406. }
  53407. },
  53408. PRIV: function(e) {
  53409. var t, i;
  53410. for (t = 0; t < e.data.length; t++)
  53411. if (0 === e.data[t]) {
  53412. e.owner = (i = e.data, unescape(s(i, 0, t)));
  53413. break
  53414. } e.privateData = e.data.subarray(t + 1), e.data = e.privateData
  53415. }
  53416. };
  53417. (r = function(e) {
  53418. var t, i = {
  53419. debug: !(!e || !e.debug),
  53420. descriptor: e && e.descriptor
  53421. },
  53422. n = 0,
  53423. s = [],
  53424. o = 0;
  53425. if (r.prototype.init.call(this), this.dispatchType = a.METADATA_STREAM_TYPE.toString(16), i
  53426. .descriptor)
  53427. for (t = 0; t < i.descriptor.length; t++) this.dispatchType += ("00" + i.descriptor[t].toString(
  53428. 16)).slice(-2);
  53429. this.push = function(e) {
  53430. var t, r, a, d, c;
  53431. if ("timed-metadata" === e.type)
  53432. if (e.dataAlignmentIndicator && (o = 0, s.length = 0), 0 === s.length && (e.data.length <
  53433. 10 || e.data[0] !== "I".charCodeAt(0) || e.data[1] !== "D".charCodeAt(0) || e.data[2] !==
  53434. "3".charCodeAt(0))) i.debug && console.log("Skipping unrecognized metadata packet");
  53435. else if (s.push(e), o += e.data.byteLength, 1 === s.length && (n = u(e.data.subarray(6, 10)),
  53436. n += 10), !(o < n)) {
  53437. for (t = {
  53438. data: new Uint8Array(n),
  53439. frames: [],
  53440. pts: s[0].pts,
  53441. dts: s[0].dts
  53442. }, c = 0; c < n;) t.data.set(s[0].data.subarray(0, n - c), c), c += s[0].data.byteLength,
  53443. o -= s[0].data.byteLength, s.shift();
  53444. r = 10, 64 & t.data[5] && (r += 4, r += u(t.data.subarray(10, 14)), n -= u(t.data.subarray(16,
  53445. 20)));
  53446. do {
  53447. if ((a = u(t.data.subarray(r + 4, r + 8))) < 1) return console.log(
  53448. "Malformed ID3 frame encountered. Skipping metadata parsing.");
  53449. if ((d = {
  53450. id: String.fromCharCode(t.data[r], t.data[r + 1], t.data[r + 2], t.data[r + 3]),
  53451. data: t.data.subarray(r + 10, r + a + 10)
  53452. }).key = d.id, l[d.id] && (l[d.id](d), "com.apple.streaming.transportStreamTimestamp" ===
  53453. d.owner)) {
  53454. var h = d.data,
  53455. f = (1 & h[3]) << 30 | h[4] << 22 | h[5] << 14 | h[6] << 6 | h[7] >>> 2;
  53456. f *= 4, f += 3 & h[7], d.timeStamp = f, void 0 === t.pts && void 0 === t.dts && (t.pts = d
  53457. .timeStamp, t.dts = d.timeStamp), this.trigger("timestamp", d)
  53458. }
  53459. t.frames.push(d), r += 10, r += a
  53460. } while (r < n);
  53461. this.trigger("data", t)
  53462. }
  53463. }
  53464. }).prototype = new n, t.exports = r
  53465. }, {
  53466. "../utils/stream": 62,
  53467. "./stream-types": 53
  53468. }],
  53469. 52: [function(e, t, i) {
  53470. "use strict";
  53471. var r = e("./stream-types.js"),
  53472. n = function(e) {
  53473. var t = 31 & e[1];
  53474. return t <<= 8, t |= e[2]
  53475. },
  53476. a = function(e) {
  53477. return !!(64 & e[1])
  53478. },
  53479. s = function(e) {
  53480. var t = 0;
  53481. return (48 & e[3]) >>> 4 > 1 && (t += e[4] + 1), t
  53482. },
  53483. o = function(e) {
  53484. switch (e) {
  53485. case 5:
  53486. return "slice_layer_without_partitioning_rbsp_idr";
  53487. case 6:
  53488. return "sei_rbsp";
  53489. case 7:
  53490. return "seq_parameter_set_rbsp";
  53491. case 8:
  53492. return "pic_parameter_set_rbsp";
  53493. case 9:
  53494. return "access_unit_delimiter_rbsp";
  53495. default:
  53496. return null
  53497. }
  53498. };
  53499. t.exports = {
  53500. parseType: function(e, t) {
  53501. var i = n(e);
  53502. return 0 === i ? "pat" : i === t ? "pmt" : t ? "pes" : null
  53503. },
  53504. parsePat: function(e) {
  53505. var t = a(e),
  53506. i = 4 + s(e);
  53507. return t && (i += e[i] + 1), (31 & e[i + 10]) << 8 | e[i + 11]
  53508. },
  53509. parsePmt: function(e) {
  53510. var t = {},
  53511. i = a(e),
  53512. r = 4 + s(e);
  53513. if (i && (r += e[r] + 1), 1 & e[r + 5]) {
  53514. var n;
  53515. n = 3 + ((15 & e[r + 1]) << 8 | e[r + 2]) - 4;
  53516. for (var o = 12 + ((15 & e[r + 10]) << 8 | e[r + 11]); o < n;) {
  53517. var u = r + o;
  53518. t[(31 & e[u + 1]) << 8 | e[u + 2]] = e[u], o += 5 + ((15 & e[u + 3]) << 8 | e[u + 4])
  53519. }
  53520. return t
  53521. }
  53522. },
  53523. parsePayloadUnitStartIndicator: a,
  53524. parsePesType: function(e, t) {
  53525. switch (t[n(e)]) {
  53526. case r.H264_STREAM_TYPE:
  53527. return "video";
  53528. case r.ADTS_STREAM_TYPE:
  53529. return "audio";
  53530. case r.METADATA_STREAM_TYPE:
  53531. return "timed-metadata";
  53532. default:
  53533. return null
  53534. }
  53535. },
  53536. parsePesTime: function(e) {
  53537. if (!a(e)) return null;
  53538. var t = 4 + s(e);
  53539. if (t >= e.byteLength) return null;
  53540. var i, r = null;
  53541. return 192 & (i = e[t + 7]) && ((r = {}).pts = (14 & e[t + 9]) << 27 | (255 & e[t + 10]) << 20 |
  53542. (254 & e[t + 11]) << 12 | (255 & e[t + 12]) << 5 | (254 & e[t + 13]) >>> 3, r.pts *= 4, r
  53543. .pts += (6 & e[t + 13]) >>> 1, r.dts = r.pts, 64 & i && (r.dts = (14 & e[t + 14]) << 27 | (
  53544. 255 & e[t + 15]) << 20 | (254 & e[t + 16]) << 12 | (255 & e[t + 17]) << 5 | (254 & e[t +
  53545. 18]) >>> 3, r.dts *= 4, r.dts += (6 & e[t + 18]) >>> 1)), r
  53546. },
  53547. videoPacketContainsKeyFrame: function(e) {
  53548. for (var t = 4 + s(e), i = e.subarray(t), r = 0, n = 0, a = !1; n < i.byteLength - 3; n++)
  53549. if (1 === i[n + 2]) {
  53550. r = n + 5;
  53551. break
  53552. } for (; r < i.byteLength;) switch (i[r]) {
  53553. case 0:
  53554. if (0 !== i[r - 1]) {
  53555. r += 2;
  53556. break
  53557. }
  53558. if (0 !== i[r - 2]) {
  53559. r++;
  53560. break
  53561. }
  53562. n + 3 !== r - 2 && "slice_layer_without_partitioning_rbsp_idr" === o(31 & i[n + 3]) && (
  53563. a = !0);
  53564. do {
  53565. r++
  53566. } while (1 !== i[r] && r < i.length);
  53567. n = r - 2, r += 3;
  53568. break;
  53569. case 1:
  53570. if (0 !== i[r - 1] || 0 !== i[r - 2]) {
  53571. r += 3;
  53572. break
  53573. }
  53574. "slice_layer_without_partitioning_rbsp_idr" === o(31 & i[n + 3]) && (a = !0), n = r - 2,
  53575. r += 3;
  53576. break;
  53577. default:
  53578. r += 3
  53579. }
  53580. return i = i.subarray(n), r -= n, n = 0, i && i.byteLength > 3 &&
  53581. "slice_layer_without_partitioning_rbsp_idr" === o(31 & i[n + 3]) && (a = !0), a
  53582. }
  53583. }
  53584. }, {
  53585. "./stream-types.js": 53
  53586. }],
  53587. 53: [function(e, t, i) {
  53588. "use strict";
  53589. t.exports = {
  53590. H264_STREAM_TYPE: 27,
  53591. ADTS_STREAM_TYPE: 15,
  53592. METADATA_STREAM_TYPE: 21
  53593. }
  53594. }, {}],
  53595. 54: [function(e, t, i) {
  53596. "use strict";
  53597. var r = e("../utils/stream"),
  53598. n = function(e, t) {
  53599. var i = 1;
  53600. for (e > t && (i = -1); Math.abs(t - e) > 4294967296;) e += 8589934592 * i;
  53601. return e
  53602. },
  53603. a = function(e) {
  53604. var t, i;
  53605. a.prototype.init.call(this), this.type_ = e, this.push = function(e) {
  53606. e.type === this.type_ && (void 0 === i && (i = e.dts), e.dts = n(e.dts, i), e.pts = n(e.pts, i),
  53607. t = e.dts, this.trigger("data", e))
  53608. }, this.flush = function() {
  53609. i = t, this.trigger("done")
  53610. }, this.discontinuity = function() {
  53611. i = void 0, t = void 0
  53612. }
  53613. };
  53614. a.prototype = new r, t.exports = {
  53615. TimestampRolloverStream: a,
  53616. handleRollover: n
  53617. }
  53618. }, {
  53619. "../utils/stream": 62
  53620. }],
  53621. 55: [function(e, t, i) {
  53622. t.exports = {
  53623. generator: e("./mp4-generator"),
  53624. Transmuxer: e("./transmuxer").Transmuxer,
  53625. AudioSegmentStream: e("./transmuxer").AudioSegmentStream,
  53626. VideoSegmentStream: e("./transmuxer").VideoSegmentStream
  53627. }
  53628. }, {
  53629. "./mp4-generator": 56,
  53630. "./transmuxer": 58
  53631. }],
  53632. 56: [function(e, t, i) {
  53633. "use strict";
  53634. var r, n, a, s, o, u, l, d, c, h, f, p, m, g, v, y, _, b, w, E, T, S, A, k, R, M, O, C, D, I, L, x, P,
  53635. U, N, B, F, j, H, G, V, W = Math.pow(2, 32) - 1;
  53636. ! function() {
  53637. var e;
  53638. if (A = {
  53639. avc1: [],
  53640. avcC: [],
  53641. btrt: [],
  53642. dinf: [],
  53643. dref: [],
  53644. esds: [],
  53645. ftyp: [],
  53646. hdlr: [],
  53647. mdat: [],
  53648. mdhd: [],
  53649. mdia: [],
  53650. mfhd: [],
  53651. minf: [],
  53652. moof: [],
  53653. moov: [],
  53654. mp4a: [],
  53655. mvex: [],
  53656. mvhd: [],
  53657. sdtp: [],
  53658. smhd: [],
  53659. stbl: [],
  53660. stco: [],
  53661. stsc: [],
  53662. stsd: [],
  53663. stsz: [],
  53664. stts: [],
  53665. styp: [],
  53666. tfdt: [],
  53667. tfhd: [],
  53668. traf: [],
  53669. trak: [],
  53670. trun: [],
  53671. trex: [],
  53672. tkhd: [],
  53673. vmhd: []
  53674. }, "undefined" != typeof Uint8Array) {
  53675. for (e in A) A.hasOwnProperty(e) && (A[e] = [e.charCodeAt(0), e.charCodeAt(1), e.charCodeAt(2), e
  53676. .charCodeAt(3)
  53677. ]);
  53678. k = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]),
  53679. M = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]),
  53680. R = new Uint8Array([0, 0, 0, 1]), O = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101,
  53681. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0
  53682. ]), C = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  53683. 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0
  53684. ]), D = {
  53685. video: O,
  53686. audio: C
  53687. }, x = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]), L =
  53688. new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), P = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]), U = P, N =
  53689. new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), B = P, I = new Uint8Array([0, 0, 0, 1, 0, 0,
  53690. 0, 0, 0, 0, 0, 0
  53691. ])
  53692. }
  53693. }(), r = function(e) {
  53694. var t, i, r = [],
  53695. n = 0;
  53696. for (t = 1; t < arguments.length; t++) r.push(arguments[t]);
  53697. for (t = r.length; t--;) n += r[t].byteLength;
  53698. for (i = new Uint8Array(n + 8), new DataView(i.buffer, i.byteOffset, i.byteLength).setUint32(0, i
  53699. .byteLength), i.set(e, 4), t = 0, n = 8; t < r.length; t++) i.set(r[t], n), n += r[t]
  53700. .byteLength;
  53701. return i
  53702. }, n = function() {
  53703. return r(A.dinf, r(A.dref, x))
  53704. }, a = function(e) {
  53705. return r(A.esds, new Uint8Array([0, 0, 0, 0, 3, 25, 0, 0, 0, 4, 17, 64, 21, 0, 6, 0, 0, 0, 218, 192,
  53706. 0, 0, 218, 192, 5, 2, e.audioobjecttype << 3 | e.samplingfrequencyindex >>> 1, e
  53707. .samplingfrequencyindex << 7 | e.channelcount << 3, 6, 1, 2
  53708. ]))
  53709. }, s = function() {
  53710. return r(A.ftyp, k, R, k, M)
  53711. }, y = function(e) {
  53712. return r(A.hdlr, D[e])
  53713. }, o = function(e) {
  53714. return r(A.mdat, e)
  53715. }, v = function(e) {
  53716. var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 3, 0, 1, 95, 144, e.duration >>> 24 & 255,
  53717. e.duration >>> 16 & 255, e.duration >>> 8 & 255, 255 & e.duration, 85, 196, 0, 0
  53718. ]);
  53719. return e.samplerate && (t[12] = e.samplerate >>> 24 & 255, t[13] = e.samplerate >>> 16 & 255, t[
  53720. 14] = e.samplerate >>> 8 & 255, t[15] = 255 & e.samplerate), r(A.mdhd, t)
  53721. }, g = function(e) {
  53722. return r(A.mdia, v(e), y(e.type), l(e))
  53723. }, u = function(e) {
  53724. return r(A.mfhd, new Uint8Array([0, 0, 0, 0, (4278190080 & e) >> 24, (16711680 & e) >> 16, (65280 &
  53725. e) >> 8, 255 & e]))
  53726. }, l = function(e) {
  53727. return r(A.minf, "video" === e.type ? r(A.vmhd, I) : r(A.smhd, L), n(), b(e))
  53728. }, d = function(e, t) {
  53729. for (var i = [], n = t.length; n--;) i[n] = E(t[n]);
  53730. return r.apply(null, [A.moof, u(e)].concat(i))
  53731. }, c = function(e) {
  53732. for (var t = e.length, i = []; t--;) i[t] = p(e[t]);
  53733. return r.apply(null, [A.moov, f(4294967295)].concat(i).concat(h(e)))
  53734. }, h = function(e) {
  53735. for (var t = e.length, i = []; t--;) i[t] = T(e[t]);
  53736. return r.apply(null, [A.mvex].concat(i))
  53737. }, f = function(e) {
  53738. var t = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 1, 95, 144, (4278190080 & e) >> 24, (
  53739. 16711680 & e) >> 16, (65280 & e) >> 8, 255 & e, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  53740. 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  53741. 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  53742. 255, 255, 255, 255
  53743. ]);
  53744. return r(A.mvhd, t)
  53745. }, _ = function(e) {
  53746. var t, i, n = e.samples || [],
  53747. a = new Uint8Array(4 + n.length);
  53748. for (i = 0; i < n.length; i++) t = n[i].flags, a[i + 4] = t.dependsOn << 4 | t.isDependedOn << 2 | t
  53749. .hasRedundancy;
  53750. return r(A.sdtp, a)
  53751. }, b = function(e) {
  53752. return r(A.stbl, w(e), r(A.stts, B), r(A.stsc, U), r(A.stsz, N), r(A.stco, P))
  53753. }, w = function(e) {
  53754. return r(A.stsd, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]), "video" === e.type ? F(e) : j(e))
  53755. }, F = function(e) {
  53756. var t, i = e.sps || [],
  53757. n = e.pps || [],
  53758. a = [],
  53759. s = [];
  53760. for (t = 0; t < i.length; t++) a.push((65280 & i[t].byteLength) >>> 8), a.push(255 & i[t]
  53761. .byteLength), a = a.concat(Array.prototype.slice.call(i[t]));
  53762. for (t = 0; t < n.length; t++) s.push((65280 & n[t].byteLength) >>> 8), s.push(255 & n[t]
  53763. .byteLength), s = s.concat(Array.prototype.slice.call(n[t]));
  53764. return r(A.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  53765. 0, 0, (65280 & e.width) >> 8, 255 & e.width, (65280 & e.height) >> 8, 255 & e.height, 0, 72,
  53766. 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 1, 19, 118, 105, 100, 101, 111, 106, 115, 45, 99, 111,
  53767. 110, 116, 114, 105, 98, 45, 104, 108, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17
  53768. ]), r(A.avcC, new Uint8Array([1, e.profileIdc, e.profileCompatibility, e.levelIdc, 255].concat([
  53769. i.length
  53770. ]).concat(a).concat([n.length]).concat(s))), r(A.btrt, new Uint8Array([0, 28, 156, 128, 0, 45,
  53771. 198, 192, 0, 45, 198, 192
  53772. ])))
  53773. }, j = function(e) {
  53774. return r(A.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, (65280 & e
  53775. .channelcount) >> 8, 255 & e.channelcount, (65280 & e.samplesize) >> 8, 255 & e
  53776. .samplesize, 0, 0, 0, 0, (65280 & e.samplerate) >> 8, 255 & e.samplerate, 0, 0
  53777. ]), a(e))
  53778. }, m = function(e) {
  53779. var t = new Uint8Array([0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e
  53780. .id) >> 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 0, (4278190080 & e.duration) >> 24, (
  53781. 16711680 & e.duration) >> 16, (65280 & e.duration) >> 8, 255 & e.duration, 0, 0, 0, 0, 0, 0,
  53782. 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
  53783. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, (65280 & e.width) >> 8, 255 & e.width, 0, 0, (
  53784. 65280 & e.height) >> 8, 255 & e.height, 0, 0
  53785. ]);
  53786. return r(A.tkhd, t)
  53787. }, E = function(e) {
  53788. var t, i, n, a, s, o;
  53789. return t = r(A.tfhd, new Uint8Array([0, 0, 0, 58, (4278190080 & e.id) >> 24, (16711680 & e.id) >>
  53790. 16, (65280 & e.id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  53791. ])), s = Math.floor(e.baseMediaDecodeTime / (W + 1)), o = Math.floor(e.baseMediaDecodeTime % (W +
  53792. 1)), i = r(A.tfdt, new Uint8Array([1, 0, 0, 0, s >>> 24 & 255, s >>> 16 & 255, s >>> 8 & 255,
  53793. 255 & s, o >>> 24 & 255, o >>> 16 & 255, o >>> 8 & 255, 255 & o
  53794. ])), 92, "audio" === e.type ? (n = S(e, 92), r(A.traf, t, i, n)) : (a = _(e), n = S(e, a.length +
  53795. 92), r(A.traf, t, i, n, a))
  53796. }, p = function(e) {
  53797. return e.duration = e.duration || 4294967295, r(A.trak, m(e), g(e))
  53798. }, T = function(e) {
  53799. var t = new Uint8Array([0, 0, 0, 0, (4278190080 & e.id) >> 24, (16711680 & e.id) >> 16, (65280 & e
  53800. .id) >> 8, 255 & e.id, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1]);
  53801. return "video" !== e.type && (t[t.length - 1] = 0), r(A.trex, t)
  53802. }, V = function(e, t) {
  53803. var i = 0,
  53804. r = 0,
  53805. n = 0,
  53806. a = 0;
  53807. return e.length && (void 0 !== e[0].duration && (i = 1), void 0 !== e[0].size && (r = 2), void 0 !==
  53808. e[0].flags && (n = 4), void 0 !== e[0].compositionTimeOffset && (a = 8)), [0, 0, i | r | n | a,
  53809. 1, (4278190080 & e.length) >>> 24, (16711680 & e.length) >>> 16, (65280 & e.length) >>> 8, 255 &
  53810. e.length, (4278190080 & t) >>> 24, (16711680 & t) >>> 16, (65280 & t) >>> 8, 255 & t
  53811. ]
  53812. }, G = function(e, t) {
  53813. var i, n, a, s;
  53814. for (t += 20 + 16 * (n = e.samples || []).length, i = V(n, t), s = 0; s < n.length; s++) a = n[s],
  53815. i = i.concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a
  53816. .duration) >>> 8, 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>>
  53817. 16, (65280 & a.size) >>> 8, 255 & a.size, a.flags.isLeading << 2 | a.flags.dependsOn, a.flags
  53818. .isDependedOn << 6 | a.flags.hasRedundancy << 4 | a.flags.paddingValue << 1 | a.flags
  53819. .isNonSyncSample, 61440 & a.flags.degradationPriority, 15 & a.flags.degradationPriority, (
  53820. 4278190080 & a.compositionTimeOffset) >>> 24, (16711680 & a.compositionTimeOffset) >>> 16, (
  53821. 65280 & a.compositionTimeOffset) >>> 8, 255 & a.compositionTimeOffset
  53822. ]);
  53823. return r(A.trun, new Uint8Array(i))
  53824. }, H = function(e, t) {
  53825. var i, n, a, s;
  53826. for (t += 20 + 8 * (n = e.samples || []).length, i = V(n, t), s = 0; s < n.length; s++) a = n[s],
  53827. i = i.concat([(4278190080 & a.duration) >>> 24, (16711680 & a.duration) >>> 16, (65280 & a
  53828. .duration) >>> 8, 255 & a.duration, (4278190080 & a.size) >>> 24, (16711680 & a.size) >>>
  53829. 16, (65280 & a.size) >>> 8, 255 & a.size
  53830. ]);
  53831. return r(A.trun, new Uint8Array(i))
  53832. }, S = function(e, t) {
  53833. return "audio" === e.type ? H(e, t) : G(e, t)
  53834. }, t.exports = {
  53835. ftyp: s,
  53836. mdat: o,
  53837. moof: d,
  53838. moov: c,
  53839. initSegment: function(e) {
  53840. var t, i = s(),
  53841. r = c(e);
  53842. return (t = new Uint8Array(i.byteLength + r.byteLength)).set(i), t.set(r, i.byteLength), t
  53843. }
  53844. }
  53845. }, {}],
  53846. 57: [function(e, t, i) {
  53847. "use strict";
  53848. var r, n, a, s;
  53849. r = function(e, t) {
  53850. var i, a, s, o, u, l = [];
  53851. if (!t.length) return null;
  53852. for (i = 0; i < e.byteLength;) a = e[i] << 24, a |= e[i + 1] << 16, a |= e[i + 2] << 8, a |= e[i +
  53853. 3], s = n(e.subarray(i + 4, i + 8)), o = a > 1 ? i + a : e.byteLength, s === t[0] && (1 === t
  53854. .length ? l.push(e.subarray(i + 8, o)) : (u = r(e.subarray(i + 8, o), t.slice(1))).length && (
  53855. l = l.concat(u))), i = o;
  53856. return l
  53857. }, n = function(e) {
  53858. var t = "";
  53859. return t += String.fromCharCode(e[0]), t += String.fromCharCode(e[1]), t += String.fromCharCode(e[
  53860. 2]), t += String.fromCharCode(e[3])
  53861. }, a = function(e) {
  53862. return r(e, ["moov", "trak"]).reduce(function(e, t) {
  53863. var i, n, a, s;
  53864. return (i = r(t, ["tkhd"])[0]) ? (a = i[n = 0 === i[0] ? 12 : 20] << 24 | i[n + 1] << 16 | i[
  53865. n + 2] << 8 | i[n + 3], (s = r(t, ["mdia", "mdhd"])[0]) ? (n = 0 === s[0] ? 12 : 20, e[
  53866. a] = s[n] << 24 | s[n + 1] << 16 | s[n + 2] << 8 | s[n + 3], e) : null) : null
  53867. }, {})
  53868. }, s = function(e, t) {
  53869. var i, n, a;
  53870. return i = r(t, ["moof", "traf"]), n = [].concat.apply([], i.map(function(t) {
  53871. return r(t, ["tfhd"]).map(function(i) {
  53872. var n, a;
  53873. return n = i[4] << 24 | i[5] << 16 | i[6] << 8 | i[7], a = e[n] || 9e4, (r(t, [
  53874. "tfdt"]).map(function(e) {
  53875. var t, i;
  53876. return t = e[0], i = e[4] << 24 | e[5] << 16 | e[6] << 8 | e[7], 1 === t && (
  53877. i *= Math.pow(2, 32), i += e[8] << 24 | e[9] << 16 | e[10] << 8 | e[11]),
  53878. i
  53879. })[0] || 1 / 0) / a
  53880. })
  53881. })), a = Math.min.apply(null, n), isFinite(a) ? a : 0
  53882. }, t.exports = {
  53883. parseType: n,
  53884. timescale: a,
  53885. startTime: s
  53886. }
  53887. }, {}],
  53888. 58: [function(e, t, i) {
  53889. "use strict";
  53890. var r, n, a, s, o, u, l, d, c, h, f = e("../utils/stream.js"),
  53891. p = e("./mp4-generator.js"),
  53892. m = e("../m2ts/m2ts.js"),
  53893. g = e("../codecs/adts.js"),
  53894. v = e("../codecs/h264").H264Stream,
  53895. y = e("../aac"),
  53896. _ = e("../data/silence"),
  53897. b = e("../utils/clock"),
  53898. w = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"],
  53899. E = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility"];
  53900. o = function(e) {
  53901. return e[0] === "I".charCodeAt(0) && e[1] === "D".charCodeAt(0) && e[2] === "3".charCodeAt(0)
  53902. }, c = function(e, t) {
  53903. var i;
  53904. if (e.length !== t.length) return !1;
  53905. for (i = 0; i < e.length; i++)
  53906. if (e[i] !== t[i]) return !1;
  53907. return !0
  53908. }, h = function(e) {
  53909. var t, i = 0;
  53910. for (t = 0; t < e.length; t++) i += e[t].data.byteLength;
  53911. return i
  53912. }, (n = function(e) {
  53913. var t = [],
  53914. i = 0,
  53915. r = 0,
  53916. a = 0,
  53917. s = 1 / 0;
  53918. n.prototype.init.call(this), this.push = function(i) {
  53919. u(e, i), e && w.forEach(function(t) {
  53920. e[t] = i[t]
  53921. }), t.push(i)
  53922. }, this.setEarliestDts = function(t) {
  53923. r = t - e.timelineStartInfo.baseMediaDecodeTime
  53924. }, this.setVideoBaseMediaDecodeTime = function(e) {
  53925. s = e
  53926. }, this.setAudioAppendStart = function(e) {
  53927. a = e
  53928. }, this.flush = function() {
  53929. var r, n, a, s;
  53930. 0 !== t.length ? (r = this.trimAdtsFramesByEarliestDts_(t), e.baseMediaDecodeTime = d(e), this
  53931. .prefixWithSilence_(e, r), e.samples = this.generateSampleTable_(r), a = p.mdat(this
  53932. .concatenateFrameData_(r)), t = [], n = p.moof(i, [e]), s = new Uint8Array(n
  53933. .byteLength + a.byteLength), i++, s.set(n), s.set(a, n.byteLength), l(e), this.trigger(
  53934. "data", {
  53935. track: e,
  53936. boxes: s
  53937. }), this.trigger("done", "AudioSegmentStream")) : this.trigger("done",
  53938. "AudioSegmentStream")
  53939. }, this.prefixWithSilence_ = function(e, t) {
  53940. var i, r, n, o, u = 0,
  53941. l = 0,
  53942. d = 0;
  53943. if (t.length && (i = b.audioTsToVideoTs(e.baseMediaDecodeTime, e.samplerate), r = Math.ceil(
  53944. 9e4 / (e.samplerate / 1024)), a && s && (u = i - Math.max(a, s), d = (l = Math.floor(u /
  53945. r)) * r), !(l < 1 || d > 45e3))) {
  53946. for ((n = _[e.samplerate]) || (n = t[0].data), o = 0; o < l; o++) t.splice(o, 0, {
  53947. data: n
  53948. });
  53949. e.baseMediaDecodeTime -= Math.floor(b.videoTsToAudioTs(d, e.samplerate))
  53950. }
  53951. }, this.trimAdtsFramesByEarliestDts_ = function(t) {
  53952. return e.minSegmentDts >= r ? t : (e.minSegmentDts = 1 / 0, t.filter(function(t) {
  53953. return t.dts >= r && (e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), e
  53954. .minSegmentPts = e.minSegmentDts, !0)
  53955. }))
  53956. }, this.generateSampleTable_ = function(e) {
  53957. var t, i, r = [];
  53958. for (t = 0; t < e.length; t++) i = e[t], r.push({
  53959. size: i.data.byteLength,
  53960. duration: 1024
  53961. });
  53962. return r
  53963. }, this.concatenateFrameData_ = function(e) {
  53964. var t, i, r = 0,
  53965. n = new Uint8Array(h(e));
  53966. for (t = 0; t < e.length; t++) i = e[t], n.set(i.data, r), r += i.data.byteLength;
  53967. return n
  53968. }
  53969. }).prototype = new f, (r = function(e, t) {
  53970. var i, n, a = 0,
  53971. s = [],
  53972. o = [];
  53973. t = t || {}, r.prototype.init.call(this), delete e.minPTS, this.gopCache_ = [], this.push =
  53974. function(t) {
  53975. u(e, t), "seq_parameter_set_rbsp" !== t.nalUnitType || i || (i = t.config, e.sps = [t.data], E
  53976. .forEach(function(t) {
  53977. e[t] = i[t]
  53978. }, this)), "pic_parameter_set_rbsp" !== t.nalUnitType || n || (n = t.data, e.pps = [t
  53979. .data]), s.push(t)
  53980. }, this.flush = function() {
  53981. for (var i, r, n, c, h, f; s.length && "access_unit_delimiter_rbsp" !== s[0].nalUnitType;) s
  53982. .shift();
  53983. if (0 === s.length) return this.resetStream_(), void this.trigger("done",
  53984. "VideoSegmentStream");
  53985. if (i = this.groupNalsIntoFrames_(s), (n = this.groupFramesIntoGops_(i))[0][0].keyFrame || ((
  53986. r = this.getGopForFusion_(s[0], e)) ? (n.unshift(r), n.byteLength += r.byteLength, n
  53987. .nalCount += r.nalCount, n.pts = r.pts, n.dts = r.dts, n.duration += r.duration) : n =
  53988. this.extendFirstKeyFrame_(n)), o.length) {
  53989. var m;
  53990. if (!(m = t.alignGopsAtEnd ? this.alignGopsAtEnd_(n) : this.alignGopsAtStart_(n)))
  53991. return this.gopCache_.unshift({
  53992. gop: n.pop(),
  53993. pps: e.pps,
  53994. sps: e.sps
  53995. }), this.gopCache_.length = Math.min(6, this.gopCache_.length), s = [], this
  53996. .resetStream_(), void this.trigger("done", "VideoSegmentStream");
  53997. l(e), n = m
  53998. }
  53999. u(e, n), e.samples = this.generateSampleTable_(n), h = p.mdat(this.concatenateNalData_(n)), e
  54000. .baseMediaDecodeTime = d(e), this.trigger("processedGopsInfo", n.map(function(e) {
  54001. return {
  54002. pts: e.pts,
  54003. dts: e.dts,
  54004. byteLength: e.byteLength
  54005. }
  54006. })), this.gopCache_.unshift({
  54007. gop: n.pop(),
  54008. pps: e.pps,
  54009. sps: e.sps
  54010. }), this.gopCache_.length = Math.min(6, this.gopCache_.length), s = [], this.trigger(
  54011. "baseMediaDecodeTime", e.baseMediaDecodeTime), this.trigger("timelineStartInfo", e
  54012. .timelineStartInfo), c = p.moof(a, [e]), f = new Uint8Array(c.byteLength + h.byteLength),
  54013. a++, f.set(c), f.set(h, c.byteLength), this.trigger("data", {
  54014. track: e,
  54015. boxes: f
  54016. }), this.resetStream_(), this.trigger("done", "VideoSegmentStream")
  54017. }, this.resetStream_ = function() {
  54018. l(e), i = void 0, n = void 0
  54019. }, this.getGopForFusion_ = function(t) {
  54020. var i, r, n, a, s, o = 1 / 0;
  54021. for (s = 0; s < this.gopCache_.length; s++) n = (a = this.gopCache_[s]).gop, e.pps && c(e.pps[
  54022. 0], a.pps[0]) && e.sps && c(e.sps[0], a.sps[0]) && (n.dts < e.timelineStartInfo.dts || (
  54023. i = t.dts - n.dts - n.duration) >= -1e4 && i <= 45e3 && (!r || o > i) && (r = a, o = i));
  54024. return r ? r.gop : null
  54025. }, this.extendFirstKeyFrame_ = function(e) {
  54026. var t;
  54027. return !e[0][0].keyFrame && e.length > 1 && (t = e.shift(), e.byteLength -= t.byteLength, e
  54028. .nalCount -= t.nalCount, e[0][0].dts = t.dts, e[0][0].pts = t.pts, e[0][0].duration += t
  54029. .duration), e
  54030. }, this.groupNalsIntoFrames_ = function(e) {
  54031. var t, i, r = [],
  54032. n = [];
  54033. for (r.byteLength = 0, t = 0; t < e.length; t++) "access_unit_delimiter_rbsp" === (i = e[t])
  54034. .nalUnitType ? (r.length && (r.duration = i.dts - r.dts, n.push(r)), (r = [i]).byteLength =
  54035. i.data.byteLength, r.pts = i.pts, r.dts = i.dts) : (
  54036. "slice_layer_without_partitioning_rbsp_idr" === i.nalUnitType && (r.keyFrame = !0), r
  54037. .duration = i.dts - r.dts, r.byteLength += i.data.byteLength, r.push(i));
  54038. return n.length && (!r.duration || r.duration <= 0) && (r.duration = n[n.length - 1]
  54039. .duration), n.push(r), n
  54040. }, this.groupFramesIntoGops_ = function(e) {
  54041. var t, i, r = [],
  54042. n = [];
  54043. for (r.byteLength = 0, r.nalCount = 0, r.duration = 0, r.pts = e[0].pts, r.dts = e[0].dts, n
  54044. .byteLength = 0, n.nalCount = 0, n.duration = 0, n.pts = e[0].pts, n.dts = e[0].dts, t =
  54045. 0; t < e.length; t++)(i = e[t]).keyFrame ? (r.length && (n.push(r), n.byteLength += r
  54046. .byteLength, n.nalCount += r.nalCount, n.duration += r.duration), (r = [i]).nalCount = i
  54047. .length, r.byteLength = i.byteLength, r.pts = i.pts, r.dts = i.dts, r.duration = i
  54048. .duration) : (r.duration += i.duration, r.nalCount += i.length, r.byteLength += i
  54049. .byteLength, r.push(i));
  54050. return n.length && r.duration <= 0 && (r.duration = n[n.length - 1].duration), n.byteLength +=
  54051. r.byteLength, n.nalCount += r.nalCount, n.duration += r.duration, n.push(r), n
  54052. }, this.generateSampleTable_ = function(e, t) {
  54053. var i, r, n, a, s, o = t || 0,
  54054. u = [];
  54055. for (i = 0; i < e.length; i++)
  54056. for (a = e[i], r = 0; r < a.length; r++) s = a[r], (n = {
  54057. size: 0,
  54058. flags: {
  54059. isLeading: 0,
  54060. dependsOn: 1,
  54061. isDependedOn: 0,
  54062. hasRedundancy: 0,
  54063. degradationPriority: 0
  54064. }
  54065. }).dataOffset = o, n.compositionTimeOffset = s.pts - s.dts, n.duration = s.duration, n
  54066. .size = 4 * s.length, n.size += s.byteLength, s.keyFrame && (n.flags.dependsOn = 2), o +=
  54067. n.size, u.push(n);
  54068. return u
  54069. }, this.concatenateNalData_ = function(e) {
  54070. var t, i, r, n, a, s, o = 0,
  54071. u = e.byteLength,
  54072. l = e.nalCount,
  54073. d = new Uint8Array(u + 4 * l),
  54074. c = new DataView(d.buffer);
  54075. for (t = 0; t < e.length; t++)
  54076. for (n = e[t], i = 0; i < n.length; i++)
  54077. for (a = n[i], r = 0; r < a.length; r++) s = a[r], c.setUint32(o, s.data.byteLength), o +=
  54078. 4, d.set(s.data, o), o += s.data.byteLength;
  54079. return d
  54080. }, this.alignGopsAtStart_ = function(e) {
  54081. var t, i, r, n, a, s, u, l;
  54082. for (a = e.byteLength, s = e.nalCount, u = e.duration, t = i = 0; t < o.length && i < e
  54083. .length && (r = o[t], n = e[i], r.pts !== n.pts);) n.pts > r.pts ? t++ : (i++, a -= n
  54084. .byteLength, s -= n.nalCount, u -= n.duration);
  54085. return 0 === i ? e : i === e.length ? null : ((l = e.slice(i)).byteLength = a, l.duration = u,
  54086. l.nalCount = s, l.pts = l[0].pts, l.dts = l[0].dts, l)
  54087. }, this.alignGopsAtEnd_ = function(e) {
  54088. var t, i, r, n, a, s, u;
  54089. for (t = o.length - 1, i = e.length - 1, a = null, s = !1; t >= 0 && i >= 0;) {
  54090. if (r = o[t], n = e[i], r.pts === n.pts) {
  54091. s = !0;
  54092. break
  54093. }
  54094. r.pts > n.pts ? t-- : (t === o.length - 1 && (a = i), i--)
  54095. }
  54096. if (!s && null === a) return null;
  54097. if (0 === (u = s ? i : a)) return e;
  54098. var l = e.slice(u),
  54099. d = l.reduce(function(e, t) {
  54100. return e.byteLength += t.byteLength, e.duration += t.duration, e.nalCount += t.nalCount,
  54101. e
  54102. }, {
  54103. byteLength: 0,
  54104. duration: 0,
  54105. nalCount: 0
  54106. });
  54107. return l.byteLength = d.byteLength, l.duration = d.duration, l.nalCount = d.nalCount, l.pts =
  54108. l[0].pts, l.dts = l[0].dts, l
  54109. }, this.alignGopsWith = function(e) {
  54110. o = e
  54111. }
  54112. }).prototype = new f, u = function(e, t) {
  54113. "number" == typeof t.pts && (void 0 === e.timelineStartInfo.pts && (e.timelineStartInfo.pts = t
  54114. .pts), void 0 === e.minSegmentPts ? e.minSegmentPts = t.pts : e.minSegmentPts = Math.min(e
  54115. .minSegmentPts, t.pts), void 0 === e.maxSegmentPts ? e.maxSegmentPts = t.pts : e
  54116. .maxSegmentPts = Math.max(e.maxSegmentPts, t.pts)), "number" == typeof t.dts && (void 0 === e
  54117. .timelineStartInfo.dts && (e.timelineStartInfo.dts = t.dts), void 0 === e.minSegmentDts ? e
  54118. .minSegmentDts = t.dts : e.minSegmentDts = Math.min(e.minSegmentDts, t.dts), void 0 === e
  54119. .maxSegmentDts ? e.maxSegmentDts = t.dts : e.maxSegmentDts = Math.max(e.maxSegmentDts, t.dts))
  54120. }, l = function(e) {
  54121. delete e.minSegmentDts, delete e.maxSegmentDts, delete e.minSegmentPts, delete e.maxSegmentPts
  54122. }, d = function(e) {
  54123. var t, i = e.minSegmentDts - e.timelineStartInfo.dts;
  54124. return t = e.timelineStartInfo.baseMediaDecodeTime, t += i, t = Math.max(0, t), "audio" === e
  54125. .type && (t *= e.samplerate / 9e4, t = Math.floor(t)), t
  54126. }, (s = function(e, t) {
  54127. this.numberOfTracks = 0, this.metadataStream = t, void 0 !== e.remux ? this.remuxTracks = !!e
  54128. .remux : this.remuxTracks = !0, this.pendingTracks = [], this.videoTrack = null, this
  54129. .pendingBoxes = [], this.pendingCaptions = [], this.pendingMetadata = [], this.pendingBytes = 0,
  54130. this.emittedTracks = 0, s.prototype.init.call(this), this.push = function(e) {
  54131. return e.text ? this.pendingCaptions.push(e) : e.frames ? this.pendingMetadata.push(e) : (this
  54132. .pendingTracks.push(e.track), this.pendingBoxes.push(e.boxes), this.pendingBytes += e
  54133. .boxes.byteLength, "video" === e.track.type && (this.videoTrack = e.track), void(
  54134. "audio" === e.track.type && (this.audioTrack = e.track)))
  54135. }
  54136. }).prototype = new f, s.prototype.flush = function(e) {
  54137. var t, i, r, n, a = 0,
  54138. s = {
  54139. captions: [],
  54140. captionStreams: {},
  54141. metadata: [],
  54142. info: {}
  54143. },
  54144. o = 0;
  54145. if (this.pendingTracks.length < this.numberOfTracks) {
  54146. if ("VideoSegmentStream" !== e && "AudioSegmentStream" !== e) return;
  54147. if (this.remuxTracks) return;
  54148. if (0 === this.pendingTracks.length) return this.emittedTracks++, void(this.emittedTracks >= this
  54149. .numberOfTracks && (this.trigger("done"), this.emittedTracks = 0))
  54150. }
  54151. for (this.videoTrack ? (o = this.videoTrack.timelineStartInfo.pts, E.forEach(function(e) {
  54152. s.info[e] = this.videoTrack[e]
  54153. }, this)) : this.audioTrack && (o = this.audioTrack.timelineStartInfo.pts, w.forEach(function(e) {
  54154. s.info[e] = this.audioTrack[e]
  54155. }, this)), 1 === this.pendingTracks.length ? s.type = this.pendingTracks[0].type : s.type =
  54156. "combined", this.emittedTracks += this.pendingTracks.length, r = p.initSegment(this
  54157. .pendingTracks), s.initSegment = new Uint8Array(r.byteLength), s.initSegment.set(r), s.data =
  54158. new Uint8Array(this.pendingBytes), n = 0; n < this.pendingBoxes.length; n++) s.data.set(this
  54159. .pendingBoxes[n], a), a += this.pendingBoxes[n].byteLength;
  54160. for (n = 0; n < this.pendingCaptions.length; n++)(t = this.pendingCaptions[n]).startTime = t
  54161. .startPts - o, t.startTime /= 9e4, t.endTime = t.endPts - o, t.endTime /= 9e4, s.captionStreams[t
  54162. .stream] = !0, s.captions.push(t);
  54163. for (n = 0; n < this.pendingMetadata.length; n++)(i = this.pendingMetadata[n]).cueTime = i.pts - o,
  54164. i.cueTime /= 9e4, s.metadata.push(i);
  54165. s.metadata.dispatchType = this.metadataStream.dispatchType, this.pendingTracks.length = 0, this
  54166. .videoTrack = null, this.pendingBoxes.length = 0, this.pendingCaptions.length = 0, this
  54167. .pendingBytes = 0, this.pendingMetadata.length = 0, this.trigger("data", s), this.emittedTracks >=
  54168. this.numberOfTracks && (this.trigger("done"), this.emittedTracks = 0)
  54169. }, (a = function(e) {
  54170. var t, i, u = this,
  54171. d = !0;
  54172. a.prototype.init.call(this), e = e || {}, this.baseMediaDecodeTime = e.baseMediaDecodeTime || 0,
  54173. this.transmuxPipeline_ = {}, this.setupAacPipeline = function() {
  54174. var t = {};
  54175. this.transmuxPipeline_ = t, t.type = "aac", t.metadataStream = new m.MetadataStream, t
  54176. .aacStream = new y, t.audioTimestampRolloverStream = new m.TimestampRolloverStream("audio"),
  54177. t.timedMetadataTimestampRolloverStream = new m.TimestampRolloverStream("timed-metadata"), t
  54178. .adtsStream = new g, t.coalesceStream = new s(e, t.metadataStream), t.headOfPipeline = t
  54179. .aacStream, t.aacStream.pipe(t.audioTimestampRolloverStream).pipe(t.adtsStream), t.aacStream
  54180. .pipe(t.timedMetadataTimestampRolloverStream).pipe(t.metadataStream).pipe(t.coalesceStream),
  54181. t.metadataStream.on("timestamp", function(e) {
  54182. t.aacStream.setTimestamp(e.timeStamp)
  54183. }), t.aacStream.on("data", function(e) {
  54184. "timed-metadata" !== e.type || t.audioSegmentStream || (i = i || {
  54185. timelineStartInfo: {
  54186. baseMediaDecodeTime: u.baseMediaDecodeTime
  54187. },
  54188. codec: "adts",
  54189. type: "audio"
  54190. }, t.coalesceStream.numberOfTracks++, t.audioSegmentStream = new n(i), t.adtsStream
  54191. .pipe(t.audioSegmentStream).pipe(t.coalesceStream))
  54192. }), t.coalesceStream.on("data", this.trigger.bind(this, "data")), t.coalesceStream.on(
  54193. "done", this.trigger.bind(this, "done"))
  54194. }, this.setupTsPipeline = function() {
  54195. var a = {};
  54196. this.transmuxPipeline_ = a, a.type = "ts", a.metadataStream = new m.MetadataStream, a
  54197. .packetStream = new m.TransportPacketStream, a.parseStream = new m.TransportParseStream, a
  54198. .elementaryStream = new m.ElementaryStream, a.videoTimestampRolloverStream = new m
  54199. .TimestampRolloverStream("video"), a.audioTimestampRolloverStream = new m
  54200. .TimestampRolloverStream("audio"), a.timedMetadataTimestampRolloverStream = new m
  54201. .TimestampRolloverStream("timed-metadata"), a.adtsStream = new g, a.h264Stream = new v, a
  54202. .captionStream = new m.CaptionStream, a.coalesceStream = new s(e, a.metadataStream), a
  54203. .headOfPipeline = a.packetStream, a.packetStream.pipe(a.parseStream).pipe(a
  54204. .elementaryStream), a.elementaryStream.pipe(a.videoTimestampRolloverStream).pipe(a
  54205. .h264Stream), a.elementaryStream.pipe(a.audioTimestampRolloverStream).pipe(a.adtsStream),
  54206. a.elementaryStream.pipe(a.timedMetadataTimestampRolloverStream).pipe(a.metadataStream).pipe(
  54207. a.coalesceStream), a.h264Stream.pipe(a.captionStream).pipe(a.coalesceStream), a
  54208. .elementaryStream.on("data", function(s) {
  54209. var o;
  54210. if ("metadata" === s.type) {
  54211. for (o = s.tracks.length; o--;) t || "video" !== s.tracks[o].type ? i || "audio" !== s
  54212. .tracks[o].type || ((i = s.tracks[o]).timelineStartInfo.baseMediaDecodeTime = u
  54213. .baseMediaDecodeTime) : (t = s.tracks[o]).timelineStartInfo.baseMediaDecodeTime =
  54214. u.baseMediaDecodeTime;
  54215. t && !a.videoSegmentStream && (a.coalesceStream.numberOfTracks++, a
  54216. .videoSegmentStream = new r(t, e), a.videoSegmentStream.on("timelineStartInfo",
  54217. function(e) {
  54218. i && (i.timelineStartInfo = e, a.audioSegmentStream.setEarliestDts(e.dts))
  54219. }), a.videoSegmentStream.on("processedGopsInfo", u.trigger.bind(u, "gopInfo")),
  54220. a.videoSegmentStream.on("baseMediaDecodeTime", function(e) {
  54221. i && a.audioSegmentStream.setVideoBaseMediaDecodeTime(e)
  54222. }), a.h264Stream.pipe(a.videoSegmentStream).pipe(a.coalesceStream)), i && !a
  54223. .audioSegmentStream && (a.coalesceStream.numberOfTracks++, a.audioSegmentStream =
  54224. new n(i), a.adtsStream.pipe(a.audioSegmentStream).pipe(a.coalesceStream))
  54225. }
  54226. }), a.coalesceStream.on("data", this.trigger.bind(this, "data")), a.coalesceStream.on(
  54227. "done", this.trigger.bind(this, "done"))
  54228. }, this.setBaseMediaDecodeTime = function(e) {
  54229. var r = this.transmuxPipeline_;
  54230. this.baseMediaDecodeTime = e, i && (i.timelineStartInfo.dts = void 0, i.timelineStartInfo
  54231. .pts = void 0, l(i), i.timelineStartInfo.baseMediaDecodeTime = e, r
  54232. .audioTimestampRolloverStream && r.audioTimestampRolloverStream.discontinuity()), t && (r
  54233. .videoSegmentStream && (r.videoSegmentStream.gopCache_ = [], r
  54234. .videoTimestampRolloverStream.discontinuity()), t.timelineStartInfo.dts = void 0, t
  54235. .timelineStartInfo.pts = void 0, l(t), r.captionStream.reset(), t.timelineStartInfo
  54236. .baseMediaDecodeTime = e), r.timedMetadataTimestampRolloverStream && r
  54237. .timedMetadataTimestampRolloverStream.discontinuity()
  54238. }, this.setAudioAppendStart = function(e) {
  54239. i && this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)
  54240. }, this.alignGopsWith = function(e) {
  54241. t && this.transmuxPipeline_.videoSegmentStream && this.transmuxPipeline_.videoSegmentStream
  54242. .alignGopsWith(e)
  54243. }, this.push = function(e) {
  54244. if (d) {
  54245. var t = o(e);
  54246. t && "aac" !== this.transmuxPipeline_.type ? this.setupAacPipeline() : t || "ts" === this
  54247. .transmuxPipeline_.type || this.setupTsPipeline(), d = !1
  54248. }
  54249. this.transmuxPipeline_.headOfPipeline.push(e)
  54250. }, this.flush = function() {
  54251. d = !0, this.transmuxPipeline_.headOfPipeline.flush()
  54252. }, this.resetCaptions = function() {
  54253. this.transmuxPipeline_.captionStream && this.transmuxPipeline_.captionStream.reset()
  54254. }
  54255. }).prototype = new f, t.exports = {
  54256. Transmuxer: a,
  54257. VideoSegmentStream: r,
  54258. AudioSegmentStream: n,
  54259. AUDIO_PROPERTIES: w,
  54260. VIDEO_PROPERTIES: E
  54261. }
  54262. }, {
  54263. "../aac": 38,
  54264. "../codecs/adts.js": 40,
  54265. "../codecs/h264": 41,
  54266. "../data/silence": 42,
  54267. "../m2ts/m2ts.js": 50,
  54268. "../utils/clock": 60,
  54269. "../utils/stream.js": 62,
  54270. "./mp4-generator.js": 56
  54271. }],
  54272. 59: [function(e, t, i) {
  54273. "use strict";
  54274. var r = e("../m2ts/stream-types.js"),
  54275. n = e("../m2ts/timestamp-rollover-stream.js").handleRollover,
  54276. a = {};
  54277. a.ts = e("../m2ts/probe.js"), a.aac = e("../aac/probe.js");
  54278. var s = function(e, t, i) {
  54279. for (var r, n, s, o, u = 0, l = 188, d = !1; l < e.byteLength;)
  54280. if (71 !== e[u] || 71 !== e[l]) u++, l++;
  54281. else {
  54282. switch (r = e.subarray(u, l), a.ts.parseType(r, t.pid)) {
  54283. case "pes":
  54284. n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "audio" ===
  54285. n && s && (o = a.ts.parsePesTime(r)) && (o.type = "audio", i.audio.push(o), d = !0)
  54286. }
  54287. if (d) break;
  54288. u += 188, l += 188
  54289. } for (u = (l = e.byteLength) - 188, d = !1; u >= 0;)
  54290. if (71 !== e[u] || 71 !== e[l]) u--, l--;
  54291. else {
  54292. switch (r = e.subarray(u, l), a.ts.parseType(r, t.pid)) {
  54293. case "pes":
  54294. n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "audio" ===
  54295. n && s && (o = a.ts.parsePesTime(r)) && (o.type = "audio", i.audio.push(o), d = !0)
  54296. }
  54297. if (d) break;
  54298. u -= 188, l -= 188
  54299. }
  54300. },
  54301. o = function(e, t, i) {
  54302. for (var r, n, s, o, u, l, d, c = 0, h = 188, f = !1, p = {
  54303. data: [],
  54304. size: 0
  54305. }; h < e.byteLength;)
  54306. if (71 !== e[c] || 71 !== e[h]) c++, h++;
  54307. else {
  54308. switch (r = e.subarray(c, h), a.ts.parseType(r, t.pid)) {
  54309. case "pes":
  54310. if (n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r),
  54311. "video" === n && (s && !f && (o = a.ts.parsePesTime(r)) && (o.type = "video", i.video
  54312. .push(o), f = !0), !i.firstKeyFrame)) {
  54313. if (s && 0 !== p.size) {
  54314. for (u = new Uint8Array(p.size), l = 0; p.data.length;) d = p.data.shift(), u.set(d, l),
  54315. l += d.byteLength;
  54316. a.ts.videoPacketContainsKeyFrame(u) && (i.firstKeyFrame = a.ts.parsePesTime(u), i
  54317. .firstKeyFrame.type = "video"), p.size = 0
  54318. }
  54319. p.data.push(r), p.size += r.byteLength
  54320. }
  54321. }
  54322. if (f && i.firstKeyFrame) break;
  54323. c += 188, h += 188
  54324. } for (c = (h = e.byteLength) - 188, f = !1; c >= 0;)
  54325. if (71 !== e[c] || 71 !== e[h]) c--, h--;
  54326. else {
  54327. switch (r = e.subarray(c, h), a.ts.parseType(r, t.pid)) {
  54328. case "pes":
  54329. n = a.ts.parsePesType(r, t.table), s = a.ts.parsePayloadUnitStartIndicator(r), "video" ===
  54330. n && s && (o = a.ts.parsePesTime(r)) && (o.type = "video", i.video.push(o), f = !0)
  54331. }
  54332. if (f) break;
  54333. c -= 188, h -= 188
  54334. }
  54335. },
  54336. u = function(e) {
  54337. var t = {
  54338. pid: null,
  54339. table: null
  54340. },
  54341. i = {};
  54342. for (var n in function(e, t) {
  54343. for (var i, r = 0, n = 188; n < e.byteLength;)
  54344. if (71 !== e[r] || 71 !== e[n]) r++, n++;
  54345. else {
  54346. switch (i = e.subarray(r, n), a.ts.parseType(i, t.pid)) {
  54347. case "pat":
  54348. t.pid || (t.pid = a.ts.parsePat(i));
  54349. break;
  54350. case "pmt":
  54351. t.table || (t.table = a.ts.parsePmt(i))
  54352. }
  54353. if (t.pid && t.table) return;
  54354. r += 188, n += 188
  54355. }
  54356. }(e, t), t.table) {
  54357. if (t.table.hasOwnProperty(n)) switch (t.table[n]) {
  54358. case r.H264_STREAM_TYPE:
  54359. i.video = [], o(e, t, i), 0 === i.video.length && delete i.video;
  54360. break;
  54361. case r.ADTS_STREAM_TYPE:
  54362. i.audio = [], s(e, t, i), 0 === i.audio.length && delete i.audio
  54363. }
  54364. }
  54365. return i
  54366. };
  54367. t.exports = {
  54368. inspect: function(e, t) {
  54369. var i, r;
  54370. return (r = (i = e)[0] === "I".charCodeAt(0) && i[1] === "D".charCodeAt(0) && i[2] === "3"
  54371. .charCodeAt(0) ? function(e) {
  54372. for (var t, i = !1, r = 0, n = null, s = null, o = 0, u = 0; e.length - u >= 3;) {
  54373. switch (a.aac.parseType(e, u)) {
  54374. case "timed-metadata":
  54375. if (e.length - u < 10) {
  54376. i = !0;
  54377. break
  54378. }
  54379. if ((o = a.aac.parseId3TagSize(e, u)) > e.length) {
  54380. i = !0;
  54381. break
  54382. }
  54383. null === s && (t = e.subarray(u, u + o), s = a.aac.parseAacTimestamp(t)), u += o;
  54384. break;
  54385. case "audio":
  54386. if (e.length - u < 7) {
  54387. i = !0;
  54388. break
  54389. }
  54390. if ((o = a.aac.parseAdtsSize(e, u)) > e.length) {
  54391. i = !0;
  54392. break
  54393. }
  54394. null === n && (t = e.subarray(u, u + o), n = a.aac.parseSampleRate(t)), r++, u += o;
  54395. break;
  54396. default:
  54397. u++
  54398. }
  54399. if (i) return null
  54400. }
  54401. if (null === n || null === s) return null;
  54402. var l = 9e4 / n;
  54403. return {
  54404. audio: [{
  54405. type: "audio",
  54406. dts: s,
  54407. pts: s
  54408. }, {
  54409. type: "audio",
  54410. dts: s + 1024 * r * l,
  54411. pts: s + 1024 * r * l
  54412. }]
  54413. }
  54414. }(e) : u(e)) && (r.audio || r.video) ? (function(e, t) {
  54415. if (e.audio && e.audio.length) {
  54416. var i = t;
  54417. void 0 === i && (i = e.audio[0].dts), e.audio.forEach(function(e) {
  54418. e.dts = n(e.dts, i), e.pts = n(e.pts, i), e.dtsTime = e.dts / 9e4, e.ptsTime = e
  54419. .pts / 9e4
  54420. })
  54421. }
  54422. if (e.video && e.video.length) {
  54423. var r = t;
  54424. if (void 0 === r && (r = e.video[0].dts), e.video.forEach(function(e) {
  54425. e.dts = n(e.dts, r), e.pts = n(e.pts, r), e.dtsTime = e.dts / 9e4, e.ptsTime = e
  54426. .pts / 9e4
  54427. }), e.firstKeyFrame) {
  54428. var a = e.firstKeyFrame;
  54429. a.dts = n(a.dts, r), a.pts = n(a.pts, r), a.dtsTime = a.dts / 9e4, a.ptsTime = a.dts /
  54430. 9e4
  54431. }
  54432. }
  54433. }(r, t), r) : null
  54434. }
  54435. }
  54436. }, {
  54437. "../aac/probe.js": 39,
  54438. "../m2ts/probe.js": 52,
  54439. "../m2ts/stream-types.js": 53,
  54440. "../m2ts/timestamp-rollover-stream.js": 54
  54441. }],
  54442. 60: [function(e, t, i) {
  54443. var r, n, a, s, o, u;
  54444. r = function(e) {
  54445. return 9e4 * e
  54446. }, n = function(e, t) {
  54447. return e * t
  54448. }, a = function(e) {
  54449. return e / 9e4
  54450. }, s = function(e, t) {
  54451. return e / t
  54452. }, o = function(e, t) {
  54453. return r(s(e, t))
  54454. }, u = function(e, t) {
  54455. return n(a(e), t)
  54456. }, t.exports = {
  54457. secondsToVideoTs: r,
  54458. secondsToAudioTs: n,
  54459. videoTsToSeconds: a,
  54460. audioTsToSeconds: s,
  54461. audioTsToVideoTs: o,
  54462. videoTsToAudioTs: u
  54463. }
  54464. }, {}],
  54465. 61: [function(e, t, i) {
  54466. "use strict";
  54467. var r;
  54468. r = function(e) {
  54469. var t = e.byteLength,
  54470. i = 0,
  54471. r = 0;
  54472. this.length = function() {
  54473. return 8 * t
  54474. }, this.bitsAvailable = function() {
  54475. return 8 * t + r
  54476. }, this.loadWord = function() {
  54477. var n = e.byteLength - t,
  54478. a = new Uint8Array(4),
  54479. s = Math.min(4, t);
  54480. if (0 === s) throw new Error("no bytes available");
  54481. a.set(e.subarray(n, n + s)), i = new DataView(a.buffer).getUint32(0), r = 8 * s, t -= s
  54482. }, this.skipBits = function(e) {
  54483. var n;
  54484. r > e ? (i <<= e, r -= e) : (e -= r, e -= 8 * (n = Math.floor(e / 8)), t -= n, this.loadWord(),
  54485. i <<= e, r -= e)
  54486. }, this.readBits = function(e) {
  54487. var n = Math.min(r, e),
  54488. a = i >>> 32 - n;
  54489. return (r -= n) > 0 ? i <<= n : t > 0 && this.loadWord(), (n = e - n) > 0 ? a << n | this
  54490. .readBits(n) : a
  54491. }, this.skipLeadingZeros = function() {
  54492. var e;
  54493. for (e = 0; e < r; ++e)
  54494. if (0 != (i & 2147483648 >>> e)) return i <<= e, r -= e, e;
  54495. return this.loadWord(), e + this.skipLeadingZeros()
  54496. }, this.skipUnsignedExpGolomb = function() {
  54497. this.skipBits(1 + this.skipLeadingZeros())
  54498. }, this.skipExpGolomb = function() {
  54499. this.skipBits(1 + this.skipLeadingZeros())
  54500. }, this.readUnsignedExpGolomb = function() {
  54501. var e = this.skipLeadingZeros();
  54502. return this.readBits(e + 1) - 1
  54503. }, this.readExpGolomb = function() {
  54504. var e = this.readUnsignedExpGolomb();
  54505. return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
  54506. }, this.readBoolean = function() {
  54507. return 1 === this.readBits(1)
  54508. }, this.readUnsignedByte = function() {
  54509. return this.readBits(8)
  54510. }, this.loadWord()
  54511. }, t.exports = r
  54512. }, {}],
  54513. 62: [function(e, t, i) {
  54514. "use strict";
  54515. var r = function() {
  54516. this.init = function() {
  54517. var e = {};
  54518. this.on = function(t, i) {
  54519. e[t] || (e[t] = []), e[t] = e[t].concat(i)
  54520. }, this.off = function(t, i) {
  54521. var r;
  54522. return !!e[t] && (r = e[t].indexOf(i), e[t] = e[t].slice(), e[t].splice(r, 1), r > -1)
  54523. }, this.trigger = function(t) {
  54524. var i, r, n, a;
  54525. if (i = e[t])
  54526. if (2 === arguments.length)
  54527. for (n = i.length, r = 0; r < n; ++r) i[r].call(this, arguments[1]);
  54528. else {
  54529. for (a = [], r = arguments.length, r = 1; r < arguments.length; ++r) a.push(arguments[
  54530. r]);
  54531. for (n = i.length, r = 0; r < n; ++r) i[r].apply(this, a)
  54532. }
  54533. }, this.dispose = function() {
  54534. e = {}
  54535. }
  54536. }
  54537. };
  54538. r.prototype.pipe = function(e) {
  54539. return this.on("data", function(t) {
  54540. e.push(t)
  54541. }), this.on("done", function(t) {
  54542. e.flush(t)
  54543. }), e
  54544. }, r.prototype.push = function(e) {
  54545. this.trigger("data", e)
  54546. }, r.prototype.flush = function(e) {
  54547. this.trigger("done", e)
  54548. }, t.exports = r
  54549. }, {}],
  54550. 63: [function(e, t, i) {
  54551. var r, n, a, s, o, u;
  54552. r = this, n = /^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/\;?#]*)?(.*?)??(;.*?)?(\?.*?)?(#.*?)?$/, a =
  54553. /^([^\/;?#]*)(.*)$/, s = /(?:\/|^)\.(?=\/)/g, o = /(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g, u = {
  54554. buildAbsoluteURL: function(e, t, i) {
  54555. if (i = i || {}, e = e.trim(), !(t = t.trim())) {
  54556. if (!i.alwaysNormalize) return e;
  54557. var r = this.parseURL(e);
  54558. if (!r) throw new Error("Error trying to parse base URL.");
  54559. return r.path = u.normalizePath(r.path), u.buildURLFromParts(r)
  54560. }
  54561. var n = this.parseURL(t);
  54562. if (!n) throw new Error("Error trying to parse relative URL.");
  54563. if (n.scheme) return i.alwaysNormalize ? (n.path = u.normalizePath(n.path), u.buildURLFromParts(
  54564. n)) : t;
  54565. var s = this.parseURL(e);
  54566. if (!s) throw new Error("Error trying to parse base URL.");
  54567. if (!s.netLoc && s.path && "/" !== s.path[0]) {
  54568. var o = a.exec(s.path);
  54569. s.netLoc = o[1], s.path = o[2]
  54570. }
  54571. s.netLoc && !s.path && (s.path = "/");
  54572. var l = {
  54573. scheme: s.scheme,
  54574. netLoc: n.netLoc,
  54575. path: null,
  54576. params: n.params,
  54577. query: n.query,
  54578. fragment: n.fragment
  54579. };
  54580. if (!n.netLoc && (l.netLoc = s.netLoc, "/" !== n.path[0]))
  54581. if (n.path) {
  54582. var d = s.path,
  54583. c = d.substring(0, d.lastIndexOf("/") + 1) + n.path;
  54584. l.path = u.normalizePath(c)
  54585. } else l.path = s.path, n.params || (l.params = s.params, n.query || (l.query = s.query));
  54586. return null === l.path && (l.path = i.alwaysNormalize ? u.normalizePath(n.path) : n.path), u
  54587. .buildURLFromParts(l)
  54588. },
  54589. parseURL: function(e) {
  54590. var t = n.exec(e);
  54591. return t ? {
  54592. scheme: t[1] || "",
  54593. netLoc: t[2] || "",
  54594. path: t[3] || "",
  54595. params: t[4] || "",
  54596. query: t[5] || "",
  54597. fragment: t[6] || ""
  54598. } : null
  54599. },
  54600. normalizePath: function(e) {
  54601. for (e = e.split("").reverse().join("").replace(s, ""); e.length !== (e = e.replace(o, ""))
  54602. .length;);
  54603. return e.split("").reverse().join("")
  54604. },
  54605. buildURLFromParts: function(e) {
  54606. return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment
  54607. }
  54608. }, "object" == typeof i && "object" == typeof t ? t.exports = u : "object" == typeof i ? i
  54609. .URLToolkit = u : r.URLToolkit = u
  54610. }, {}],
  54611. 64: [function(e, t, i) {
  54612. (function(r) {
  54613. "use strict";
  54614. function n(e) {
  54615. return e && e.__esModule ? e : {
  54616. default: e
  54617. }
  54618. }
  54619. Object.defineProperty(i, "__esModule", {
  54620. value: !0
  54621. });
  54622. var a = n(e("global/window")),
  54623. s = n("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null),
  54624. o = function(e) {
  54625. return isNaN(e) || Math.abs(e) === 1 / 0 ? Number.MAX_VALUE : e
  54626. };
  54627. i.default = {
  54628. addTextTrackData: function(e, t, i) {
  54629. var r, n = a.default.WebKitDataCue || a.default.VTTCue;
  54630. t && t.forEach(function(e) {
  54631. var t = e.stream;
  54632. this.inbandTextTracks_[t].addCue(new n(e.startTime + this.timestampOffset, e.endTime +
  54633. this.timestampOffset, e.text))
  54634. }, e), i && (r = o(e.mediaSource_.duration), i.forEach(function(e) {
  54635. var t = e.cueTime + this.timestampOffset;
  54636. e.frames.forEach(function(e) {
  54637. var i = new n(t, t, e.value || e.url || e.data || "");
  54638. i.frame = e, i.value = e,
  54639. function(e) {
  54640. Object.defineProperties(e.frame, {
  54641. id: {
  54642. get: function() {
  54643. return s.default.log.warn(
  54644. "cue.frame.id is deprecated. Use cue.value.key instead."),
  54645. e.value.key
  54646. }
  54647. },
  54648. value: {
  54649. get: function() {
  54650. return s.default.log.warn(
  54651. "cue.frame.value is deprecated. Use cue.value.data instead."
  54652. ), e.value.data
  54653. }
  54654. },
  54655. privateData: {
  54656. get: function() {
  54657. return s.default.log.warn(
  54658. "cue.frame.privateData is deprecated. Use cue.value.data instead."
  54659. ), e.value.data
  54660. }
  54661. }
  54662. })
  54663. }(i), this.metadataTrack_.addCue(i)
  54664. }, this)
  54665. }, e), e.metadataTrack_ && e.metadataTrack_.cues && e.metadataTrack_.cues.length &&
  54666. function() {
  54667. for (var t = e.metadataTrack_.cues, i = [], n = 0; n < t.length; n++) t[n] && i.push(
  54668. t[n]);
  54669. var a = i.reduce(function(e, t) {
  54670. var i = e[t.startTime] || [];
  54671. return i.push(t), e[t.startTime] = i, e
  54672. }, {}),
  54673. s = Object.keys(a).sort(function(e, t) {
  54674. return Number(e) - Number(t)
  54675. });
  54676. s.forEach(function(e, t) {
  54677. var i = a[e],
  54678. n = Number(s[t + 1]) || r;
  54679. i.forEach(function(e) {
  54680. e.endTime = n
  54681. })
  54682. })
  54683. }())
  54684. },
  54685. durationOfVideo: o
  54686. }, t.exports = i.default
  54687. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  54688. typeof window ? window : {})
  54689. }, {
  54690. "global/window": 32
  54691. }],
  54692. 65: [function(e, t, i) {
  54693. "use strict";
  54694. Object.defineProperty(i, "__esModule", {
  54695. value: !0
  54696. });
  54697. i.default = {
  54698. isAudioCodec: function(e) {
  54699. return /mp4a\.\d+.\d+/i.test(e)
  54700. },
  54701. parseContentType: function(e) {
  54702. var t = {
  54703. type: "",
  54704. parameters: {}
  54705. },
  54706. i = e.trim().split(";");
  54707. return t.type = i.shift().trim(), i.forEach(function(e) {
  54708. var i = e.trim().split("=");
  54709. if (i.length > 1) {
  54710. var r = i[0].replace(/"/g, "").trim(),
  54711. n = i[1].replace(/"/g, "").trim();
  54712. t.parameters[r] = n
  54713. }
  54714. }), t
  54715. },
  54716. isVideoCodec: function(e) {
  54717. return /avc1\.[\da-f]+/i.test(e)
  54718. },
  54719. translateLegacyCodecs: function(e) {
  54720. return e.map(function(e) {
  54721. return e.replace(/avc1\.(\d+)\.(\d+)/i, function(e, t, i) {
  54722. return "avc1." + ("00" + Number(t).toString(16)).slice(-2) + "00" + ("00" + Number(
  54723. i).toString(16)).slice(-2)
  54724. })
  54725. })
  54726. }
  54727. }, t.exports = i.default
  54728. }, {}],
  54729. 66: [function(e, t, i) {
  54730. "use strict";
  54731. Object.defineProperty(i, "__esModule", {
  54732. value: !0
  54733. });
  54734. i.default = function(e, t, i) {
  54735. var r = t.player_;
  54736. if (i.captions && i.captions.length)
  54737. for (var n in e.inbandTextTracks_ || (e.inbandTextTracks_ = {}), i.captionStreams)
  54738. if (!e.inbandTextTracks_[n]) {
  54739. r.tech_.trigger({
  54740. type: "usage",
  54741. name: "hls-608"
  54742. });
  54743. var a = r.textTracks().getTrackById(n);
  54744. e.inbandTextTracks_[n] = a || r.addRemoteTextTrack({
  54745. kind: "captions",
  54746. id: n,
  54747. label: n
  54748. }, !1).track
  54749. } i.metadata && i.metadata.length && !e.metadataTrack_ && (e.metadataTrack_ = r
  54750. .addRemoteTextTrack({
  54751. kind: "metadata",
  54752. label: "Timed Metadata"
  54753. }, !1).track, e.metadataTrack_.inBandMetadataTrackDispatchType = i.metadata.dispatchType)
  54754. }, t.exports = i.default
  54755. }, {}],
  54756. 67: [function(e, t, i) {
  54757. "use strict";
  54758. Object.defineProperty(i, "__esModule", {
  54759. value: !0
  54760. });
  54761. i.default = {
  54762. TIME_BETWEEN_CHUNKS: 1,
  54763. BYTES_PER_CHUNK: 32768
  54764. }, t.exports = i.default
  54765. }, {}],
  54766. 68: [function(e, t, i) {
  54767. (function(r) {
  54768. "use strict";
  54769. Object.defineProperty(i, "__esModule", {
  54770. value: !0
  54771. });
  54772. var n = function() {
  54773. function e(e, t) {
  54774. for (var i = 0; i < t.length; i++) {
  54775. var r = t[i];
  54776. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  54777. Object.defineProperty(e, r.key, r)
  54778. }
  54779. }
  54780. return function(t, i, r) {
  54781. return i && e(t.prototype, i), r && e(t, r), t
  54782. }
  54783. }(),
  54784. a = function(e, t, i) {
  54785. for (var r = !0; r;) {
  54786. var n = e,
  54787. a = t,
  54788. s = i;
  54789. r = !1, null === n && (n = Function.prototype);
  54790. var o = Object.getOwnPropertyDescriptor(n, a);
  54791. if (void 0 !== o) {
  54792. if ("value" in o) return o.value;
  54793. var u = o.get;
  54794. if (void 0 === u) return;
  54795. return u.call(s)
  54796. }
  54797. var l = Object.getPrototypeOf(n);
  54798. if (null === l) return;
  54799. e = l, t = a, i = s, r = !0, o = l = void 0
  54800. }
  54801. };
  54802. function s(e) {
  54803. return e && e.__esModule ? e : {
  54804. default: e
  54805. }
  54806. }
  54807. var o = s(e("global/document")),
  54808. u = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null),
  54809. l = s(e("./flash-source-buffer")),
  54810. d = s(e("./flash-constants")),
  54811. c = e("./codec-utils"),
  54812. h = function(e) {
  54813. function t() {
  54814. var e = this;
  54815. ! function(e, t) {
  54816. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  54817. }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this), this
  54818. .sourceBuffers = [], this.readyState = "closed", this.on(["sourceopen", "webkitsourceopen"],
  54819. function(t) {
  54820. e.swfObj = o.default.getElementById(t.swfId), e.player_ = (0, u.default)(e.swfObj
  54821. .parentNode), e.tech_ = e.swfObj.tech, e.readyState = "open", e.tech_.on("seeking",
  54822. function() {
  54823. for (var t = e.sourceBuffers.length; t--;) e.sourceBuffers[t].abort()
  54824. }), e.swfObj && e.swfObj.vjs_load()
  54825. })
  54826. }
  54827. return function(e, t) {
  54828. if ("function" != typeof t && null !== t) throw new TypeError(
  54829. "Super expression must either be null or a function, not " + typeof t);
  54830. e.prototype = Object.create(t && t.prototype, {
  54831. constructor: {
  54832. value: e,
  54833. enumerable: !1,
  54834. writable: !0,
  54835. configurable: !0
  54836. }
  54837. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  54838. }(t, u["default"].EventTarget), n(t, [{
  54839. key: "addSeekableRange_",
  54840. value: function() {}
  54841. }, {
  54842. key: "addSourceBuffer",
  54843. value: function(e) {
  54844. var t = (0, c.parseContentType)(e),
  54845. i = void 0;
  54846. if ("video/mp2t" !== t.type && "audio/mp2t" !== t.type) throw new Error(
  54847. "NotSupportedError (Video.js)");
  54848. return i = new l.default(this), this.sourceBuffers.push(i), i
  54849. }
  54850. }, {
  54851. key: "endOfStream",
  54852. value: function(e) {
  54853. "network" === e ? this.tech_.error(2) : "decode" === e && this.tech_.error(3),
  54854. "ended" !== this.readyState && (this.readyState = "ended", this.swfObj
  54855. .vjs_endOfStream())
  54856. }
  54857. }]), t
  54858. }();
  54859. i.default = h;
  54860. try {
  54861. Object.defineProperty(h.prototype, "duration", {
  54862. get: function() {
  54863. return this.swfObj ? this.swfObj.vjs_getProperty("duration") : NaN
  54864. },
  54865. set: function(e) {
  54866. var t = void 0,
  54867. i = this.swfObj.vjs_getProperty("duration");
  54868. if (this.swfObj.vjs_setProperty("duration", e), e < i)
  54869. for (t = 0; t < this.sourceBuffers.length; t++) this.sourceBuffers[t].remove(e, i);
  54870. return e
  54871. }
  54872. })
  54873. } catch (e) {
  54874. h.prototype.duration = NaN
  54875. }
  54876. for (var f in d.default) h[f] = d.default[f];
  54877. t.exports = i.default
  54878. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  54879. typeof window ? window : {})
  54880. }, {
  54881. "./codec-utils": 65,
  54882. "./flash-constants": 67,
  54883. "./flash-source-buffer": 69,
  54884. "global/document": 31
  54885. }],
  54886. 69: [function(e, t, i) {
  54887. (function(r) {
  54888. "use strict";
  54889. Object.defineProperty(i, "__esModule", {
  54890. value: !0
  54891. });
  54892. var n = function() {
  54893. function e(e, t) {
  54894. for (var i = 0; i < t.length; i++) {
  54895. var r = t[i];
  54896. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  54897. Object.defineProperty(e, r.key, r)
  54898. }
  54899. }
  54900. return function(t, i, r) {
  54901. return i && e(t.prototype, i), r && e(t, r), t
  54902. }
  54903. }(),
  54904. a = function(e, t, i) {
  54905. for (var r = !0; r;) {
  54906. var n = e,
  54907. a = t,
  54908. s = i;
  54909. r = !1, null === n && (n = Function.prototype);
  54910. var o = Object.getOwnPropertyDescriptor(n, a);
  54911. if (void 0 !== o) {
  54912. if ("value" in o) return o.value;
  54913. var u = o.get;
  54914. if (void 0 === u) return;
  54915. return u.call(s)
  54916. }
  54917. var l = Object.getPrototypeOf(n);
  54918. if (null === l) return;
  54919. e = l, t = a, i = s, r = !0, o = l = void 0
  54920. }
  54921. };
  54922. function s(e) {
  54923. return e && e.__esModule ? e : {
  54924. default: e
  54925. }
  54926. }
  54927. var o = s(e("global/window")),
  54928. u = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null),
  54929. l = s(e("mux.js/lib/flv")),
  54930. d = s(e("./remove-cues-from-track")),
  54931. c = s(e("./create-text-tracks-if-necessary")),
  54932. h = e("./add-text-track-data"),
  54933. f = s(e("./flash-transmuxer-worker")),
  54934. p = s(e("webwackify")),
  54935. m = s(e("./flash-constants")),
  54936. g = function() {
  54937. var t = void 0;
  54938. try {
  54939. t = e.resolve("./flash-transmuxer-worker")
  54940. } catch (e) {}
  54941. return t
  54942. },
  54943. v = function(e) {
  54944. o.default.setTimeout(e, m.default.TIME_BETWEEN_CHUNKS)
  54945. },
  54946. y = function() {
  54947. return Math.random().toString(36).slice(2, 8)
  54948. },
  54949. _ = function(e, t) {
  54950. ("number" != typeof t || t < 0) && (t = 0);
  54951. var i = Math.pow(10, t);
  54952. return Math.round(e * i) / i
  54953. },
  54954. b = function(e) {
  54955. function t(e) {
  54956. var i = this;
  54957. ! function(e, t) {
  54958. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  54959. }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this);
  54960. var r;
  54961. this.chunkSize_ = m.default.BYTES_PER_CHUNK, this.buffer_ = [], this.bufferSize_ = 0, this
  54962. .basePtsOffset_ = NaN, this.mediaSource_ = e, this.audioBufferEnd_ = NaN, this
  54963. .videoBufferEnd_ = NaN, this.updating = !1, this.timestampOffset_ = 0, r = o.default.btoa(
  54964. String.fromCharCode.apply(null, Array.prototype.slice.call(l.default.getFlvHeader())));
  54965. var n = this.mediaSource_.player_.id().replace(/[^a-zA-Z0-9]/g, "_");
  54966. this.flashEncodedHeaderName_ = "vjs_flashEncodedHeader_" + n + y(), this
  54967. .flashEncodedDataName_ = "vjs_flashEncodedData_" + n + y(), o.default[this
  54968. .flashEncodedHeaderName_] = function() {
  54969. return delete o.default[i.flashEncodedHeaderName_], r
  54970. }, this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedHeaderName_), this
  54971. .transmuxer_ = (0, p.default)(f.default, g()), this.transmuxer_.postMessage({
  54972. action: "init",
  54973. options: {}
  54974. }), this.transmuxer_.onmessage = function(e) {
  54975. "data" === e.data.action && i.receiveBuffer_(e.data.segment)
  54976. }, this.one("updateend", function() {
  54977. i.mediaSource_.tech_.trigger("loadedmetadata")
  54978. }), Object.defineProperty(this, "timestampOffset", {
  54979. get: function() {
  54980. return this.timestampOffset_
  54981. },
  54982. set: function(e) {
  54983. "number" == typeof e && e >= 0 && (this.timestampOffset_ = e, this.mediaSource_
  54984. .swfObj.vjs_discontinuity(), this.basePtsOffset_ = NaN, this.audioBufferEnd_ =
  54985. NaN, this.videoBufferEnd_ = NaN, this.transmuxer_.postMessage({
  54986. action: "reset"
  54987. }))
  54988. }
  54989. }), Object.defineProperty(this, "buffered", {
  54990. get: function() {
  54991. if (!(this.mediaSource_ && this.mediaSource_.swfObj && "vjs_getProperty" in this
  54992. .mediaSource_.swfObj)) return u.default.createTimeRange();
  54993. var e = this.mediaSource_.swfObj.vjs_getProperty("buffered");
  54994. return e && e.length && (e[0][0] = _(e[0][0], 3), e[0][1] = _(e[0][1], 3)), u
  54995. .default.createTimeRanges(e)
  54996. }
  54997. }), this.mediaSource_.player_.on("seeked", function() {
  54998. if ((0, d.default)(0, 1 / 0, i.metadataTrack_), i.inbandTextTracks_)
  54999. for (var e in i.inbandTextTracks_)(0, d.default)(0, 1 / 0, i.inbandTextTracks_[e])
  55000. });
  55001. var s = this.onHlsReset_.bind(this);
  55002. this.mediaSource_.player_.tech_.on("hls-reset", s), this.mediaSource_.player_.tech_.hls.on(
  55003. "dispose",
  55004. function() {
  55005. i.transmuxer_.terminate(), i.mediaSource_.player_.tech_.off("hls-reset", s)
  55006. })
  55007. }
  55008. return function(e, t) {
  55009. if ("function" != typeof t && null !== t) throw new TypeError(
  55010. "Super expression must either be null or a function, not " + typeof t);
  55011. e.prototype = Object.create(t && t.prototype, {
  55012. constructor: {
  55013. value: e,
  55014. enumerable: !1,
  55015. writable: !0,
  55016. configurable: !0
  55017. }
  55018. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  55019. }(t, u["default"].EventTarget), n(t, [{
  55020. key: "appendBuffer",
  55021. value: function(e) {
  55022. var t = void 0;
  55023. if (this.updating) throw (t = new Error(
  55024. "SourceBuffer.append() cannot be called while an update is in progress"))
  55025. .name = "InvalidStateError", t.code = 11, t;
  55026. this.updating = !0, this.mediaSource_.readyState = "open", this.trigger({
  55027. type: "update"
  55028. }), this.transmuxer_.postMessage({
  55029. action: "push",
  55030. data: e.buffer,
  55031. byteOffset: e.byteOffset,
  55032. byteLength: e.byteLength
  55033. }, [e.buffer]), this.transmuxer_.postMessage({
  55034. action: "flush"
  55035. })
  55036. }
  55037. }, {
  55038. key: "abort",
  55039. value: function() {
  55040. this.buffer_ = [], this.bufferSize_ = 0, this.mediaSource_.swfObj.vjs_abort(), this
  55041. .updating && (this.updating = !1, this.trigger({
  55042. type: "updateend"
  55043. }))
  55044. }
  55045. }, {
  55046. key: "remove",
  55047. value: function(e, t) {
  55048. if ((0, d.default)(e, t, this.metadataTrack_), this.inbandTextTracks_)
  55049. for (var i in this.inbandTextTracks_)(0, d.default)(e, t, this.inbandTextTracks_[
  55050. i]);
  55051. this.trigger({
  55052. type: "update"
  55053. }), this.trigger({
  55054. type: "updateend"
  55055. })
  55056. }
  55057. }, {
  55058. key: "receiveBuffer_",
  55059. value: function(e) {
  55060. var t = this;
  55061. (0, c.default)(this, this.mediaSource_, e), (0, h.addTextTrackData)(this, e
  55062. .captions, e.metadata), v(function() {
  55063. var i = t.convertTagsToData_(e);
  55064. 0 === t.buffer_.length && v(t.processBuffer_.bind(t)), i && (t.buffer_.push(
  55065. i), t.bufferSize_ += i.byteLength)
  55066. })
  55067. }
  55068. }, {
  55069. key: "processBuffer_",
  55070. value: function() {
  55071. var e = this,
  55072. t = m.default.BYTES_PER_CHUNK;
  55073. if (this.buffer_.length) {
  55074. var i = this.buffer_[0].subarray(0, t);
  55075. i.byteLength < t || this.buffer_[0].byteLength === t ? this.buffer_.shift() : this
  55076. .buffer_[0] = this.buffer_[0].subarray(t), this.bufferSize_ -= i.byteLength;
  55077. for (var r = [], n = i.byteLength, a = 0; a < n; a++) r.push(String.fromCharCode(
  55078. i[a]));
  55079. var s = o.default.btoa(r.join(""));
  55080. o.default[this.flashEncodedDataName_] = function() {
  55081. return v(e.processBuffer_.bind(e)), delete o.default[e.flashEncodedDataName_],
  55082. s
  55083. }, this.mediaSource_.swfObj.vjs_appendChunkReady(this.flashEncodedDataName_)
  55084. } else !1 !== this.updating && (this.updating = !1, this.trigger({
  55085. type: "updateend"
  55086. }))
  55087. }
  55088. }, {
  55089. key: "convertTagsToData_",
  55090. value: function(e) {
  55091. var t = 0,
  55092. i = this.mediaSource_.tech_,
  55093. r = 0,
  55094. n = void 0,
  55095. a = e.tags.videoTags,
  55096. s = e.tags.audioTags;
  55097. if (isNaN(this.basePtsOffset_) && (a.length || s.length)) {
  55098. var o = a[0] || {
  55099. pts: 1 / 0
  55100. },
  55101. u = s[0] || {
  55102. pts: 1 / 0
  55103. };
  55104. this.basePtsOffset_ = Math.min(u.pts, o.pts)
  55105. }
  55106. i.seeking() && (this.videoBufferEnd_ = NaN, this.audioBufferEnd_ = NaN), isNaN(this
  55107. .videoBufferEnd_) ? (i.buffered().length && (r = i.buffered().end(0) - this
  55108. .timestampOffset), i.seeking() && (r = Math.max(r, i.currentTime() - this
  55109. .timestampOffset)), r *= 1e3, r += this.basePtsOffset_) : r = this
  55110. .videoBufferEnd_ + .1;
  55111. var l = a.length;
  55112. if (l && a[l - 1].pts >= r) {
  55113. for (; --l;) {
  55114. var d = a[l];
  55115. if (!(d.pts > r) && (d.keyFrame || d.metaDataTag)) break
  55116. }
  55117. for (; l;) {
  55118. if (!a[l - 1].metaDataTag) break;
  55119. l--
  55120. }
  55121. }
  55122. var c = a.slice(l),
  55123. h = void 0;
  55124. for (h = isNaN(this.audioBufferEnd_) ? r : this.audioBufferEnd_ + .1, c.length && (
  55125. h = Math.min(h, c[0].pts)), l = 0; l < s.length && !(s[l].pts >= h);) l++;
  55126. var f = s.slice(l);
  55127. f.length && (this.audioBufferEnd_ = f[f.length - 1].pts), c.length && (this
  55128. .videoBufferEnd_ = c[c.length - 1].pts);
  55129. var p = this.getOrderedTags_(c, f);
  55130. if (0 !== p.length) {
  55131. if (p[0].pts < r && i.seeking()) {
  55132. var m = i.currentTime() - (r - p[0].pts) / 1e3;
  55133. m < 1 / 30 && (m = 0);
  55134. try {
  55135. this.mediaSource_.swfObj.vjs_adjustCurrentTime(m)
  55136. } catch (e) {}
  55137. }
  55138. for (var g = 0; g < p.length; g++) t += p[g].bytes.byteLength;
  55139. n = new Uint8Array(t);
  55140. g = 0;
  55141. for (var v = 0; g < p.length; g++) n.set(p[g].bytes, v), v += p[g].bytes
  55142. .byteLength;
  55143. return n
  55144. }
  55145. }
  55146. }, {
  55147. key: "getOrderedTags_",
  55148. value: function(e, t) {
  55149. for (var i = void 0, r = []; e.length || t.length;) i = e.length ? t.length && t[0]
  55150. .dts < e[0].dts ? t.shift() : e.shift() : t.shift(), r.push(i);
  55151. return r
  55152. }
  55153. }, {
  55154. key: "onHlsReset_",
  55155. value: function() {
  55156. this.transmuxer_.postMessage({
  55157. action: "resetCaptions"
  55158. })
  55159. }
  55160. }]), t
  55161. }();
  55162. i.default = b, t.exports = i.default
  55163. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  55164. typeof window ? window : {})
  55165. }, {
  55166. "./add-text-track-data": 64,
  55167. "./create-text-tracks-if-necessary": 66,
  55168. "./flash-constants": 67,
  55169. "./flash-transmuxer-worker": 70,
  55170. "./remove-cues-from-track": 72,
  55171. "global/window": 32,
  55172. "mux.js/lib/flv": 46,
  55173. webwackify: 76
  55174. }],
  55175. 70: [function(e, t, i) {
  55176. "use strict";
  55177. Object.defineProperty(i, "__esModule", {
  55178. value: !0
  55179. });
  55180. var r = function() {
  55181. function e(e, t) {
  55182. for (var i = 0; i < t.length; i++) {
  55183. var r = t[i];
  55184. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  55185. Object.defineProperty(e, r.key, r)
  55186. }
  55187. }
  55188. return function(t, i, r) {
  55189. return i && e(t.prototype, i), r && e(t, r), t
  55190. }
  55191. }();
  55192. function n(e) {
  55193. return e && e.__esModule ? e : {
  55194. default: e
  55195. }
  55196. }
  55197. var a = n(e("global/window")),
  55198. s = n(e("mux.js/lib/flv")),
  55199. o = function() {
  55200. function e(t) {
  55201. ! function(e, t) {
  55202. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  55203. }(this, e), this.options = t || {}, this.init()
  55204. }
  55205. return r(e, [{
  55206. key: "init",
  55207. value: function() {
  55208. var e;
  55209. this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new s.default
  55210. .Transmuxer(this.options), (e = this.transmuxer).on("data", function(e) {
  55211. a.default.postMessage({
  55212. action: "data",
  55213. segment: e
  55214. })
  55215. }), e.on("done", function(e) {
  55216. a.default.postMessage({
  55217. action: "done"
  55218. })
  55219. })
  55220. }
  55221. }, {
  55222. key: "push",
  55223. value: function(e) {
  55224. var t = new Uint8Array(e.data, e.byteOffset, e.byteLength);
  55225. this.transmuxer.push(t)
  55226. }
  55227. }, {
  55228. key: "reset",
  55229. value: function() {
  55230. this.init()
  55231. }
  55232. }, {
  55233. key: "flush",
  55234. value: function() {
  55235. this.transmuxer.flush()
  55236. }
  55237. }, {
  55238. key: "resetCaptions",
  55239. value: function() {
  55240. this.transmuxer.resetCaptions()
  55241. }
  55242. }]), e
  55243. }();
  55244. i.default = function(e) {
  55245. return new function(e) {
  55246. e.onmessage = function(e) {
  55247. "init" === e.data.action && e.data.options ? this.messageHandlers = new o(e.data.options) :
  55248. (this.messageHandlers || (this.messageHandlers = new o), e.data && e.data.action &&
  55249. "init" !== e.data.action && this.messageHandlers[e.data.action] && this.messageHandlers[
  55250. e.data.action](e.data))
  55251. }
  55252. }(e)
  55253. }, t.exports = i.default
  55254. }, {
  55255. "global/window": 32,
  55256. "mux.js/lib/flv": 46
  55257. }],
  55258. 71: [function(e, t, i) {
  55259. (function(r) {
  55260. "use strict";
  55261. Object.defineProperty(i, "__esModule", {
  55262. value: !0
  55263. });
  55264. var n = function() {
  55265. function e(e, t) {
  55266. for (var i = 0; i < t.length; i++) {
  55267. var r = t[i];
  55268. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  55269. Object.defineProperty(e, r.key, r)
  55270. }
  55271. }
  55272. return function(t, i, r) {
  55273. return i && e(t.prototype, i), r && e(t, r), t
  55274. }
  55275. }(),
  55276. a = function(e, t, i) {
  55277. for (var r = !0; r;) {
  55278. var n = e,
  55279. a = t,
  55280. s = i;
  55281. r = !1, null === n && (n = Function.prototype);
  55282. var o = Object.getOwnPropertyDescriptor(n, a);
  55283. if (void 0 !== o) {
  55284. if ("value" in o) return o.value;
  55285. var u = o.get;
  55286. if (void 0 === u) return;
  55287. return u.call(s)
  55288. }
  55289. var l = Object.getPrototypeOf(n);
  55290. if (null === l) return;
  55291. e = l, t = a, i = s, r = !0, o = l = void 0
  55292. }
  55293. };
  55294. function s(e) {
  55295. return e && e.__esModule ? e : {
  55296. default: e
  55297. }
  55298. }
  55299. var o = s(e("global/window")),
  55300. u = s(e("global/document")),
  55301. l = s("undefined" != typeof window ? window.videojs : void 0 !== r ? r.videojs : null),
  55302. d = s(e("./virtual-source-buffer")),
  55303. c = e("./add-text-track-data"),
  55304. h = e("./codec-utils"),
  55305. f = function(e) {
  55306. function t() {
  55307. var e = this;
  55308. ! function(e, t) {
  55309. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  55310. }(this, t), a(Object.getPrototypeOf(t.prototype), "constructor", this).call(this);
  55311. var i = void 0;
  55312. for (i in this.nativeMediaSource_ = new o.default.MediaSource, this.nativeMediaSource_) i in t
  55313. .prototype || "function" != typeof this.nativeMediaSource_[i] || (this[i] = this
  55314. .nativeMediaSource_[i].bind(this.nativeMediaSource_));
  55315. this.duration_ = NaN, Object.defineProperty(this, "duration", {
  55316. get: function() {
  55317. return this.duration_ === 1 / 0 ? this.duration_ : this.nativeMediaSource_.duration
  55318. },
  55319. set: function(e) {
  55320. this.duration_ = e, e === 1 / 0 || (this.nativeMediaSource_.duration = e)
  55321. }
  55322. }), Object.defineProperty(this, "seekable", {
  55323. get: function() {
  55324. return this.duration_ === 1 / 0 ? l.default.createTimeRanges([
  55325. [0, this.nativeMediaSource_.duration]
  55326. ]) : this.nativeMediaSource_.seekable
  55327. }
  55328. }), Object.defineProperty(this, "readyState", {
  55329. get: function() {
  55330. return this.nativeMediaSource_.readyState
  55331. }
  55332. }), Object.defineProperty(this, "activeSourceBuffers", {
  55333. get: function() {
  55334. return this.activeSourceBuffers_
  55335. }
  55336. }), this.sourceBuffers = [], this.activeSourceBuffers_ = [], this
  55337. .updateActiveSourceBuffers_ = function() {
  55338. if (e.activeSourceBuffers_.length = 0, 1 === e.sourceBuffers.length) {
  55339. var t = e.sourceBuffers[0];
  55340. return t.appendAudioInitSegment_ = !0, t.audioDisabled_ = !t.audioCodec_, void e
  55341. .activeSourceBuffers_.push(t)
  55342. }
  55343. for (var i = !1, r = !0, n = 0; n < e.player_.audioTracks().length; n++) {
  55344. var a = e.player_.audioTracks()[n];
  55345. if (a.enabled && "main" !== a.kind) {
  55346. i = !0, r = !1;
  55347. break
  55348. }
  55349. }
  55350. e.sourceBuffers.forEach(function(t) {
  55351. if (t.appendAudioInitSegment_ = !0, t.videoCodec_ && t.audioCodec_) t
  55352. .audioDisabled_ = i;
  55353. else if (t.videoCodec_ && !t.audioCodec_) t.audioDisabled_ = !0, r = !1;
  55354. else if (!t.videoCodec_ && t.audioCodec_ && (t.audioDisabled_ = r, r)) return;
  55355. e.activeSourceBuffers_.push(t)
  55356. })
  55357. }, this.onPlayerMediachange_ = function() {
  55358. e.sourceBuffers.forEach(function(e) {
  55359. e.appendAudioInitSegment_ = !0
  55360. })
  55361. }, this.onHlsReset_ = function() {
  55362. e.sourceBuffers.forEach(function(e) {
  55363. e.transmuxer_ && e.transmuxer_.postMessage({
  55364. action: "resetCaptions"
  55365. })
  55366. })
  55367. }, this.onHlsSegmentTimeMapping_ = function(t) {
  55368. e.sourceBuffers.forEach(function(e) {
  55369. return e.timeMapping_ = t.mapping
  55370. })
  55371. }, ["sourceopen", "sourceclose", "sourceended"].forEach(function(e) {
  55372. this.nativeMediaSource_.addEventListener(e, this.trigger.bind(this))
  55373. }, this), this.on("sourceopen", function(t) {
  55374. var i = u.default.querySelector('[src="' + e.url_ + '"]');
  55375. i && (e.player_ = (0, l.default)(i.parentNode), e.player_.tech_.on("hls-reset", e
  55376. .onHlsReset_), e.player_.tech_.on("hls-segment-time-mapping", e
  55377. .onHlsSegmentTimeMapping_), e.player_.audioTracks && e.player_.audioTracks() && (e
  55378. .player_.audioTracks().on("change", e.updateActiveSourceBuffers_), e.player_
  55379. .audioTracks().on("addtrack", e.updateActiveSourceBuffers_), e.player_
  55380. .audioTracks().on("removetrack", e.updateActiveSourceBuffers_)), e.player_.on(
  55381. "mediachange", e.onPlayerMediachange_))
  55382. }), this.on("sourceended", function(t) {
  55383. for (var i = (0, c.durationOfVideo)(e.duration), r = 0; r < e.sourceBuffers
  55384. .length; r++) {
  55385. var n = e.sourceBuffers[r],
  55386. a = n.metadataTrack_ && n.metadataTrack_.cues;
  55387. a && a.length && (a[a.length - 1].endTime = i)
  55388. }
  55389. }), this.on("sourceclose", function(e) {
  55390. this.sourceBuffers.forEach(function(e) {
  55391. e.transmuxer_ && e.transmuxer_.terminate()
  55392. }), this.sourceBuffers.length = 0, this.player_ && (this.player_.audioTracks && this
  55393. .player_.audioTracks() && (this.player_.audioTracks().off("change", this
  55394. .updateActiveSourceBuffers_), this.player_.audioTracks().off("addtrack", this
  55395. .updateActiveSourceBuffers_), this.player_.audioTracks().off("removetrack", this
  55396. .updateActiveSourceBuffers_)), this.player_.el_ && (this.player_.off(
  55397. "mediachange", this.onPlayerMediachange_), this.player_.tech_.off("hls-reset",
  55398. this.onHlsReset_), this.player_.tech_.off("hls-segment-time-mapping", this
  55399. .onHlsSegmentTimeMapping_)))
  55400. })
  55401. }
  55402. return function(e, t) {
  55403. if ("function" != typeof t && null !== t) throw new TypeError(
  55404. "Super expression must either be null or a function, not " + typeof t);
  55405. e.prototype = Object.create(t && t.prototype, {
  55406. constructor: {
  55407. value: e,
  55408. enumerable: !1,
  55409. writable: !0,
  55410. configurable: !0
  55411. }
  55412. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  55413. }(t, l["default"].EventTarget), n(t, [{
  55414. key: "addSeekableRange_",
  55415. value: function(e, t) {
  55416. var i = void 0;
  55417. if (this.duration !== 1 / 0) throw (i = new Error(
  55418. "MediaSource.addSeekableRange() can only be invoked when the duration is Infinity"
  55419. )).name = "InvalidStateError", i.code = 11, i;
  55420. (t > this.nativeMediaSource_.duration || isNaN(this.nativeMediaSource_.duration)) &&
  55421. (this.nativeMediaSource_.duration = t)
  55422. }
  55423. }, {
  55424. key: "addSourceBuffer",
  55425. value: function(e) {
  55426. var t = void 0,
  55427. i = (0, h.parseContentType)(e);
  55428. if (/^(video|audio)\/mp2t$/i.test(i.type)) {
  55429. var r = [];
  55430. i.parameters && i.parameters.codecs && (r = i.parameters.codecs.split(","), r = (
  55431. r = (0, h.translateLegacyCodecs)(r)).filter(function(e) {
  55432. return (0, h.isAudioCodec)(e) || (0, h.isVideoCodec)(e)
  55433. })), 0 === r.length && (r = ["avc1.4d400d", "mp4a.40.2"]), t = new d.default(
  55434. this, r), 0 !== this.sourceBuffers.length && (this.sourceBuffers[0]
  55435. .createRealSourceBuffers_(), t.createRealSourceBuffers_(), this.sourceBuffers[
  55436. 0].audioDisabled_ = !0)
  55437. } else t = this.nativeMediaSource_.addSourceBuffer(e);
  55438. return this.sourceBuffers.push(t), t
  55439. }
  55440. }]), t
  55441. }();
  55442. i.default = f, t.exports = i.default
  55443. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  55444. typeof window ? window : {})
  55445. }, {
  55446. "./add-text-track-data": 64,
  55447. "./codec-utils": 65,
  55448. "./virtual-source-buffer": 75,
  55449. "global/document": 31,
  55450. "global/window": 32
  55451. }],
  55452. 72: [function(e, t, i) {
  55453. "use strict";
  55454. Object.defineProperty(i, "__esModule", {
  55455. value: !0
  55456. });
  55457. i.default = function(e, t, i) {
  55458. var r = void 0,
  55459. n = void 0;
  55460. if (i && i.cues)
  55461. for (r = i.cues.length; r--;)(n = i.cues[r]).startTime <= t && n.endTime >= e && i.removeCue(n)
  55462. }, t.exports = i.default
  55463. }, {}],
  55464. 73: [function(e, t, i) {
  55465. "use strict";
  55466. Object.defineProperty(i, "__esModule", {
  55467. value: !0
  55468. });
  55469. var r = function() {
  55470. function e(e, t) {
  55471. for (var i = 0; i < t.length; i++) {
  55472. var r = t[i];
  55473. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  55474. Object.defineProperty(e, r.key, r)
  55475. }
  55476. }
  55477. return function(t, i, r) {
  55478. return i && e(t.prototype, i), r && e(t, r), t
  55479. }
  55480. }();
  55481. function n(e) {
  55482. return e && e.__esModule ? e : {
  55483. default: e
  55484. }
  55485. }
  55486. var a = n(e("global/window")),
  55487. s = n(e("mux.js/lib/mp4")),
  55488. o = function() {
  55489. function e(t) {
  55490. ! function(e, t) {
  55491. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  55492. }(this, e), this.options = t || {}, this.init()
  55493. }
  55494. return r(e, [{
  55495. key: "init",
  55496. value: function() {
  55497. var e;
  55498. this.transmuxer && this.transmuxer.dispose(), this.transmuxer = new s.default
  55499. .Transmuxer(this.options), (e = this.transmuxer).on("data", function(e) {
  55500. var t = e.initSegment;
  55501. e.initSegment = {
  55502. data: t.buffer,
  55503. byteOffset: t.byteOffset,
  55504. byteLength: t.byteLength
  55505. };
  55506. var i = e.data;
  55507. e.data = i.buffer, a.default.postMessage({
  55508. action: "data",
  55509. segment: e,
  55510. byteOffset: i.byteOffset,
  55511. byteLength: i.byteLength
  55512. }, [e.data])
  55513. }), e.captionStream && e.captionStream.on("data", function(e) {
  55514. a.default.postMessage({
  55515. action: "caption",
  55516. data: e
  55517. })
  55518. }), e.on("done", function(e) {
  55519. a.default.postMessage({
  55520. action: "done"
  55521. })
  55522. }), e.on("gopInfo", function(e) {
  55523. a.default.postMessage({
  55524. action: "gopInfo",
  55525. gopInfo: e
  55526. })
  55527. })
  55528. }
  55529. }, {
  55530. key: "push",
  55531. value: function(e) {
  55532. var t = new Uint8Array(e.data, e.byteOffset, e.byteLength);
  55533. this.transmuxer.push(t)
  55534. }
  55535. }, {
  55536. key: "reset",
  55537. value: function() {
  55538. this.init()
  55539. }
  55540. }, {
  55541. key: "setTimestampOffset",
  55542. value: function(e) {
  55543. var t = e.timestampOffset || 0;
  55544. this.transmuxer.setBaseMediaDecodeTime(Math.round(9e4 * t))
  55545. }
  55546. }, {
  55547. key: "setAudioAppendStart",
  55548. value: function(e) {
  55549. this.transmuxer.setAudioAppendStart(Math.ceil(9e4 * e.appendStart))
  55550. }
  55551. }, {
  55552. key: "flush",
  55553. value: function(e) {
  55554. this.transmuxer.flush()
  55555. }
  55556. }, {
  55557. key: "resetCaptions",
  55558. value: function() {
  55559. this.transmuxer.resetCaptions()
  55560. }
  55561. }, {
  55562. key: "alignGopsWith",
  55563. value: function(e) {
  55564. this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())
  55565. }
  55566. }]), e
  55567. }();
  55568. i.default = function(e) {
  55569. return new function(e) {
  55570. e.onmessage = function(e) {
  55571. "init" === e.data.action && e.data.options ? this.messageHandlers = new o(e.data.options) :
  55572. (this.messageHandlers || (this.messageHandlers = new o), e.data && e.data.action &&
  55573. "init" !== e.data.action && this.messageHandlers[e.data.action] && this.messageHandlers[
  55574. e.data.action](e.data))
  55575. }
  55576. }(e)
  55577. }, t.exports = i.default
  55578. }, {
  55579. "global/window": 32,
  55580. "mux.js/lib/mp4": 55
  55581. }],
  55582. 74: [function(e, t, i) {
  55583. (function(t) {
  55584. "use strict";
  55585. function r(e) {
  55586. return e && e.__esModule ? e : {
  55587. default: e
  55588. }
  55589. }
  55590. Object.defineProperty(i, "__esModule", {
  55591. value: !0
  55592. });
  55593. var n = r(e("global/window")),
  55594. a = r(e("./flash-media-source")),
  55595. s = r(e("./html-media-source")),
  55596. o = r("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null),
  55597. u = 0,
  55598. l = {
  55599. mode: "auto"
  55600. };
  55601. o.default.mediaSources = {};
  55602. var d = function(e, t) {
  55603. var i = o.default.mediaSources[e];
  55604. if (!i) throw new Error("Media Source not found (Video.js)");
  55605. i.trigger({
  55606. type: "sourceopen",
  55607. swfId: t
  55608. })
  55609. },
  55610. c = function() {
  55611. return !!n.default.MediaSource && !!n.default.MediaSource.isTypeSupported && n.default
  55612. .MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')
  55613. },
  55614. h = function(e) {
  55615. var t = o.default.mergeOptions(l, e);
  55616. if (this.MediaSource = {
  55617. open: d,
  55618. supportsNativeMediaSources: c
  55619. }, "html5" === t.mode || "auto" === t.mode && c()) return new s.default;
  55620. if (o.default.getTech("Flash")) return new a.default;
  55621. throw new Error("Cannot use Flash or Html5 to create a MediaSource for this video")
  55622. };
  55623. i.MediaSource = h, h.open = d, h.supportsNativeMediaSources = c;
  55624. var f = {
  55625. createObjectURL: function(e) {
  55626. var t = void 0;
  55627. return e instanceof s.default ? (t = n.default.URL.createObjectURL(e.nativeMediaSource_), e
  55628. .url_ = t, t) : e instanceof a.default ? (t = "blob:vjs-media-source/" + u, u++, o
  55629. .default.mediaSources[t] = e, t) : (t = n.default.URL.createObjectURL(e), e.url_ = t, t)
  55630. }
  55631. };
  55632. i.URL = f, o.default.MediaSource = h, o.default.URL = f
  55633. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  55634. typeof window ? window : {})
  55635. }, {
  55636. "./flash-media-source": 68,
  55637. "./html-media-source": 71,
  55638. "global/window": 32
  55639. }],
  55640. 75: [function(e, t, i) {
  55641. (function(t) {
  55642. "use strict";
  55643. Object.defineProperty(i, "__esModule", {
  55644. value: !0
  55645. });
  55646. var r = function() {
  55647. function e(e, t) {
  55648. for (var i = 0; i < t.length; i++) {
  55649. var r = t[i];
  55650. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  55651. Object.defineProperty(e, r.key, r)
  55652. }
  55653. }
  55654. return function(t, i, r) {
  55655. return i && e(t.prototype, i), r && e(t, r), t
  55656. }
  55657. }(),
  55658. n = function(e, t, i) {
  55659. for (var r = !0; r;) {
  55660. var n = e,
  55661. a = t,
  55662. s = i;
  55663. r = !1, null === n && (n = Function.prototype);
  55664. var o = Object.getOwnPropertyDescriptor(n, a);
  55665. if (void 0 !== o) {
  55666. if ("value" in o) return o.value;
  55667. var u = o.get;
  55668. if (void 0 === u) return;
  55669. return u.call(s)
  55670. }
  55671. var l = Object.getPrototypeOf(n);
  55672. if (null === l) return;
  55673. e = l, t = a, i = s, r = !0, o = l = void 0
  55674. }
  55675. };
  55676. function a(e) {
  55677. return e && e.__esModule ? e : {
  55678. default: e
  55679. }
  55680. }
  55681. var s = a("undefined" != typeof window ? window.videojs : void 0 !== t ? t.videojs : null),
  55682. o = a(e("./create-text-tracks-if-necessary")),
  55683. u = a(e("./remove-cues-from-track")),
  55684. l = e("./add-text-track-data"),
  55685. d = a(e("webwackify")),
  55686. c = a(e("./transmuxer-worker")),
  55687. h = e("./codec-utils"),
  55688. f = function() {
  55689. var t = void 0;
  55690. try {
  55691. t = e.resolve("./transmuxer-worker")
  55692. } catch (e) {}
  55693. return t
  55694. },
  55695. p = function(e, t, i) {
  55696. if (!t || !e.length) return [];
  55697. var r = Math.ceil(9e4 * (t.currentTime() - i + 3)),
  55698. n = void 0;
  55699. for (n = 0; n < e.length && !(e[n].pts > r); n++);
  55700. return e.slice(n)
  55701. };
  55702. i.gopsSafeToAlignWith = p;
  55703. var m = function(e, t, i) {
  55704. if (!t.length) return e;
  55705. if (i) return t.slice();
  55706. for (var r = t[0].pts, n = 0; n < e.length && !(e[n].pts >= r); n++);
  55707. return e.slice(0, n).concat(t)
  55708. };
  55709. i.updateGopBuffer = m;
  55710. var g = function(e, t, i, r) {
  55711. for (var n = Math.ceil(9e4 * (t - r)), a = Math.ceil(9e4 * (i - r)), s = e.slice(), o = e
  55712. .length; o-- && !(e[o].pts <= a););
  55713. if (-1 === o) return s;
  55714. for (var u = o + 1; u-- && !(e[u].pts <= n););
  55715. return u = Math.max(u, 0), s.splice(u, o - u + 1), s
  55716. };
  55717. i.removeGopBuffer = g;
  55718. var v = function(e) {
  55719. function t(e, i) {
  55720. var r = this;
  55721. ! function(e, t) {
  55722. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  55723. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, s.default
  55724. .EventTarget), this.timestampOffset_ = 0, this.pendingBuffers_ = [], this
  55725. .bufferUpdating_ = !1, this.mediaSource_ = e, this.codecs_ = i, this.audioCodec_ = null,
  55726. this.videoCodec_ = null, this.audioDisabled_ = !1, this.appendAudioInitSegment_ = !0, this
  55727. .gopBuffer_ = [], this.timeMapping_ = 0, this.safeAppend_ = s.default.browser.IE_VERSION >=
  55728. 11;
  55729. var a = {
  55730. remux: !1,
  55731. alignGopsAtEnd: this.safeAppend_
  55732. };
  55733. this.codecs_.forEach(function(e) {
  55734. (0, h.isAudioCodec)(e) ? r.audioCodec_ = e: (0, h.isVideoCodec)(e) && (r.videoCodec_ =
  55735. e)
  55736. }), this.transmuxer_ = (0, d.default)(c.default, f()), this.transmuxer_.postMessage({
  55737. action: "init",
  55738. options: a
  55739. }), this.transmuxer_.onmessage = function(e) {
  55740. return "data" === e.data.action ? r.data_(e) : "done" === e.data.action ? r.done_(e) :
  55741. "gopInfo" === e.data.action ? r.appendGopInfo_(e) : void 0
  55742. }, Object.defineProperty(this, "timestampOffset", {
  55743. get: function() {
  55744. return this.timestampOffset_
  55745. },
  55746. set: function(e) {
  55747. "number" == typeof e && e >= 0 && (this.timestampOffset_ = e, this
  55748. .appendAudioInitSegment_ = !0, this.gopBuffer_.length = 0, this.timeMapping_ =
  55749. 0, this.transmuxer_.postMessage({
  55750. action: "setTimestampOffset",
  55751. timestampOffset: e
  55752. }))
  55753. }
  55754. }), Object.defineProperty(this, "appendWindowStart", {
  55755. get: function() {
  55756. return (this.videoBuffer_ || this.audioBuffer_).appendWindowStart
  55757. },
  55758. set: function(e) {
  55759. this.videoBuffer_ && (this.videoBuffer_.appendWindowStart = e), this.audioBuffer_ &&
  55760. (this.audioBuffer_.appendWindowStart = e)
  55761. }
  55762. }), Object.defineProperty(this, "updating", {
  55763. get: function() {
  55764. return !!(this.bufferUpdating_ || !this.audioDisabled_ && this.audioBuffer_ && this
  55765. .audioBuffer_.updating || this.videoBuffer_ && this.videoBuffer_.updating)
  55766. }
  55767. }), Object.defineProperty(this, "buffered", {
  55768. get: function() {
  55769. var e = null,
  55770. t = null,
  55771. i = 0,
  55772. r = [],
  55773. n = [];
  55774. if (!this.videoBuffer_ && !this.audioBuffer_) return s.default.createTimeRange();
  55775. if (!this.videoBuffer_) return this.audioBuffer_.buffered;
  55776. if (!this.audioBuffer_) return this.videoBuffer_.buffered;
  55777. if (this.audioDisabled_) return this.videoBuffer_.buffered;
  55778. if (0 === this.videoBuffer_.buffered.length && 0 === this.audioBuffer_.buffered
  55779. .length) return s.default.createTimeRange();
  55780. for (var a = this.videoBuffer_.buffered, o = this.audioBuffer_.buffered, u = a
  55781. .length; u--;) r.push({
  55782. time: a.start(u),
  55783. type: "start"
  55784. }), r.push({
  55785. time: a.end(u),
  55786. type: "end"
  55787. });
  55788. for (u = o.length; u--;) r.push({
  55789. time: o.start(u),
  55790. type: "start"
  55791. }), r.push({
  55792. time: o.end(u),
  55793. type: "end"
  55794. });
  55795. for (r.sort(function(e, t) {
  55796. return e.time - t.time
  55797. }), u = 0; u < r.length; u++) "start" === r[u].type ? 2 === ++i && (e = r[u]
  55798. .time) : "end" === r[u].type && 1 === --i && (t = r[u].time), null !== e &&
  55799. null !== t && (n.push([e, t]), e = null, t = null);
  55800. return s.default.createTimeRanges(n)
  55801. }
  55802. })
  55803. }
  55804. return function(e, t) {
  55805. if ("function" != typeof t && null !== t) throw new TypeError(
  55806. "Super expression must either be null or a function, not " + typeof t);
  55807. e.prototype = Object.create(t && t.prototype, {
  55808. constructor: {
  55809. value: e,
  55810. enumerable: !1,
  55811. writable: !0,
  55812. configurable: !0
  55813. }
  55814. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  55815. }(t, s["default"].EventTarget), r(t, [{
  55816. key: "data_",
  55817. value: function(e) {
  55818. var t = e.data.segment;
  55819. t.data = new Uint8Array(t.data, e.data.byteOffset, e.data.byteLength), t
  55820. .initSegment = new Uint8Array(t.initSegment.data, t.initSegment.byteOffset, t
  55821. .initSegment.byteLength), (0, o.default)(this, this.mediaSource_, t), this
  55822. .pendingBuffers_.push(t)
  55823. }
  55824. }, {
  55825. key: "done_",
  55826. value: function(e) {
  55827. "closed" !== this.mediaSource_.readyState ? this.processPendingSegments_() : this
  55828. .pendingBuffers_.length = 0
  55829. }
  55830. }, {
  55831. key: "createRealSourceBuffers_",
  55832. value: function() {
  55833. var e = this,
  55834. t = ["audio", "video"];
  55835. t.forEach(function(i) {
  55836. if (e[i + "Codec_"] && !e[i + "Buffer_"]) {
  55837. var r = null;
  55838. if (e.mediaSource_[i + "Buffer_"])(r = e.mediaSource_[i + "Buffer_"])
  55839. .updating = !1;
  55840. else {
  55841. var n = i + '/mp4;codecs="' + e[i + "Codec_"] + '"';
  55842. r = function(e, t) {
  55843. var i = e.addSourceBuffer(t),
  55844. r = Object.create(null);
  55845. r.updating = !1, r.realBuffer_ = i;
  55846. var n = function(e) {
  55847. "function" == typeof i[e] ? r[e] = function() {
  55848. return i[e].apply(i, arguments)
  55849. } : void 0 === r[e] && Object.defineProperty(r, e, {
  55850. get: function() {
  55851. return i[e]
  55852. },
  55853. set: function(t) {
  55854. return i[e] = t
  55855. }
  55856. })
  55857. };
  55858. for (var a in i) n(a);
  55859. return r
  55860. }(e.mediaSource_.nativeMediaSource_, n), e.mediaSource_[i + "Buffer_"] =
  55861. r
  55862. }
  55863. e[i + "Buffer_"] = r, ["update", "updatestart", "updateend"].forEach(
  55864. function(n) {
  55865. r.addEventListener(n, function() {
  55866. if ("audio" !== i || !e.audioDisabled_) return "updateend" ===
  55867. n && (e[i + "Buffer_"].updating = !1), t.every(function(t) {
  55868. return !("audio" !== t || !e.audioDisabled_) || (i ===
  55869. t || !e[t + "Buffer_"] || !e[t + "Buffer_"].updating
  55870. )
  55871. }) ? e.trigger(n) : void 0
  55872. })
  55873. })
  55874. }
  55875. })
  55876. }
  55877. }, {
  55878. key: "appendBuffer",
  55879. value: function(e) {
  55880. if (this.bufferUpdating_ = !0, this.audioBuffer_ && this.audioBuffer_.buffered
  55881. .length) {
  55882. var t = this.audioBuffer_.buffered;
  55883. this.transmuxer_.postMessage({
  55884. action: "setAudioAppendStart",
  55885. appendStart: t.end(t.length - 1)
  55886. })
  55887. }
  55888. this.videoBuffer_ && this.transmuxer_.postMessage({
  55889. action: "alignGopsWith",
  55890. gopsToAlignWith: p(this.gopBuffer_, this.mediaSource_.player_, this
  55891. .timeMapping_)
  55892. }), this.transmuxer_.postMessage({
  55893. action: "push",
  55894. data: e.buffer,
  55895. byteOffset: e.byteOffset,
  55896. byteLength: e.byteLength
  55897. }, [e.buffer]), this.transmuxer_.postMessage({
  55898. action: "flush"
  55899. })
  55900. }
  55901. }, {
  55902. key: "appendGopInfo_",
  55903. value: function(e) {
  55904. this.gopBuffer_ = m(this.gopBuffer_, e.data.gopInfo, this.safeAppend_)
  55905. }
  55906. }, {
  55907. key: "remove",
  55908. value: function(e, t) {
  55909. if (this.videoBuffer_ && (this.videoBuffer_.updating = !0, this.videoBuffer_.remove(
  55910. e, t), this.gopBuffer_ = g(this.gopBuffer_, e, t, this.timeMapping_)), !this
  55911. .audioDisabled_ && this.audioBuffer_ && (this.audioBuffer_.updating = !0, this
  55912. .audioBuffer_.remove(e, t)), (0, u.default)(e, t, this.metadataTrack_), this
  55913. .inbandTextTracks_)
  55914. for (var i in this.inbandTextTracks_)(0, u.default)(e, t, this.inbandTextTracks_[
  55915. i])
  55916. }
  55917. }, {
  55918. key: "processPendingSegments_",
  55919. value: function() {
  55920. var e = {
  55921. video: {
  55922. segments: [],
  55923. bytes: 0
  55924. },
  55925. audio: {
  55926. segments: [],
  55927. bytes: 0
  55928. },
  55929. captions: [],
  55930. metadata: []
  55931. };
  55932. e = this.pendingBuffers_.reduce(function(e, t) {
  55933. var i = t.type,
  55934. r = t.data,
  55935. n = t.initSegment;
  55936. return e[i].segments.push(r), e[i].bytes += r.byteLength, e[i].initSegment =
  55937. n, t.captions && (e.captions = e.captions.concat(t.captions)), t.info && (e[
  55938. i].info = t.info), t.metadata && (e.metadata = e.metadata.concat(t
  55939. .metadata)), e
  55940. }, e), this.videoBuffer_ || this.audioBuffer_ || (0 === e.video.bytes && (this
  55941. .videoCodec_ = null), 0 === e.audio.bytes && (this.audioCodec_ = null), this
  55942. .createRealSourceBuffers_()), e.audio.info && this.mediaSource_.trigger({
  55943. type: "audioinfo",
  55944. info: e.audio.info
  55945. }), e.video.info && this.mediaSource_.trigger({
  55946. type: "videoinfo",
  55947. info: e.video.info
  55948. }), this.appendAudioInitSegment_ && (!this.audioDisabled_ && this.audioBuffer_ &&
  55949. (e.audio.segments.unshift(e.audio.initSegment), e.audio.bytes += e.audio
  55950. .initSegment.byteLength), this.appendAudioInitSegment_ = !1);
  55951. var t = !1;
  55952. this.videoBuffer_ && e.video.bytes ? (e.video.segments.unshift(e.video.initSegment),
  55953. e.video.bytes += e.video.initSegment.byteLength, this.concatAndAppendSegments_(e
  55954. .video, this.videoBuffer_), (0, l.addTextTrackData)(this, e.captions, e
  55955. .metadata)) : !this.videoBuffer_ || !this.audioDisabled_ && this
  55956. .audioBuffer_ || (t = !0), !this.audioDisabled_ && this.audioBuffer_ && this
  55957. .concatAndAppendSegments_(e.audio, this.audioBuffer_), this.pendingBuffers_
  55958. .length = 0, t && this.trigger("updateend"), this.bufferUpdating_ = !1
  55959. }
  55960. }, {
  55961. key: "concatAndAppendSegments_",
  55962. value: function(e, t) {
  55963. var i = 0,
  55964. r = void 0;
  55965. if (e.bytes) {
  55966. r = new Uint8Array(e.bytes), e.segments.forEach(function(e) {
  55967. r.set(e, i), i += e.byteLength
  55968. });
  55969. try {
  55970. t.updating = !0, t.appendBuffer(r)
  55971. } catch (e) {
  55972. this.mediaSource_.player_ && this.mediaSource_.player_.error({
  55973. code: -3,
  55974. type: "APPEND_BUFFER_ERR",
  55975. message: e.message,
  55976. originalError: e
  55977. })
  55978. }
  55979. }
  55980. }
  55981. }, {
  55982. key: "abort",
  55983. value: function() {
  55984. this.videoBuffer_ && this.videoBuffer_.abort(), !this.audioDisabled_ && this
  55985. .audioBuffer_ && this.audioBuffer_.abort(), this.transmuxer_ && this.transmuxer_
  55986. .postMessage({
  55987. action: "reset"
  55988. }), this.pendingBuffers_.length = 0, this.bufferUpdating_ = !1
  55989. }
  55990. }]), t
  55991. }();
  55992. i.default = v
  55993. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  55994. typeof window ? window : {})
  55995. }, {
  55996. "./add-text-track-data": 64,
  55997. "./codec-utils": 65,
  55998. "./create-text-tracks-if-necessary": 66,
  55999. "./remove-cues-from-track": 72,
  56000. "./transmuxer-worker": 73,
  56001. webwackify: 76
  56002. }],
  56003. 76: [function(e, t, i) {
  56004. var r = arguments[3],
  56005. n = arguments[4],
  56006. a = arguments[5],
  56007. s = JSON.stringify,
  56008. o = !1;
  56009. void 0 === r && (o = !0, r = function(e) {
  56010. var t = {};
  56011. function i(r) {
  56012. if (t[r]) return t[r].exports;
  56013. var n = t[r] = {
  56014. i: r,
  56015. l: !1,
  56016. exports: {}
  56017. };
  56018. return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports
  56019. }
  56020. return i.m = e, i.c = t, i.d = function(e, t, r) {
  56021. i.o(e, t) || Object.defineProperty(e, t, {
  56022. configurable: !1,
  56023. enumerable: !0,
  56024. get: r
  56025. })
  56026. }, i.n = function(e) {
  56027. var t = e && e.__esModule ? function() {
  56028. return e.default
  56029. } : function() {
  56030. return e
  56031. };
  56032. return i.d(t, "a", t), t
  56033. }, i.o = function(e, t) {
  56034. return Object.prototype.hasOwnProperty.call(e, t)
  56035. }, i.p = "", i(i.s = entryModule)
  56036. }, n = __webpack_modules__);
  56037. t.exports = function(e, t) {
  56038. var i;
  56039. i = o ? function(e, t) {
  56040. var i, a = "string" == typeof t;
  56041. i = a ? {} : [], Object.keys(n).forEach(function(e) {
  56042. n[e] && (i[e] = n[e].toString())
  56043. });
  56044. var o, u = __webpack_require__(t);
  56045. if (!u || u !== e && u.default !== e) {
  56046. var l = i[t];
  56047. i[t] = l.substring(0, l.length - 1) + "\n" + e.name + "();\n}"
  56048. }
  56049. a ? (t = s(t), o = "{" + Object.keys(i).map(function(e) {
  56050. return s(e) + ":" + i[e]
  56051. }).join(",") + "}") : o = "[" + i.join(",") + "]";
  56052. return "var fn = (" + r.toString().replace("entryModule", t) + ")(" + o +
  56053. ');\n(typeof fn === "function") && fn(self);'
  56054. }(e, t) : function(e) {
  56055. for (var t, i = Object.keys(a), o = 0; o < i.length; o++) {
  56056. var u = i[o],
  56057. l = a[u].exports;
  56058. if (l === e || l && l.default === e) {
  56059. t = u;
  56060. break
  56061. }
  56062. }
  56063. if (!t) {
  56064. t = Math.floor(Math.pow(16, 8) * Math.random()).toString(16);
  56065. var d = {};
  56066. for (o = 0; o < i.length; o++) d[u = i[o]] = u;
  56067. n[t] = ["function(require,module,exports){" + e + "(self); }", d]
  56068. }
  56069. var c = Math.floor(Math.pow(16, 8) * Math.random()).toString(16),
  56070. h = {};
  56071. return h[t] = t, n[c] = ["function(require,module,exports){var f = require(" + s(t) +
  56072. ");(f.default ? f.default : f)(self);}", h
  56073. ], "(" + r + ")({" + Object.keys(n).map(function(e) {
  56074. return s(e) + ":[" + n[e][0] + "," + s(n[e][1]) + "]"
  56075. }).join(",") + "},{},[" + s(c) + "])"
  56076. }(e);
  56077. var u = new Blob([i], {
  56078. type: "text/javascript"
  56079. }),
  56080. l = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(u),
  56081. d = new Worker(l);
  56082. return d.objectURL = l, d
  56083. }
  56084. }, {}],
  56085. 77: [function(e, t, i) {
  56086. (function(i) {
  56087. "use strict";
  56088. var r = function() {
  56089. function e(e, t) {
  56090. for (var i = 0; i < t.length; i++) {
  56091. var r = t[i];
  56092. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  56093. Object.defineProperty(e, r.key, r)
  56094. }
  56095. }
  56096. return function(t, i, r) {
  56097. return i && e(t.prototype, i), r && e(t, r), t
  56098. }
  56099. }(),
  56100. n = function(e, t, i) {
  56101. for (var r = !0; r;) {
  56102. var n = e,
  56103. a = t,
  56104. s = i;
  56105. r = !1, null === n && (n = Function.prototype);
  56106. var o = Object.getOwnPropertyDescriptor(n, a);
  56107. if (void 0 !== o) {
  56108. if ("value" in o) return o.value;
  56109. var u = o.get;
  56110. if (void 0 === u) return;
  56111. return u.call(s)
  56112. }
  56113. var l = Object.getPrototypeOf(n);
  56114. if (null === l) return;
  56115. e = l, t = a, i = s, r = !0, o = l = void 0
  56116. }
  56117. };
  56118. function a(e) {
  56119. return e && e.__esModule ? e : {
  56120. default: e
  56121. }
  56122. }
  56123. var s = a(e("global/document")),
  56124. o = a(e("./playlist-loader")),
  56125. u = a(e("./playlist")),
  56126. l = a(e("./xhr")),
  56127. d = e("aes-decrypter"),
  56128. c = a(e("./bin-utils")),
  56129. h = e("videojs-contrib-media-sources"),
  56130. f = a(e("m3u8-parser")),
  56131. p = a("undefined" != typeof window ? window.videojs : void 0 !== i ? i.videojs : null),
  56132. m = e("./master-playlist-controller"),
  56133. g = a(e("./config")),
  56134. v = a(e("./rendition-mixin")),
  56135. y = a(e("global/window")),
  56136. _ = a(e("./playback-watcher")),
  56137. b = a(e("./reload-source-on-error")),
  56138. w = e("./playlist-selectors.js"),
  56139. E = {
  56140. PlaylistLoader: o.default,
  56141. Playlist: u.default,
  56142. Decrypter: d.Decrypter,
  56143. AsyncStream: d.AsyncStream,
  56144. decrypt: d.decrypt,
  56145. utils: c.default,
  56146. STANDARD_PLAYLIST_SELECTOR: w.lastBandwidthSelector,
  56147. INITIAL_PLAYLIST_SELECTOR: w.lowestBitrateCompatibleVariantSelector,
  56148. comparePlaylistBandwidth: w.comparePlaylistBandwidth,
  56149. comparePlaylistResolution: w.comparePlaylistResolution,
  56150. xhr: (0, l.default)()
  56151. };
  56152. ["GOAL_BUFFER_LENGTH", "MAX_GOAL_BUFFER_LENGTH", "GOAL_BUFFER_LENGTH_RATE", "BUFFER_LOW_WATER_LINE",
  56153. "MAX_BUFFER_LOW_WATER_LINE", "BUFFER_LOW_WATER_LINE_RATE", "BANDWIDTH_VARIANCE"
  56154. ].forEach(function(e) {
  56155. Object.defineProperty(E, e, {
  56156. get: function() {
  56157. return p.default.log.warn("using Hls." + e +
  56158. " is UNSAFE be sure you know what you are doing"), g.default[e]
  56159. },
  56160. set: function(t) {
  56161. p.default.log.warn("using Hls." + e +
  56162. " is UNSAFE be sure you know what you are doing"), "number" != typeof t || t <
  56163. 0 ? p.default.log.warn("value of Hls." + e +
  56164. " must be greater than or equal to 0") : g.default[e] = t
  56165. }
  56166. })
  56167. });
  56168. var T = function(e, t) {
  56169. for (var i = t.media(), r = -1, n = 0; n < e.length; n++)
  56170. if (e[n].id === i.uri) {
  56171. r = n;
  56172. break
  56173. } e.selectedIndex_ = r, e.trigger({
  56174. selectedIndex: r,
  56175. type: "change"
  56176. })
  56177. };
  56178. E.canPlaySource = function() {
  56179. return p.default.log.warn(
  56180. "HLS is no longer a tech. Please remove it from your player's techOrder.")
  56181. }, E.supportsNativeHls = function() {
  56182. var e = s.default.createElement("video");
  56183. if (!p.default.getTech("Html5").isSupported()) return !1;
  56184. return ["application/vnd.apple.mpegurl", "audio/mpegurl", "audio/x-mpegurl",
  56185. "application/x-mpegurl", "video/x-mpegurl", "video/mpegurl", "application/mpegurl"
  56186. ].some(function(t) {
  56187. return /maybe|probably/i.test(e.canPlayType(t))
  56188. })
  56189. }(), E.isSupported = function() {
  56190. return p.default.log.warn(
  56191. "HLS is no longer a tech. Please remove it from your player's techOrder.")
  56192. };
  56193. var S = p.default.getComponent("Component"),
  56194. A = function(e) {
  56195. function t(e, i, r) {
  56196. var a = this;
  56197. if (function(e, t) {
  56198. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  56199. }(this, t), n(Object.getPrototypeOf(t.prototype), "constructor", this).call(this, i, r.hls),
  56200. i.options_ && i.options_.playerId) {
  56201. var o = (0, p.default)(i.options_.playerId);
  56202. o.hasOwnProperty("hls") || Object.defineProperty(o, "hls", {
  56203. get: function() {
  56204. return p.default.log.warn(
  56205. "player.hls is deprecated. Use player.tech_.hls instead."), i.trigger({
  56206. type: "usage",
  56207. name: "hls-player-access"
  56208. }), a
  56209. }
  56210. })
  56211. }
  56212. if (this.tech_ = i, this.source_ = e, this.stats = {}, this.ignoreNextSeekingEvent_ = !1, this
  56213. .setOptions_(), this.options_.overrideNative && (i.featuresNativeVideoTracks || i
  56214. .featuresNativeAudioTracks)) throw new Error(
  56215. "Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
  56216. this.on(s.default, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange",
  56217. "MSFullscreenChange"
  56218. ], function(e) {
  56219. var t = s.default.fullscreenElement || s.default.webkitFullscreenElement || s.default
  56220. .mozFullScreenElement || s.default.msFullscreenElement;
  56221. t && t.contains(a.tech_.el()) && a.masterPlaylistController_.fastQualityChange_()
  56222. }), this.on(this.tech_, "seeking", function() {
  56223. this.ignoreNextSeekingEvent_ ? this.ignoreNextSeekingEvent_ = !1 : this.setCurrentTime(
  56224. this.tech_.currentTime())
  56225. }), this.on(this.tech_, "error", function() {
  56226. this.masterPlaylistController_ && this.masterPlaylistController_.pauseLoading()
  56227. }), this.on(this.tech_, "play", this.play)
  56228. }
  56229. return function(e, t) {
  56230. if ("function" != typeof t && null !== t) throw new TypeError(
  56231. "Super expression must either be null or a function, not " + typeof t);
  56232. e.prototype = Object.create(t && t.prototype, {
  56233. constructor: {
  56234. value: e,
  56235. enumerable: !1,
  56236. writable: !0,
  56237. configurable: !0
  56238. }
  56239. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  56240. }(t, S), r(t, [{
  56241. key: "setOptions_",
  56242. value: function() {
  56243. var e = this;
  56244. this.options_.withCredentials = this.options_.withCredentials || !1, "number" !=
  56245. typeof this.options_.blacklistDuration && (this.options_.blacklistDuration = 300),
  56246. "number" != typeof this.options_.bandwidth && (this.options_.bandwidth = 4194304),
  56247. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist &&
  56248. 4194304 === this.options_.bandwidth, ["withCredentials", "bandwidth",
  56249. "handleManifestRedirects"
  56250. ].forEach(function(t) {
  56251. void 0 !== e.source_[t] && (e.options_[t] = e.source_[t])
  56252. }), this.bandwidth = this.options_.bandwidth
  56253. }
  56254. }, {
  56255. key: "src",
  56256. value: function(e) {
  56257. var t = this;
  56258. e && (this.setOptions_(), this.options_.url = this.source_.src, this.options_.tech =
  56259. this.tech_, this.options_.externHls = E, this.masterPlaylistController_ = new m
  56260. .MasterPlaylistController(this.options_), this.playbackWatcher_ = new _.default(
  56261. p.default.mergeOptions(this.options_, {
  56262. seekable: function() {
  56263. return t.seekable()
  56264. }
  56265. })), this.masterPlaylistController_.on("error", function() {
  56266. p.default.players[t.tech_.options_.playerId].error(t
  56267. .masterPlaylistController_.error)
  56268. }), this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this
  56269. .selectPlaylist.bind(this) : E.STANDARD_PLAYLIST_SELECTOR.bind(this), this
  56270. .masterPlaylistController_.selectInitialPlaylist = E.INITIAL_PLAYLIST_SELECTOR
  56271. .bind(this), this.playlists = this.masterPlaylistController_
  56272. .masterPlaylistLoader_, this.mediaSource = this.masterPlaylistController_
  56273. .mediaSource, Object.defineProperties(this, {
  56274. selectPlaylist: {
  56275. get: function() {
  56276. return this.masterPlaylistController_.selectPlaylist
  56277. },
  56278. set: function(e) {
  56279. this.masterPlaylistController_.selectPlaylist = e.bind(this)
  56280. }
  56281. },
  56282. throughput: {
  56283. get: function() {
  56284. return this.masterPlaylistController_.mainSegmentLoader_.throughput
  56285. .rate
  56286. },
  56287. set: function(e) {
  56288. this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = e,
  56289. this.masterPlaylistController_.mainSegmentLoader_.throughput.count =
  56290. 1
  56291. }
  56292. },
  56293. bandwidth: {
  56294. get: function() {
  56295. return this.masterPlaylistController_.mainSegmentLoader_.bandwidth
  56296. },
  56297. set: function(e) {
  56298. this.masterPlaylistController_.mainSegmentLoader_.bandwidth = e, this
  56299. .masterPlaylistController_.mainSegmentLoader_.throughput = {
  56300. rate: 0,
  56301. count: 0
  56302. }
  56303. }
  56304. },
  56305. systemBandwidth: {
  56306. get: function() {
  56307. var e = 1 / (this.bandwidth || 1),
  56308. t = void 0;
  56309. return t = this.throughput > 0 ? 1 / this.throughput : 0, Math.floor(
  56310. 1 / (e + t))
  56311. },
  56312. set: function() {
  56313. p.default.log.error('The "systemBandwidth" property is read-only')
  56314. }
  56315. }
  56316. }), Object.defineProperties(this.stats, {
  56317. bandwidth: {
  56318. get: function() {
  56319. return t.bandwidth || 0
  56320. },
  56321. enumerable: !0
  56322. },
  56323. mediaRequests: {
  56324. get: function() {
  56325. return t.masterPlaylistController_.mediaRequests_() || 0
  56326. },
  56327. enumerable: !0
  56328. },
  56329. mediaRequestsAborted: {
  56330. get: function() {
  56331. return t.masterPlaylistController_.mediaRequestsAborted_() || 0
  56332. },
  56333. enumerable: !0
  56334. },
  56335. mediaRequestsTimedout: {
  56336. get: function() {
  56337. return t.masterPlaylistController_.mediaRequestsTimedout_() || 0
  56338. },
  56339. enumerable: !0
  56340. },
  56341. mediaRequestsErrored: {
  56342. get: function() {
  56343. return t.masterPlaylistController_.mediaRequestsErrored_() || 0
  56344. },
  56345. enumerable: !0
  56346. },
  56347. mediaTransferDuration: {
  56348. get: function() {
  56349. return t.masterPlaylistController_.mediaTransferDuration_() || 0
  56350. },
  56351. enumerable: !0
  56352. },
  56353. mediaBytesTransferred: {
  56354. get: function() {
  56355. return t.masterPlaylistController_.mediaBytesTransferred_() || 0
  56356. },
  56357. enumerable: !0
  56358. },
  56359. mediaSecondsLoaded: {
  56360. get: function() {
  56361. return t.masterPlaylistController_.mediaSecondsLoaded_() || 0
  56362. },
  56363. enumerable: !0
  56364. }
  56365. }), this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay
  56366. .bind(this.masterPlaylistController_)), this.masterPlaylistController_.on(
  56367. "selectedinitialmedia",
  56368. function() {
  56369. (0, v.default)(t)
  56370. }), this.on(this.masterPlaylistController_, "progress", function() {
  56371. this.tech_.trigger("progress")
  56372. }), this.on(this.masterPlaylistController_, "firstplay", function() {
  56373. this.ignoreNextSeekingEvent_ = !0
  56374. }), this.tech_.ready(function() {
  56375. return t.setupQualityLevels_()
  56376. }), this.tech_.el() && this.tech_.src(p.default.URL.createObjectURL(this
  56377. .masterPlaylistController_.mediaSource)))
  56378. }
  56379. }, {
  56380. key: "setupQualityLevels_",
  56381. value: function() {
  56382. var e = this,
  56383. t = p.default.players[this.tech_.options_.playerId];
  56384. t && t.qualityLevels && (this.qualityLevels_ = t.qualityLevels(), this
  56385. .masterPlaylistController_.on("selectedinitialmedia", function() {
  56386. var t, i;
  56387. t = e.qualityLevels_, (i = e).representations().forEach(function(e) {
  56388. t.addQualityLevel(e)
  56389. }), T(t, i.playlists)
  56390. }), this.playlists.on("mediachange", function() {
  56391. T(e.qualityLevels_, e.playlists)
  56392. }))
  56393. }
  56394. }, {
  56395. key: "play",
  56396. value: function() {
  56397. this.masterPlaylistController_.play()
  56398. }
  56399. }, {
  56400. key: "setCurrentTime",
  56401. value: function(e) {
  56402. this.masterPlaylistController_.setCurrentTime(e)
  56403. }
  56404. }, {
  56405. key: "duration",
  56406. value: function() {
  56407. return this.masterPlaylistController_.duration()
  56408. }
  56409. }, {
  56410. key: "seekable",
  56411. value: function() {
  56412. return this.masterPlaylistController_.seekable()
  56413. }
  56414. }, {
  56415. key: "dispose",
  56416. value: function() {
  56417. this.playbackWatcher_ && this.playbackWatcher_.dispose(), this
  56418. .masterPlaylistController_ && this.masterPlaylistController_.dispose(), this
  56419. .qualityLevels_ && this.qualityLevels_.dispose(), n(Object.getPrototypeOf(t
  56420. .prototype), "dispose", this).call(this)
  56421. }
  56422. }]), t
  56423. }(),
  56424. k = function e(t) {
  56425. return {
  56426. canHandleSource: function(i) {
  56427. var r = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1],
  56428. n = p.default.mergeOptions(p.default.options, r);
  56429. return (!n.hls || !n.hls.mode || n.hls.mode === t) && e.canPlayType(i.type, n)
  56430. },
  56431. handleSource: function(e, i) {
  56432. var r = arguments.length <= 2 || void 0 === arguments[2] ? {} : arguments[2],
  56433. n = p.default.mergeOptions(p.default.options, r, {
  56434. hls: {
  56435. mode: t
  56436. }
  56437. });
  56438. return "flash" === t && i.setTimeout(function() {
  56439. i.trigger("loadstart")
  56440. }, 1), i.hls = new A(e, i, n), i.hls.xhr = (0, l.default)(), i.hls.src(e.src), i.hls
  56441. },
  56442. canPlayType: function(t) {
  56443. var i = arguments.length <= 1 || void 0 === arguments[1] ? {} : arguments[1],
  56444. r = p.default.mergeOptions(p.default.options, i);
  56445. return e.canPlayType(t, r) ? "maybe" : ""
  56446. }
  56447. }
  56448. };
  56449. k.canPlayType = function(e, t) {
  56450. if (p.default.browser.IE_VERSION && p.default.browser.IE_VERSION <= 10) return !1;
  56451. return !(!t.hls.overrideNative && E.supportsNativeHls) &&
  56452. /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e)
  56453. }, void 0 !== p.default.MediaSource && void 0 !== p.default.URL || (p.default.MediaSource = h
  56454. .MediaSource, p.default.URL = h.URL);
  56455. var R = p.default.getTech("Flash");
  56456. h.MediaSource.supportsNativeMediaSources() && p.default.getTech("Html5").registerSourceHandler(k(
  56457. "html5"), 0), y.default.Uint8Array && R && R.registerSourceHandler(k("flash")), p.default
  56458. .HlsHandler = A, p.default.HlsSourceHandler = k, p.default.Hls = E, p.default.use || p.default
  56459. .registerComponent("Hls", E), p.default.m3u8 = f.default, p.default.options.hls = p.default
  56460. .options.hls || {}, p.default.registerPlugin ? p.default.registerPlugin("reloadSourceOnError", b
  56461. .default) : p.default.plugin("reloadSourceOnError", b.default), t.exports = {
  56462. Hls: E,
  56463. HlsHandler: A,
  56464. HlsSourceHandler: k
  56465. }
  56466. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  56467. typeof window ? window : {})
  56468. }, {
  56469. "./bin-utils": 2,
  56470. "./config": 3,
  56471. "./master-playlist-controller": 5,
  56472. "./playback-watcher": 8,
  56473. "./playlist": 11,
  56474. "./playlist-loader": 9,
  56475. "./playlist-selectors.js": 10,
  56476. "./reload-source-on-error": 13,
  56477. "./rendition-mixin": 14,
  56478. "./xhr": 21,
  56479. "aes-decrypter": 25,
  56480. "global/document": 31,
  56481. "global/window": 32,
  56482. "m3u8-parser": 33,
  56483. "videojs-contrib-media-sources": 74
  56484. }]
  56485. }, {}, [77])(77)
  56486. }),
  56487. function(e) {
  56488. if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
  56489. else if ("function" == typeof define && define.amd) define([], e);
  56490. else {
  56491. ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self :
  56492. this).videojsFlvjs = e()
  56493. }
  56494. }(function() {
  56495. return function e(t, i, r) {
  56496. function n(s, o) {
  56497. if (!i[s]) {
  56498. if (!t[s]) {
  56499. var u = "function" == typeof require && require;
  56500. if (!o && u) return u(s, !0);
  56501. if (a) return a(s, !0);
  56502. var l = new Error("Cannot find module '" + s + "'");
  56503. throw l.code = "MODULE_NOT_FOUND", l
  56504. }
  56505. var d = i[s] = {
  56506. exports: {}
  56507. };
  56508. t[s][0].call(d.exports, function(e) {
  56509. var i = t[s][1][e];
  56510. return n(i || e)
  56511. }, d, d.exports, e, t, i, r)
  56512. }
  56513. return i[s].exports
  56514. }
  56515. for (var a = "function" == typeof require && require, s = 0; s < r.length; s++) n(r[s]);
  56516. return n
  56517. }({
  56518. 1: [function(e, t, i) {
  56519. (function(e) {
  56520. "use strict";
  56521. Object.defineProperty(i, "__esModule", {
  56522. value: !0
  56523. });
  56524. var t, r = function() {
  56525. function e(e, t) {
  56526. for (var i = 0; i < t.length; i++) {
  56527. var r = t[i];
  56528. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
  56529. Object.defineProperty(e, r.key, r)
  56530. }
  56531. }
  56532. return function(t, i, r) {
  56533. return i && e(t.prototype, i), r && e(t, r), t
  56534. }
  56535. }(),
  56536. n = "undefined" != typeof window ? window.videojs : void 0 !== e ? e.videojs : null,
  56537. a = (t = n) && t.__esModule ? t : {
  56538. default: t
  56539. };
  56540. var s = a.default.getTech("Html5"),
  56541. o = a.default.mergeOptions || a.default.util.mergeOptions,
  56542. u = {
  56543. mediaDataSource: {},
  56544. config: {}
  56545. },
  56546. l = function(e) {
  56547. function t(e, i) {
  56548. return function(e, t) {
  56549. if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
  56550. }(this, t), e = o(u, e),
  56551. function(e, t) {
  56552. if (!e) throw new ReferenceError(
  56553. "this hasn't been initialised - super() hasn't been called");
  56554. return !t || "object" != typeof t && "function" != typeof t ? e : t
  56555. }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, i))
  56556. }
  56557. return function(e, t) {
  56558. if ("function" != typeof t && null !== t) throw new TypeError(
  56559. "Super expression must either be null or a function, not " + typeof t);
  56560. e.prototype = Object.create(t && t.prototype, {
  56561. constructor: {
  56562. value: e,
  56563. enumerable: !1,
  56564. writable: !0,
  56565. configurable: !0
  56566. }
  56567. }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t)
  56568. }(t, s), r(t, [{
  56569. key: "setSrc",
  56570. value: function(e) {
  56571. this.flvPlayer && (this.flvPlayer.detachMediaElement(), this.flvPlayer.destroy());
  56572. var t = this.options_.mediaDataSource,
  56573. i = this.options_.config;
  56574. t.type = void 0 === t.type ? "flv" : t.type, t.url = e, this.flvPlayer = window
  56575. .flvjs.createPlayer(t, i), this.flvPlayer.attachMediaElement(this.el_), this
  56576. .flvPlayer.load()
  56577. }
  56578. }, {
  56579. key: "dispose",
  56580. value: function() {
  56581. this.flvPlayer && (this.flvPlayer.detachMediaElement(), this.flvPlayer.destroy()),
  56582. function e(t, i, r) {
  56583. null === t && (t = Function.prototype);
  56584. var n = Object.getOwnPropertyDescriptor(t, i);
  56585. if (void 0 === n) {
  56586. var a = Object.getPrototypeOf(t);
  56587. return null === a ? void 0 : e(a, i, r)
  56588. }
  56589. if ("value" in n) return n.value;
  56590. var s = n.get;
  56591. return void 0 !== s ? s.call(r) : void 0
  56592. }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "dispose", this)
  56593. .call(this)
  56594. }
  56595. }]), t
  56596. }();
  56597. l.isSupported = function() {
  56598. return window.flvjs && window.flvjs.isSupported()
  56599. }, l.formats = {
  56600. "video/flv": "FLV",
  56601. "video/x-flv": "FLV"
  56602. }, l.canPlayType = function(e) {
  56603. return l.isSupported() && e in l.formats ? "maybe" : ""
  56604. }, l.canPlaySource = function(e, t) {
  56605. return l.canPlayType(e.type)
  56606. }, l.VERSION = "0.2.0", a.default.registerTech("Flvjs", l), i.default = l
  56607. }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" !=
  56608. typeof window ? window : {})
  56609. }, {}]
  56610. }, {}, [1])(1)
  56611. }),
  56612. function() {
  56613. "use strict";
  56614. var e = null;
  56615. e = void 0 === window.videojs && "function" == typeof require ? require("video.js") : window.videojs,
  56616. function(e, t) {
  56617. var i, r = {},
  56618. n = {},
  56619. a = {};
  56620. function s(e, t, i, r) {
  56621. return n = {
  56622. label: i,
  56623. sources: t
  56624. }, "function" == typeof r ? r(e, t, i) : e.src(t.map(function(e) {
  56625. return {
  56626. src: e.src,
  56627. type: e.type,
  56628. res: e.res
  56629. }
  56630. }))
  56631. }
  56632. var o = t.getComponent("MenuItem"),
  56633. u = t.extend(o, {
  56634. constructor: function(e, t, i, r) {
  56635. this.onClickListener = i, this.label = r, o.call(this, e, t), this.src = t.src, this.on("click", this
  56636. .onClick), this.on("touchstart", this.onClick), t.initialySelected && (this.showAsLabel(), this
  56637. .selected(!0), this.addClass("vjs-selected"))
  56638. },
  56639. showAsLabel: function() {
  56640. this.label && (this.label.innerHTML = this.options_.label)
  56641. },
  56642. onClick: function(e) {
  56643. this.onClickListener(this);
  56644. var t = this.player_.currentTime(),
  56645. i = this.player_.paused();
  56646. this.showAsLabel(), this.addClass("vjs-selected"), i || this.player_.bigPlayButton.hide(), "function" !=
  56647. typeof e && "function" == typeof this.options_.customSourcePicker && (e = this.options_
  56648. .customSourcePicker);
  56649. var r = "loadeddata";
  56650. "Youtube" !== this.player_.techName_ && "none" === this.player_.preload() && "Flash" !== this.player_
  56651. .techName_ && (r = "timeupdate"), s(this.player_, this.src, this.options_.label, e), this.player_.one(
  56652. r,
  56653. function() {
  56654. this.player_.currentTime(t), this.player_.handleTechSeeked_(), this.player_.trigger(
  56655. "resolutionchange")
  56656. })
  56657. }
  56658. }),
  56659. l = t.getComponent("MenuButton"),
  56660. d = t.extend(l, {
  56661. constructor: function(e, i, r, n) {
  56662. if (this.sources = i.sources, this.label = n, this.label.innerHTML = i.initialySelectedLabel, l.call(
  56663. this, e, i, r), this.controlText("Quality"), r.dynamicLabel) this.el().appendChild(n);
  56664. else {
  56665. var a = document.createElement("span");
  56666. t.dom.addClass(a, "vjs-resolution-button-staticlabel"), this.el().appendChild(a)
  56667. }
  56668. },
  56669. createItems: function() {
  56670. var e = [],
  56671. t = this.sources && this.sources.label || {},
  56672. i = function(t) {
  56673. e.map(function(e) {
  56674. e.selected(e === t), e.removeClass("vjs-selected")
  56675. })
  56676. };
  56677. for (var r in t) t.hasOwnProperty(r) && (e.push(new u(this.player_, {
  56678. label: r,
  56679. src: t[r],
  56680. initialySelected: r === this.options_.initialySelectedLabel,
  56681. customSourcePicker: this.options_.customSourcePicker
  56682. }, i, this.label)), a[r] = e[e.length - 1]);
  56683. return e
  56684. }
  56685. });
  56686. i = function(e) {
  56687. var i = t.mergeOptions(r, e),
  56688. o = this,
  56689. u = document.createElement("span"),
  56690. l = {};
  56691. function c(e, t) {
  56692. return e.res && t.res ? +t.res - +e.res : 0
  56693. }
  56694. function h(e) {
  56695. var t = {
  56696. label: {},
  56697. res: {},
  56698. type: {}
  56699. };
  56700. return e.map(function(e) {
  56701. f(t, "label", e), f(t, "res", e), f(t, "type", e), p(t, "label", e), p(t, "res", e), p(t, "type", e)
  56702. }), t
  56703. }
  56704. function f(e, t, i) {
  56705. null == e[t][i[t]] && (e[t][i[t]] = [])
  56706. }
  56707. function p(e, t, i) {
  56708. e[t][i[t]].push(i)
  56709. }
  56710. t.dom.addClass(u, "vjs-resolution-button-label"), o.updateSrc = function(e) {
  56711. if (!e) return o.src();
  56712. o.controlBar.resolutionSwitcher && (o.controlBar.resolutionSwitcher.dispose(), delete o.controlBar
  56713. .resolutionSwitcher), e = e.sort(c);
  56714. var r = function(e, t) {
  56715. var r = i.default,
  56716. n = "";
  56717. "high" === r ? (r = t[0].res, n = t[0].label) : "low" !== r && null != r && e.res[r] ? e.res[r] && (
  56718. n = e.res[r][0].label) : (r = t[t.length - 1].res, n = t[t.length - 1].label);
  56719. return {
  56720. res: r,
  56721. label: n,
  56722. sources: e.res[r]
  56723. }
  56724. }(l = h(e), e),
  56725. n = new d(o, {
  56726. sources: l,
  56727. initialySelectedLabel: r.label,
  56728. initialySelectedRes: r.res,
  56729. customSourcePicker: i.customSourcePicker
  56730. }, i, u);
  56731. return t.dom.addClass(n.el(), "vjs-resolution-button"), o.controlBar.resolutionSwitcher = o.controlBar.el_
  56732. .insertBefore(n.el_, o.controlBar.getChild("fullscreenToggle").el_), o.controlBar.resolutionSwitcher
  56733. .dispose = function() {
  56734. this.parentNode.removeChild(this)
  56735. }, s(o, r.sources, r.label)
  56736. }, o.currentResolution = function(e, t) {
  56737. return null == e ? n : (null != a[e] && a[e].onClick(t), o)
  56738. }, o.getGroupedSrc = function() {
  56739. return l
  56740. }, o.ready(function() {
  56741. o.options_.sources.length > 1 && o.updateSrc(o.options_.sources), "Youtube" === o.techName_ && function(
  56742. e) {
  56743. e.tech_.ytPlayer.setPlaybackQuality("default"), e.tech_.ytPlayer.addEventListener(
  56744. "onPlaybackQualityChange",
  56745. function() {
  56746. e.trigger("resolutionchange")
  56747. }), e.one("play", function() {
  56748. var t = {
  56749. highres: {
  56750. res: 1080,
  56751. label: "1080",
  56752. yt: "highres"
  56753. },
  56754. hd1080: {
  56755. res: 1080,
  56756. label: "1080",
  56757. yt: "hd1080"
  56758. },
  56759. hd720: {
  56760. res: 720,
  56761. label: "720",
  56762. yt: "hd720"
  56763. },
  56764. large: {
  56765. res: 480,
  56766. label: "480",
  56767. yt: "large"
  56768. },
  56769. medium: {
  56770. res: 360,
  56771. label: "360",
  56772. yt: "medium"
  56773. },
  56774. small: {
  56775. res: 240,
  56776. label: "240",
  56777. yt: "small"
  56778. },
  56779. tiny: {
  56780. res: 144,
  56781. label: "144",
  56782. yt: "tiny"
  56783. },
  56784. auto: {
  56785. res: 0,
  56786. label: "auto",
  56787. yt: "default"
  56788. }
  56789. },
  56790. r = [];
  56791. e.tech_.ytPlayer.getAvailableQualityLevels().map(function(i) {
  56792. r.push({
  56793. src: e.src().src,
  56794. type: e.src().type,
  56795. label: t[i].label,
  56796. res: t[i].res,
  56797. _yt: t[i].yt
  56798. })
  56799. });
  56800. var n = "auto",
  56801. a = 0,
  56802. s = ((l = h(r)).label.auto, new d(e, {
  56803. sources: l,
  56804. initialySelectedLabel: n,
  56805. initialySelectedRes: a,
  56806. customSourcePicker: function(t, i, r) {
  56807. return e.tech_.ytPlayer.setPlaybackQuality(i[0]._yt), e
  56808. }
  56809. }, i, u));
  56810. s.el().classList.add("vjs-resolution-button"), e.controlBar.resolutionSwitcher = e.controlBar
  56811. .addChild(s)
  56812. })
  56813. }(o)
  56814. })
  56815. }, t.registerPlugin("videoJsResolutionSwitcher", i)
  56816. }(window, e)
  56817. }(),
  56818. function(e, t) {
  56819. "undefined" != typeof window && window.videojs ? t(window.videojs) : "function" == typeof define && define.amd ?
  56820. define("videojs-hotkeys", ["video.js"], function(e) {
  56821. return t(e.default || e)
  56822. }) : "undefined" != typeof module && module.exports && (module.exports = t(require("video.js")))
  56823. }(0, function(e) {
  56824. "use strict";
  56825. "undefined" != typeof window && (window.videojs_hotkeys = {
  56826. version: "0.2.22"
  56827. });
  56828. (e.registerPlugin || e.plugin)("hotkeys", function(t) {
  56829. var i = this,
  56830. r = i.el(),
  56831. n = document,
  56832. a = {
  56833. volumeStep: .1,
  56834. seekStep: 5,
  56835. enableMute: !0,
  56836. enableVolumeScroll: !0,
  56837. enableFullscreen: !0,
  56838. enableNumbers: !0,
  56839. enableJogStyle: !1,
  56840. alwaysCaptureHotkeys: !1,
  56841. enableModifiersForNumbers: !0,
  56842. enableInactiveFocus: !0,
  56843. skipInitialFocus: !1,
  56844. playPauseKey: function(e) {
  56845. return 32 === e.which || 179 === e.which
  56846. },
  56847. rewindKey: function(e) {
  56848. return 37 === e.which || 177 === e.which
  56849. },
  56850. forwardKey: function(e) {
  56851. return 39 === e.which || 176 === e.which
  56852. },
  56853. volumeUpKey: function(e) {
  56854. return 38 === e.which
  56855. },
  56856. volumeDownKey: function(e) {
  56857. return 40 === e.which
  56858. },
  56859. muteKey: function(e) {
  56860. return 77 === e.which
  56861. },
  56862. fullscreenKey: function(e) {
  56863. return 70 === e.which
  56864. },
  56865. customKeys: {}
  56866. },
  56867. s = e.mergeOptions || e.util.mergeOptions,
  56868. o = (t = s(a, t || {})).volumeStep,
  56869. u = t.seekStep,
  56870. l = t.enableMute,
  56871. d = t.enableVolumeScroll,
  56872. c = t.enableFullscreen,
  56873. h = t.enableNumbers,
  56874. f = t.enableJogStyle,
  56875. p = t.alwaysCaptureHotkeys,
  56876. m = t.enableModifiersForNumbers,
  56877. g = t.enableInactiveFocus,
  56878. v = t.skipInitialFocus;
  56879. r.hasAttribute("tabIndex") || r.setAttribute("tabIndex", "-1"), r.style.outline = "none", !p && i.autoplay() ||
  56880. v || i.one("play", function() {
  56881. r.focus()
  56882. }), g && i.on("userinactive", function() {
  56883. var e = function() {
  56884. clearTimeout(t)
  56885. },
  56886. t = setTimeout(function() {
  56887. i.off("useractive", e);
  56888. var t = n.activeElement,
  56889. a = r.querySelector(".vjs-control-bar");
  56890. t && t.parentElement == a && r.focus()
  56891. }, 10);
  56892. i.one("useractive", e)
  56893. }), i.on("play", function() {
  56894. var e = r.querySelector(".iframeblocker");
  56895. e && "" === e.style.display && (e.style.display = "block", e.style.bottom = "39px")
  56896. });
  56897. var y = function(e) {
  56898. if (i.controls()) {
  56899. var t = n.activeElement;
  56900. if ((p || t == r || t == r.querySelector(".vjs-tech") || t == r.querySelector(".iframeblocker") || t == r
  56901. .querySelector(".vjs-control-bar")) && d) {
  56902. e = window.event || e;
  56903. var a = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
  56904. e.preventDefault(), 1 == a ? i.volume(i.volume() + o) : -1 == a && i.volume(i.volume() - o)
  56905. }
  56906. }
  56907. },
  56908. _ = function(e, i) {
  56909. return t.playPauseKey(e, i) ? 1 : t.rewindKey(e, i) ? 2 : t.forwardKey(e, i) ? 3 : t.volumeUpKey(e, i) ? 4 :
  56910. t.volumeDownKey(e, i) ? 5 : t.muteKey(e, i) ? 6 : t.fullscreenKey(e, i) ? 7 : void 0
  56911. };
  56912. function b(e) {
  56913. return "function" == typeof u ? u(e) : u
  56914. }
  56915. return i.on("keydown", function(e) {
  56916. var a, s, u = e.which,
  56917. d = e.preventDefault,
  56918. g = i.duration();
  56919. if (i.controls()) {
  56920. var v = n.activeElement;
  56921. if (p || v == r || v == r.querySelector(".vjs-tech") || v == r.querySelector(".vjs-control-bar") || v ==
  56922. r.querySelector(".iframeblocker")) switch (_(e, i)) {
  56923. case 1:
  56924. d(), p && e.stopPropagation(), i.paused() ? i.play() : i.pause();
  56925. break;
  56926. case 2:
  56927. a = !i.paused(), d(), a && i.pause(), (s = i.currentTime() - b(e)) <= 0 && (s = 0), i.currentTime(
  56928. s), a && i.play();
  56929. break;
  56930. case 3:
  56931. a = !i.paused(), d(), a && i.pause(), (s = i.currentTime() + b(e)) >= g && (s = a ? g - .001 : g),
  56932. i.currentTime(s), a && i.play();
  56933. break;
  56934. case 5:
  56935. d(), f ? (s = i.currentTime() - 1, i.currentTime() <= 1 && (s = 0), i.currentTime(s)) : i.volume(i
  56936. .volume() - o);
  56937. break;
  56938. case 4:
  56939. d(), f ? ((s = i.currentTime() + 1) >= g && (s = g), i.currentTime(s)) : i.volume(i.volume() + o);
  56940. break;
  56941. case 6:
  56942. l && i.muted(!i.muted());
  56943. break;
  56944. case 7:
  56945. c && (i.isFullscreen() ? i.exitFullscreen() : i.requestFullscreen());
  56946. break;
  56947. default:
  56948. if ((u > 47 && u < 59 || u > 95 && u < 106) && (m || !(e.metaKey || e.ctrlKey || e.altKey)) &&
  56949. h) {
  56950. var y = 48;
  56951. u > 95 && (y = 96);
  56952. var w = u - y;
  56953. d(), i.currentTime(i.duration() * w * .1)
  56954. }
  56955. for (var E in t.customKeys) {
  56956. var T = t.customKeys[E];
  56957. T && T.key && T.handler && T.key(e) && (d(), T.handler(i, t, e))
  56958. }
  56959. }
  56960. }
  56961. }), i.on("dblclick", function(e) {
  56962. if (i.controls()) {
  56963. var t = e.relatedTarget || e.toElement || n.activeElement;
  56964. t != r && t != r.querySelector(".vjs-tech") && t != r.querySelector(".iframeblocker") || c && (i
  56965. .isFullscreen() ? i.exitFullscreen() : i.requestFullscreen())
  56966. }
  56967. }), i.on("mousewheel", y), i.on("DOMMouseScroll", y), this
  56968. })
  56969. }), "undefined" != typeof window && function(e, t) {
  56970. "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define &&
  56971. define.amd ? define([], t) : "object" == typeof exports ? exports.Hls = t() : e.Hls = t()
  56972. }(this, function() {
  56973. return function(e) {
  56974. var t = {};
  56975. function i(r) {
  56976. if (t[r]) return t[r].exports;
  56977. var n = t[r] = {
  56978. i: r,
  56979. l: !1,
  56980. exports: {}
  56981. };
  56982. return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports
  56983. }
  56984. return i.m = e, i.c = t, i.d = function(e, t, r) {
  56985. i.o(e, t) || Object.defineProperty(e, t, {
  56986. enumerable: !0,
  56987. get: r
  56988. })
  56989. }, i.r = function(e) {
  56990. "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
  56991. value: "Module"
  56992. }), Object.defineProperty(e, "__esModule", {
  56993. value: !0
  56994. })
  56995. }, i.t = function(e, t) {
  56996. if (1 & t && (e = i(e)), 8 & t) return e;
  56997. if (4 & t && "object" == typeof e && e && e.__esModule) return e;
  56998. var r = Object.create(null);
  56999. if (i.r(r), Object.defineProperty(r, "default", {
  57000. enumerable: !0,
  57001. value: e
  57002. }), 2 & t && "string" != typeof e)
  57003. for (var n in e) i.d(r, n, function(t) {
  57004. return e[t]
  57005. }.bind(null, n));
  57006. return r
  57007. }, i.n = function(e) {
  57008. var t = e && e.__esModule ? function() {
  57009. return e.default
  57010. } : function() {
  57011. return e
  57012. };
  57013. return i.d(t, "a", t), t
  57014. }, i.o = function(e, t) {
  57015. return Object.prototype.hasOwnProperty.call(e, t)
  57016. }, i.p = "/dist/", i(i.s = "./src/hls.ts")
  57017. }({
  57018. "./node_modules/eventemitter3/index.js": function(e, t, i) {
  57019. "use strict";
  57020. var r = Object.prototype.hasOwnProperty,
  57021. n = "~";
  57022. function a() {}
  57023. function s(e, t, i, r, a) {
  57024. if ("function" != typeof i) throw new TypeError("The listener must be a function");
  57025. var s = new function(e, t, i) {
  57026. this.fn = e, this.context = t, this.once = i || !1
  57027. }(i, r || e, a),
  57028. o = n ? n + t : t;
  57029. return e._events[o] ? e._events[o].fn ? e._events[o] = [e._events[o], s] : e._events[o].push(s) : (e
  57030. ._events[o] = s, e._eventsCount++), e
  57031. }
  57032. function o(e, t) {
  57033. 0 == --e._eventsCount ? e._events = new a : delete e._events[t]
  57034. }
  57035. function u() {
  57036. this._events = new a, this._eventsCount = 0
  57037. }
  57038. Object.create && (a.prototype = Object.create(null), (new a).__proto__ || (n = !1)), u.prototype
  57039. .eventNames = function() {
  57040. var e, t, i = [];
  57041. if (0 === this._eventsCount) return i;
  57042. for (t in e = this._events) r.call(e, t) && i.push(n ? t.slice(1) : t);
  57043. return Object.getOwnPropertySymbols ? i.concat(Object.getOwnPropertySymbols(e)) : i
  57044. }, u.prototype.listeners = function(e) {
  57045. var t = n ? n + e : e,
  57046. i = this._events[t];
  57047. if (!i) return [];
  57048. if (i.fn) return [i.fn];
  57049. for (var r = 0, a = i.length, s = new Array(a); r < a; r++) s[r] = i[r].fn;
  57050. return s
  57051. }, u.prototype.listenerCount = function(e) {
  57052. var t = n ? n + e : e,
  57053. i = this._events[t];
  57054. return i ? i.fn ? 1 : i.length : 0
  57055. }, u.prototype.emit = function(e, t, i, r, a, s) {
  57056. var o = n ? n + e : e;
  57057. if (!this._events[o]) return !1;
  57058. var u, l, d = this._events[o],
  57059. c = arguments.length;
  57060. if (d.fn) {
  57061. switch (d.once && this.removeListener(e, d.fn, void 0, !0), c) {
  57062. case 1:
  57063. return d.fn.call(d.context), !0;
  57064. case 2:
  57065. return d.fn.call(d.context, t), !0;
  57066. case 3:
  57067. return d.fn.call(d.context, t, i), !0;
  57068. case 4:
  57069. return d.fn.call(d.context, t, i, r), !0;
  57070. case 5:
  57071. return d.fn.call(d.context, t, i, r, a), !0;
  57072. case 6:
  57073. return d.fn.call(d.context, t, i, r, a, s), !0
  57074. }
  57075. for (l = 1, u = new Array(c - 1); l < c; l++) u[l - 1] = arguments[l];
  57076. d.fn.apply(d.context, u)
  57077. } else {
  57078. var h, f = d.length;
  57079. for (l = 0; l < f; l++) switch (d[l].once && this.removeListener(e, d[l].fn, void 0, !0), c) {
  57080. case 1:
  57081. d[l].fn.call(d[l].context);
  57082. break;
  57083. case 2:
  57084. d[l].fn.call(d[l].context, t);
  57085. break;
  57086. case 3:
  57087. d[l].fn.call(d[l].context, t, i);
  57088. break;
  57089. case 4:
  57090. d[l].fn.call(d[l].context, t, i, r);
  57091. break;
  57092. default:
  57093. if (!u)
  57094. for (h = 1, u = new Array(c - 1); h < c; h++) u[h - 1] = arguments[h];
  57095. d[l].fn.apply(d[l].context, u)
  57096. }
  57097. }
  57098. return !0
  57099. }, u.prototype.on = function(e, t, i) {
  57100. return s(this, e, t, i, !1)
  57101. }, u.prototype.once = function(e, t, i) {
  57102. return s(this, e, t, i, !0)
  57103. }, u.prototype.removeListener = function(e, t, i, r) {
  57104. var a = n ? n + e : e;
  57105. if (!this._events[a]) return this;
  57106. if (!t) return o(this, a), this;
  57107. var s = this._events[a];
  57108. if (s.fn) s.fn !== t || r && !s.once || i && s.context !== i || o(this, a);
  57109. else {
  57110. for (var u = 0, l = [], d = s.length; u < d; u++)(s[u].fn !== t || r && !s[u].once || i && s[u]
  57111. .context !== i) && l.push(s[u]);
  57112. l.length ? this._events[a] = 1 === l.length ? l[0] : l : o(this, a)
  57113. }
  57114. return this
  57115. }, u.prototype.removeAllListeners = function(e) {
  57116. var t;
  57117. return e ? (t = n ? n + e : e, this._events[t] && o(this, t)) : (this._events = new a, this
  57118. ._eventsCount = 0), this
  57119. }, u.prototype.off = u.prototype.removeListener, u.prototype.addListener = u.prototype.on, u
  57120. .prefixed = n, u.EventEmitter = u, e.exports = u
  57121. },
  57122. "./node_modules/url-toolkit/src/url-toolkit.js": function(e, t, i) {
  57123. var r, n, a, s, o;
  57124. r =
  57125. /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,
  57126. n = /^(?=([^\/?#]*))\1([^]*)$/, a = /(?:\/|^)\.(?=\/)/g, s = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,
  57127. o = {
  57128. buildAbsoluteURL: function(e, t, i) {
  57129. if (i = i || {}, e = e.trim(), !(t = t.trim())) {
  57130. if (!i.alwaysNormalize) return e;
  57131. var r = o.parseURL(e);
  57132. if (!r) throw new Error("Error trying to parse base URL.");
  57133. return r.path = o.normalizePath(r.path), o.buildURLFromParts(r)
  57134. }
  57135. var a = o.parseURL(t);
  57136. if (!a) throw new Error("Error trying to parse relative URL.");
  57137. if (a.scheme) return i.alwaysNormalize ? (a.path = o.normalizePath(a.path), o.buildURLFromParts(
  57138. a)) : t;
  57139. var s = o.parseURL(e);
  57140. if (!s) throw new Error("Error trying to parse base URL.");
  57141. if (!s.netLoc && s.path && "/" !== s.path[0]) {
  57142. var u = n.exec(s.path);
  57143. s.netLoc = u[1], s.path = u[2]
  57144. }
  57145. s.netLoc && !s.path && (s.path = "/");
  57146. var l = {
  57147. scheme: s.scheme,
  57148. netLoc: a.netLoc,
  57149. path: null,
  57150. params: a.params,
  57151. query: a.query,
  57152. fragment: a.fragment
  57153. };
  57154. if (!a.netLoc && (l.netLoc = s.netLoc, "/" !== a.path[0]))
  57155. if (a.path) {
  57156. var d = s.path,
  57157. c = d.substring(0, d.lastIndexOf("/") + 1) + a.path;
  57158. l.path = o.normalizePath(c)
  57159. } else l.path = s.path, a.params || (l.params = s.params, a.query || (l.query = s.query));
  57160. return null === l.path && (l.path = i.alwaysNormalize ? o.normalizePath(a.path) : a.path), o
  57161. .buildURLFromParts(l)
  57162. },
  57163. parseURL: function(e) {
  57164. var t = r.exec(e);
  57165. return t ? {
  57166. scheme: t[1] || "",
  57167. netLoc: t[2] || "",
  57168. path: t[3] || "",
  57169. params: t[4] || "",
  57170. query: t[5] || "",
  57171. fragment: t[6] || ""
  57172. } : null
  57173. },
  57174. normalizePath: function(e) {
  57175. for (e = e.split("").reverse().join("").replace(a, ""); e.length !== (e = e.replace(s, ""))
  57176. .length;);
  57177. return e.split("").reverse().join("")
  57178. },
  57179. buildURLFromParts: function(e) {
  57180. return e.scheme + e.netLoc + e.path + e.params + e.query + e.fragment
  57181. }
  57182. }, e.exports = o
  57183. },
  57184. "./node_modules/webworkify-webpack/index.js": function(e, t, i) {
  57185. function r(e) {
  57186. var t = {};
  57187. function i(r) {
  57188. if (t[r]) return t[r].exports;
  57189. var n = t[r] = {
  57190. i: r,
  57191. l: !1,
  57192. exports: {}
  57193. };
  57194. return e[r].call(n.exports, n, n.exports, i), n.l = !0, n.exports
  57195. }
  57196. i.m = e, i.c = t, i.i = function(e) {
  57197. return e
  57198. }, i.d = function(e, t, r) {
  57199. i.o(e, t) || Object.defineProperty(e, t, {
  57200. configurable: !1,
  57201. enumerable: !0,
  57202. get: r
  57203. })
  57204. }, i.r = function(e) {
  57205. Object.defineProperty(e, "__esModule", {
  57206. value: !0
  57207. })
  57208. }, i.n = function(e) {
  57209. var t = e && e.__esModule ? function() {
  57210. return e.default
  57211. } : function() {
  57212. return e
  57213. };
  57214. return i.d(t, "a", t), t
  57215. }, i.o = function(e, t) {
  57216. return Object.prototype.hasOwnProperty.call(e, t)
  57217. }, i.p = "/", i.oe = function(e) {
  57218. throw console.error(e), e
  57219. };
  57220. var r = i(i.s = ENTRY_MODULE);
  57221. return r.default || r
  57222. }
  57223. var n = "[\\.|\\-|\\+|\\w|/|@]+",
  57224. a = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + n + ").*?\\)";
  57225. function s(e) {
  57226. return (e + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
  57227. }
  57228. function o(e, t, r) {
  57229. var o = {};
  57230. o[r] = [];
  57231. var u = t.toString(),
  57232. l = u.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
  57233. if (!l) return o;
  57234. for (var d, c = l[1], h = new RegExp("(\\\\n|\\W)" + s(c) + a, "g"); d = h.exec(u);)
  57235. "dll-reference" !== d[3] && o[r].push(d[3]);
  57236. for (h = new RegExp("\\(" + s(c) + '\\("(dll-reference\\s(' + n + '))"\\)\\)' + a, "g"); d = h.exec(
  57237. u);) e[d[2]] || (o[r].push(d[1]), e[d[2]] = i(d[1]).m), o[d[2]] = o[d[2]] || [], o[d[2]].push(d[4]);
  57238. for (var f, p = Object.keys(o), m = 0; m < p.length; m++)
  57239. for (var g = 0; g < o[p[m]].length; g++) f = o[p[m]][g], isNaN(1 * f) || (o[p[m]][g] = 1 * o[p[m]][
  57240. g]);
  57241. return o
  57242. }
  57243. function u(e) {
  57244. return Object.keys(e).reduce(function(t, i) {
  57245. return t || e[i].length > 0
  57246. }, !1)
  57247. }
  57248. e.exports = function(e, t) {
  57249. t = t || {};
  57250. var n = {
  57251. main: i.m
  57252. },
  57253. a = t.all ? {
  57254. main: Object.keys(n.main)
  57255. } : function(e, t) {
  57256. for (var i = {
  57257. main: [t]
  57258. }, r = {
  57259. main: []
  57260. }, n = {
  57261. main: {}
  57262. }; u(i);)
  57263. for (var a = Object.keys(i), s = 0; s < a.length; s++) {
  57264. var l = a[s],
  57265. d = i[l].pop();
  57266. if (n[l] = n[l] || {}, !n[l][d] && e[l][d]) {
  57267. n[l][d] = !0, r[l] = r[l] || [], r[l].push(d);
  57268. for (var c = o(e, e[l][d], l), h = Object.keys(c), f = 0; f < h.length; f++) i[h[f]] = i[
  57269. h[f]] || [], i[h[f]] = i[h[f]].concat(c[h[f]])
  57270. }
  57271. }
  57272. return r
  57273. }(n, e),
  57274. s = "";
  57275. Object.keys(a).filter(function(e) {
  57276. return "main" !== e
  57277. }).forEach(function(e) {
  57278. for (var t = 0; a[e][t];) t++;
  57279. a[e].push(t), n[e][t] =
  57280. "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",
  57281. s = s + "var " + e + " = (" + r.toString().replace("ENTRY_MODULE", JSON.stringify(t)) +
  57282. ")({" + a[e].map(function(t) {
  57283. return JSON.stringify(t) + ": " + n[e][t].toString()
  57284. }).join(",") + "});\n"
  57285. }), s = s + "new ((" + r.toString().replace("ENTRY_MODULE", JSON.stringify(e)) + ")({" + a.main
  57286. .map(function(e) {
  57287. return JSON.stringify(e) + ": " + n.main[e].toString()
  57288. }).join(",") + "}))(self);";
  57289. var l = new window.Blob([s], {
  57290. type: "text/javascript"
  57291. });
  57292. if (t.bare) return l;
  57293. var d = (window.URL || window.webkitURL || window.mozURL || window.msURL).createObjectURL(l),
  57294. c = new window.Worker(d);
  57295. return c.objectURL = d, c
  57296. }
  57297. },
  57298. "./src/config.ts": function(e, t, i) {
  57299. "use strict";
  57300. i.r(t), i.d(t, "hlsDefaultConfig", function() {
  57301. return T
  57302. }), i.d(t, "mergeConfig", function() {
  57303. return S
  57304. }), i.d(t, "enableStreamingMode", function() {
  57305. return A
  57306. });
  57307. var r = i("./src/controller/abr-controller.ts"),
  57308. n = i("./src/controller/audio-stream-controller.ts"),
  57309. a = i("./src/controller/audio-track-controller.ts"),
  57310. s = i("./src/controller/subtitle-stream-controller.ts"),
  57311. o = i("./src/controller/subtitle-track-controller.ts"),
  57312. u = i("./src/controller/buffer-controller.ts"),
  57313. l = i("./src/controller/timeline-controller.ts"),
  57314. d = i("./src/controller/cap-level-controller.ts"),
  57315. c = i("./src/controller/fps-controller.ts"),
  57316. h = i("./src/controller/eme-controller.ts"),
  57317. f = i("./src/controller/cmcd-controller.ts"),
  57318. p = i("./src/utils/xhr-loader.ts"),
  57319. m = i("./src/utils/fetch-loader.ts"),
  57320. g = i("./src/utils/cues.ts"),
  57321. v = i("./src/utils/mediakeys-helper.ts"),
  57322. y = i("./src/utils/logger.ts");
  57323. function _() {
  57324. return (_ = Object.assign ? Object.assign.bind() : function(e) {
  57325. for (var t = 1; t < arguments.length; t++) {
  57326. var i = arguments[t];
  57327. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  57328. }
  57329. return e
  57330. }).apply(this, arguments)
  57331. }
  57332. function b(e, t) {
  57333. var i = Object.keys(e);
  57334. if (Object.getOwnPropertySymbols) {
  57335. var r = Object.getOwnPropertySymbols(e);
  57336. t && (r = r.filter(function(t) {
  57337. return Object.getOwnPropertyDescriptor(e, t).enumerable
  57338. })), i.push.apply(i, r)
  57339. }
  57340. return i
  57341. }
  57342. function w(e) {
  57343. for (var t = 1; t < arguments.length; t++) {
  57344. var i = null != arguments[t] ? arguments[t] : {};
  57345. t % 2 ? b(Object(i), !0).forEach(function(t) {
  57346. E(e, t, i[t])
  57347. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object
  57348. .getOwnPropertyDescriptors(i)) : b(Object(i)).forEach(function(t) {
  57349. Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(i, t))
  57350. })
  57351. }
  57352. return e
  57353. }
  57354. function E(e, t, i) {
  57355. return t in e ? Object.defineProperty(e, t, {
  57356. value: i,
  57357. enumerable: !0,
  57358. configurable: !0,
  57359. writable: !0
  57360. }) : e[t] = i, e
  57361. }
  57362. var T = w(w({
  57363. autoStartLoad: !0,
  57364. startPosition: -1,
  57365. defaultAudioCodec: void 0,
  57366. debug: !1,
  57367. capLevelOnFPSDrop: !1,
  57368. capLevelToPlayerSize: !1,
  57369. ignoreDevicePixelRatio: !1,
  57370. initialLiveManifestSize: 1,
  57371. maxBufferLength: 30,
  57372. backBufferLength: 1 / 0,
  57373. maxBufferSize: 6e7,
  57374. maxBufferHole: .1,
  57375. highBufferWatchdogPeriod: 2,
  57376. nudgeOffset: .1,
  57377. nudgeMaxRetry: 3,
  57378. maxFragLookUpTolerance: .25,
  57379. liveSyncDurationCount: 3,
  57380. liveMaxLatencyDurationCount: 1 / 0,
  57381. liveSyncDuration: void 0,
  57382. liveMaxLatencyDuration: void 0,
  57383. maxLiveSyncPlaybackRate: 1,
  57384. liveDurationInfinity: !1,
  57385. liveBackBufferLength: null,
  57386. maxMaxBufferLength: 600,
  57387. enableWorker: !0,
  57388. enableSoftwareAES: !0,
  57389. manifestLoadingTimeOut: 1e4,
  57390. manifestLoadingMaxRetry: 1,
  57391. manifestLoadingRetryDelay: 1e3,
  57392. manifestLoadingMaxRetryTimeout: 64e3,
  57393. startLevel: void 0,
  57394. levelLoadingTimeOut: 1e4,
  57395. levelLoadingMaxRetry: 4,
  57396. levelLoadingRetryDelay: 1e3,
  57397. levelLoadingMaxRetryTimeout: 64e3,
  57398. fragLoadingTimeOut: 2e4,
  57399. fragLoadingMaxRetry: 6,
  57400. fragLoadingRetryDelay: 1e3,
  57401. fragLoadingMaxRetryTimeout: 64e3,
  57402. startFragPrefetch: !1,
  57403. fpsDroppedMonitoringPeriod: 5e3,
  57404. fpsDroppedMonitoringThreshold: .2,
  57405. appendErrorMaxRetry: 3,
  57406. loader: p.default,
  57407. fLoader: void 0,
  57408. pLoader: void 0,
  57409. xhrSetup: void 0,
  57410. licenseXhrSetup: void 0,
  57411. licenseResponseCallback: void 0,
  57412. abrController: r.default,
  57413. bufferController: u.default,
  57414. capLevelController: d.default,
  57415. fpsController: c.default,
  57416. stretchShortVideoTrack: !1,
  57417. maxAudioFramesDrift: 1,
  57418. forceKeyFrameOnDiscontinuity: !0,
  57419. abrEwmaFastLive: 3,
  57420. abrEwmaSlowLive: 9,
  57421. abrEwmaFastVoD: 3,
  57422. abrEwmaSlowVoD: 9,
  57423. abrEwmaDefaultEstimate: 5e5,
  57424. abrBandWidthFactor: .95,
  57425. abrBandWidthUpFactor: .7,
  57426. abrMaxWithRealBitrate: !1,
  57427. maxStarvationDelay: 4,
  57428. maxLoadingDelay: 4,
  57429. minAutoBitrate: 0,
  57430. emeEnabled: !1,
  57431. widevineLicenseUrl: void 0,
  57432. drmSystemOptions: {},
  57433. requestMediaKeySystemAccessFunc: v.requestMediaKeySystemAccess,
  57434. testBandwidth: !0,
  57435. progressive: !1,
  57436. lowLatencyMode: !0,
  57437. cmcd: void 0
  57438. }, {
  57439. cueHandler: g.default,
  57440. enableCEA708Captions: !0,
  57441. enableWebVTT: !0,
  57442. enableIMSC1: !0,
  57443. captionsTextTrack1Label: "English",
  57444. captionsTextTrack1LanguageCode: "en",
  57445. captionsTextTrack2Label: "Spanish",
  57446. captionsTextTrack2LanguageCode: "es",
  57447. captionsTextTrack3Label: "Unknown CC",
  57448. captionsTextTrack3LanguageCode: "",
  57449. captionsTextTrack4Label: "Unknown CC",
  57450. captionsTextTrack4LanguageCode: "",
  57451. renderTextTracksNatively: !0
  57452. }), {}, {
  57453. subtitleStreamController: s.SubtitleStreamController,
  57454. subtitleTrackController: o.default,
  57455. timelineController: l.TimelineController,
  57456. audioStreamController: n.default,
  57457. audioTrackController: a.default,
  57458. emeController: h.default,
  57459. cmcdController: f.default
  57460. });
  57461. function S(e, t) {
  57462. if ((t.liveSyncDurationCount || t.liveMaxLatencyDurationCount) && (t.liveSyncDuration || t
  57463. .liveMaxLatencyDuration)) throw new Error(
  57464. "Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration"
  57465. );
  57466. if (void 0 !== t.liveMaxLatencyDurationCount && (void 0 === t.liveSyncDurationCount || t
  57467. .liveMaxLatencyDurationCount <= t.liveSyncDurationCount)) throw new Error(
  57468. 'Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"'
  57469. );
  57470. if (void 0 !== t.liveMaxLatencyDuration && (void 0 === t.liveSyncDuration || t
  57471. .liveMaxLatencyDuration <= t.liveSyncDuration)) throw new Error(
  57472. 'Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');
  57473. return _({}, e, t)
  57474. }
  57475. function A(e) {
  57476. var t = e.loader;
  57477. t !== m.default && t !== p.default ? (y.logger.log(
  57478. "[config]: Custom loader detected, cannot enable progressive streaming"), e.progressive = !1) :
  57479. Object(m.fetchSupported)() && (e.loader = m.default, e.progressive = !0, e.enableSoftwareAES = !0, y
  57480. .logger.log("[config]: Progressive streaming enabled, using FetchLoader"))
  57481. }
  57482. },
  57483. "./src/controller/abr-controller.ts": function(e, t, i) {
  57484. "use strict";
  57485. i.r(t);
  57486. var r = i("./src/polyfills/number.ts"),
  57487. n = i("./src/utils/ewma-bandwidth-estimator.ts"),
  57488. a = i("./src/events.ts"),
  57489. s = i("./src/utils/buffer-helper.ts"),
  57490. o = i("./src/errors.ts"),
  57491. u = i("./src/types/loader.ts"),
  57492. l = i("./src/utils/logger.ts");
  57493. function d(e, t) {
  57494. for (var i = 0; i < t.length; i++) {
  57495. var r = t[i];
  57496. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  57497. .defineProperty(e, r.key, r)
  57498. }
  57499. }
  57500. var c = function() {
  57501. function e(e) {
  57502. this.hls = void 0, this.lastLoadedFragLevel = 0, this._nextAutoLevel = -1, this.timer = void 0,
  57503. this.onCheck = this._abandonRulesCheck.bind(this), this.fragCurrent = null, this.partCurrent =
  57504. null, this.bitrateTestDelay = 0, this.bwEstimator = void 0, this.hls = e;
  57505. var t = e.config;
  57506. this.bwEstimator = new n.default(t.abrEwmaSlowVoD, t.abrEwmaFastVoD, t.abrEwmaDefaultEstimate),
  57507. this.registerListeners()
  57508. }
  57509. var t, i, c, h = e.prototype;
  57510. return h.registerListeners = function() {
  57511. var e = this.hls;
  57512. e.on(a.Events.FRAG_LOADING, this.onFragLoading, this), e.on(a.Events.FRAG_LOADED, this
  57513. .onFragLoaded, this), e.on(a.Events.FRAG_BUFFERED, this.onFragBuffered, this), e.on(a.Events
  57514. .LEVEL_LOADED, this.onLevelLoaded, this), e.on(a.Events.ERROR, this.onError, this)
  57515. }, h.unregisterListeners = function() {
  57516. var e = this.hls;
  57517. e.off(a.Events.FRAG_LOADING, this.onFragLoading, this), e.off(a.Events.FRAG_LOADED, this
  57518. .onFragLoaded, this), e.off(a.Events.FRAG_BUFFERED, this.onFragBuffered, this), e.off(a
  57519. .Events.LEVEL_LOADED, this.onLevelLoaded, this), e.off(a.Events.ERROR, this.onError, this)
  57520. }, h.destroy = function() {
  57521. this.unregisterListeners(), this.clearTimer(), this.hls = this.onCheck = null, this
  57522. .fragCurrent = this.partCurrent = null
  57523. }, h.onFragLoading = function(e, t) {
  57524. var i, r = t.frag;
  57525. r.type === u.PlaylistLevelType.MAIN && (this.timer || (this.fragCurrent = r, this.partCurrent =
  57526. null != (i = t.part) ? i : null, this.timer = self.setInterval(this.onCheck, 100)))
  57527. }, h.onLevelLoaded = function(e, t) {
  57528. var i = this.hls.config;
  57529. t.details.live ? this.bwEstimator.update(i.abrEwmaSlowLive, i.abrEwmaFastLive) : this
  57530. .bwEstimator.update(i.abrEwmaSlowVoD, i.abrEwmaFastVoD)
  57531. }, h._abandonRulesCheck = function() {
  57532. var e = this.fragCurrent,
  57533. t = this.partCurrent,
  57534. i = this.hls,
  57535. n = i.autoLevelEnabled,
  57536. o = i.config,
  57537. u = i.media;
  57538. if (e && u) {
  57539. var d = t ? t.stats : e.stats,
  57540. c = t ? t.duration : e.duration;
  57541. if (d.aborted) return l.logger.warn("frag loader destroy or aborted, disarm abandonRules"),
  57542. this.clearTimer(), void(this._nextAutoLevel = -1);
  57543. if (n && !u.paused && u.playbackRate && u.readyState) {
  57544. var h = performance.now() - d.loading.start,
  57545. f = Math.abs(u.playbackRate);
  57546. if (!(h <= 500 * c / f)) {
  57547. var p = i.levels,
  57548. m = i.minAutoLevel,
  57549. g = p[e.level],
  57550. v = d.total || Math.max(d.loaded, Math.round(c * g.maxBitrate / 8)),
  57551. y = Math.max(1, d.bwEstimate ? d.bwEstimate / 8 : 1e3 * d.loaded / h),
  57552. _ = (v - d.loaded) / y,
  57553. b = u.currentTime,
  57554. w = (s.BufferHelper.bufferInfo(u, b, o.maxBufferHole).end - b) / f;
  57555. if (!(w >= 2 * c / f || _ <= w)) {
  57556. var E, T = Number.POSITIVE_INFINITY;
  57557. for (E = e.level - 1; E > m; E--) {
  57558. if ((T = c * p[E].maxBitrate / (6.4 * y)) < w) break
  57559. }
  57560. if (!(T >= _)) {
  57561. var S = this.bwEstimator.getEstimate();
  57562. l.logger.warn("Fragment " + e.sn + (t ? " part " + t.index : "") + " of level " + e
  57563. .level +
  57564. " is loading too slowly and will cause an underbuffer; aborting and switching to level " +
  57565. E + "\n Current BW estimate: " + (Object(r.isFiniteNumber)(S) ? (S / 1024)
  57566. .toFixed(3) : "Unknown") +
  57567. " Kb/s\n Estimated load time for current fragment: " + _.toFixed(3) +
  57568. " s\n Estimated load time for the next fragment: " + T.toFixed(3) +
  57569. " s\n Time to underbuffer: " + w.toFixed(3) + " s"), i.nextLoadLevel = E,
  57570. this.bwEstimator.sample(h, d.loaded), this.clearTimer(), e.loader && (this
  57571. .fragCurrent = this.partCurrent = null, e.loader.abort()), i.trigger(a.Events
  57572. .FRAG_LOAD_EMERGENCY_ABORTED, {
  57573. frag: e,
  57574. part: t,
  57575. stats: d
  57576. })
  57577. }
  57578. }
  57579. }
  57580. }
  57581. }
  57582. }, h.onFragLoaded = function(e, t) {
  57583. var i = t.frag,
  57584. n = t.part;
  57585. if (i.type === u.PlaylistLevelType.MAIN && Object(r.isFiniteNumber)(i.sn)) {
  57586. var s = n ? n.stats : i.stats,
  57587. o = n ? n.duration : i.duration;
  57588. if (this.clearTimer(), this.lastLoadedFragLevel = i.level, this._nextAutoLevel = -1, this.hls
  57589. .config.abrMaxWithRealBitrate) {
  57590. var l = this.hls.levels[i.level],
  57591. d = (l.loaded ? l.loaded.bytes : 0) + s.loaded,
  57592. c = (l.loaded ? l.loaded.duration : 0) + o;
  57593. l.loaded = {
  57594. bytes: d,
  57595. duration: c
  57596. }, l.realBitrate = Math.round(8 * d / c)
  57597. }
  57598. if (i.bitrateTest) {
  57599. var h = {
  57600. stats: s,
  57601. frag: i,
  57602. part: n,
  57603. id: i.type
  57604. };
  57605. this.onFragBuffered(a.Events.FRAG_BUFFERED, h), i.bitrateTest = !1
  57606. }
  57607. }
  57608. }, h.onFragBuffered = function(e, t) {
  57609. var i = t.frag,
  57610. r = t.part,
  57611. n = r ? r.stats : i.stats;
  57612. if (!n.aborted && i.type === u.PlaylistLevelType.MAIN && "initSegment" !== i.sn) {
  57613. var a = n.parsing.end - n.loading.start;
  57614. this.bwEstimator.sample(a, n.loaded), n.bwEstimate = this.bwEstimator.getEstimate(), i
  57615. .bitrateTest ? this.bitrateTestDelay = a / 1e3 : this.bitrateTestDelay = 0
  57616. }
  57617. }, h.onError = function(e, t) {
  57618. switch (t.details) {
  57619. case o.ErrorDetails.FRAG_LOAD_ERROR:
  57620. case o.ErrorDetails.FRAG_LOAD_TIMEOUT:
  57621. this.clearTimer()
  57622. }
  57623. }, h.clearTimer = function() {
  57624. self.clearInterval(this.timer), this.timer = void 0
  57625. }, h.getNextABRAutoLevel = function() {
  57626. var e = this.fragCurrent,
  57627. t = this.partCurrent,
  57628. i = this.hls,
  57629. r = i.maxAutoLevel,
  57630. n = i.config,
  57631. a = i.minAutoLevel,
  57632. o = i.media,
  57633. u = t ? t.duration : e ? e.duration : 0,
  57634. d = o ? o.currentTime : 0,
  57635. c = o && 0 !== o.playbackRate ? Math.abs(o.playbackRate) : 1,
  57636. h = this.bwEstimator ? this.bwEstimator.getEstimate() : n.abrEwmaDefaultEstimate,
  57637. f = (s.BufferHelper.bufferInfo(o, d, n.maxBufferHole).end - d) / c,
  57638. p = this.findBestLevel(h, a, r, f, n.abrBandWidthFactor, n.abrBandWidthUpFactor);
  57639. if (p >= 0) return p;
  57640. l.logger.trace((f ? "rebuffering expected" : "buffer is empty") +
  57641. ", finding optimal quality level");
  57642. var m = u ? Math.min(u, n.maxStarvationDelay) : n.maxStarvationDelay,
  57643. g = n.abrBandWidthFactor,
  57644. v = n.abrBandWidthUpFactor;
  57645. if (!f) {
  57646. var y = this.bitrateTestDelay;
  57647. if (y) m = (u ? Math.min(u, n.maxLoadingDelay) : n.maxLoadingDelay) - y, l.logger.trace(
  57648. "bitrate test took " + Math.round(1e3 * y) +
  57649. "ms, set first fragment max fetchDuration to " + Math.round(1e3 * m) + " ms"), g = v = 1
  57650. }
  57651. return p = this.findBestLevel(h, a, r, f + m, g, v), Math.max(p, 0)
  57652. }, h.findBestLevel = function(e, t, i, r, n, a) {
  57653. for (var s, o = this.fragCurrent, u = this.partCurrent, d = this.lastLoadedFragLevel, c = this
  57654. .hls.levels, h = c[d], f = !(null === h || void 0 === h || null === (s = h.details) ||
  57655. void 0 === s || !s.live), p = null === h || void 0 === h ? void 0 : h.codecSet, m = u ? u
  57656. .duration : o ? o.duration : 0, g = i; g >= t; g--) {
  57657. var v = c[g];
  57658. if (v && (!p || v.codecSet === p)) {
  57659. var y = v.details,
  57660. _ = (u ? null === y || void 0 === y ? void 0 : y.partTarget : null === y || void 0 === y ?
  57661. void 0 : y.averagetargetduration) || m,
  57662. b = void 0;
  57663. b = g <= d ? n * e : a * e;
  57664. var w = c[g].maxBitrate,
  57665. E = w * _ / b;
  57666. if (l.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: " +
  57667. g + "/" + Math.round(b) + "/" + w + "/" + _ + "/" + r + "/" + E), b > w && (!E || f && !
  57668. this.bitrateTestDelay || E < r)) return g
  57669. }
  57670. }
  57671. return -1
  57672. }, t = e, (i = [{
  57673. key: "nextAutoLevel",
  57674. get: function() {
  57675. var e = this._nextAutoLevel,
  57676. t = this.bwEstimator;
  57677. if (!(-1 === e || t && t.canEstimate())) return e;
  57678. var i = this.getNextABRAutoLevel();
  57679. return -1 !== e && (i = Math.min(e, i)), i
  57680. },
  57681. set: function(e) {
  57682. this._nextAutoLevel = e
  57683. }
  57684. }]) && d(t.prototype, i), c && d(t, c), Object.defineProperty(t, "prototype", {
  57685. writable: !1
  57686. }), e
  57687. }();
  57688. t.default = c
  57689. },
  57690. "./src/controller/audio-stream-controller.ts": function(e, t, i) {
  57691. "use strict";
  57692. i.r(t);
  57693. var r = i("./src/polyfills/number.ts"),
  57694. n = i("./src/controller/base-stream-controller.ts"),
  57695. a = i("./src/events.ts"),
  57696. s = i("./src/utils/buffer-helper.ts"),
  57697. o = i("./src/controller/fragment-tracker.ts"),
  57698. u = i("./src/types/level.ts"),
  57699. l = i("./src/types/loader.ts"),
  57700. d = i("./src/loader/fragment.ts"),
  57701. c = i("./src/demux/chunk-cache.ts"),
  57702. h = i("./src/demux/transmuxer-interface.ts"),
  57703. f = i("./src/types/transmuxer.ts"),
  57704. p = i("./src/controller/fragment-finders.ts"),
  57705. m = i("./src/utils/discontinuities.ts"),
  57706. g = i("./src/errors.ts"),
  57707. v = i("./src/utils/logger.ts");
  57708. function y() {
  57709. return (y = Object.assign ? Object.assign.bind() : function(e) {
  57710. for (var t = 1; t < arguments.length; t++) {
  57711. var i = arguments[t];
  57712. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  57713. }
  57714. return e
  57715. }).apply(this, arguments)
  57716. }
  57717. function _(e, t) {
  57718. return (_ = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  57719. return e.__proto__ = t, e
  57720. })(e, t)
  57721. }
  57722. var b = function(e) {
  57723. var t, i;
  57724. function b(t, i) {
  57725. var r;
  57726. return (r = e.call(this, t, i, "[audio-stream-controller]") || this).videoBuffer = null, r
  57727. .videoTrackCC = -1, r.waitingVideoCC = -1, r.audioSwitch = !1, r.trackId = -1, r.waitingData =
  57728. null, r.mainDetails = null, r.bufferFlushed = !1, r.cachedTrackLoadedData = null, r
  57729. ._registerListeners(), r
  57730. }
  57731. i = e, (t = b).prototype = Object.create(i.prototype), t.prototype.constructor = t, _(t, i);
  57732. var w = b.prototype;
  57733. return w.onHandlerDestroying = function() {
  57734. this._unregisterListeners(), this.mainDetails = null
  57735. }, w._registerListeners = function() {
  57736. var e = this.hls;
  57737. e.on(a.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(a.Events.MEDIA_DETACHING, this
  57738. .onMediaDetaching, this), e.on(a.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  57739. .on(a.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.on(a.Events.AUDIO_TRACKS_UPDATED, this
  57740. .onAudioTracksUpdated, this), e.on(a.Events.AUDIO_TRACK_SWITCHING, this
  57741. .onAudioTrackSwitching, this), e.on(a.Events.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded,
  57742. this), e.on(a.Events.ERROR, this.onError, this), e.on(a.Events.BUFFER_RESET, this
  57743. .onBufferReset, this), e.on(a.Events.BUFFER_CREATED, this.onBufferCreated, this), e.on(a
  57744. .Events.BUFFER_FLUSHED, this.onBufferFlushed, this), e.on(a.Events.INIT_PTS_FOUND, this
  57745. .onInitPtsFound, this), e.on(a.Events.FRAG_BUFFERED, this.onFragBuffered, this)
  57746. }, w._unregisterListeners = function() {
  57747. var e = this.hls;
  57748. e.off(a.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(a.Events.MEDIA_DETACHING, this
  57749. .onMediaDetaching, this), e.off(a.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  57750. .off(a.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.off(a.Events.AUDIO_TRACKS_UPDATED,
  57751. this.onAudioTracksUpdated, this), e.off(a.Events.AUDIO_TRACK_SWITCHING, this
  57752. .onAudioTrackSwitching, this), e.off(a.Events.AUDIO_TRACK_LOADED, this.onAudioTrackLoaded,
  57753. this), e.off(a.Events.ERROR, this.onError, this), e.off(a.Events.BUFFER_RESET, this
  57754. .onBufferReset, this), e.off(a.Events.BUFFER_CREATED, this.onBufferCreated, this), e.off(a
  57755. .Events.BUFFER_FLUSHED, this.onBufferFlushed, this), e.off(a.Events.INIT_PTS_FOUND, this
  57756. .onInitPtsFound, this), e.off(a.Events.FRAG_BUFFERED, this.onFragBuffered, this)
  57757. }, w.onInitPtsFound = function(e, t) {
  57758. var i = t.frag,
  57759. r = t.id,
  57760. a = t.initPTS;
  57761. if ("main" === r) {
  57762. var s = i.cc;
  57763. this.initPTS[i.cc] = a, this.log("InitPTS for cc: " + s + " found from main: " + a), this
  57764. .videoTrackCC = s, this.state === n.State.WAITING_INIT_PTS && this.tick()
  57765. }
  57766. }, w.startLoad = function(e) {
  57767. if (!this.levels) return this.startPosition = e, void(this.state = n.State.STOPPED);
  57768. var t = this.lastCurrentTime;
  57769. this.stopLoad(), this.setInterval(100), this.fragLoadError = 0, t > 0 && -1 === e ? (this.log(
  57770. "Override startPosition with lastCurrentTime @" + t.toFixed(3)), this.state = n.State
  57771. .IDLE) : (this.loadedmetadata = !1, this.state = n.State.WAITING_TRACK), this
  57772. .nextLoadPosition = this.startPosition = this.lastCurrentTime = e, this.tick()
  57773. }, w.doTick = function() {
  57774. switch (this.state) {
  57775. case n.State.IDLE:
  57776. this.doTickIdle();
  57777. break;
  57778. case n.State.WAITING_TRACK:
  57779. var t, i = this.levels,
  57780. r = this.trackId,
  57781. a = null === i || void 0 === i ? void 0 : null === (t = i[r]) || void 0 === t ? void 0 : t
  57782. .details;
  57783. if (a) {
  57784. if (this.waitForCdnTuneIn(a)) break;
  57785. this.state = n.State.WAITING_INIT_PTS
  57786. }
  57787. break;
  57788. case n.State.FRAG_LOADING_WAITING_RETRY:
  57789. var o, u = performance.now(),
  57790. l = this.retryDate;
  57791. (!l || u >= l || null !== (o = this.media) && void 0 !== o && o.seeking) && (this.log(
  57792. "RetryDate reached, switch back to IDLE state"), this.state = n.State.IDLE);
  57793. break;
  57794. case n.State.WAITING_INIT_PTS:
  57795. var d = this.waitingData;
  57796. if (d) {
  57797. var c = d.frag,
  57798. h = d.part,
  57799. f = d.cache,
  57800. m = d.complete;
  57801. if (void 0 !== this.initPTS[c.cc]) {
  57802. this.waitingData = null, this.waitingVideoCC = -1, this.state = n.State.FRAG_LOADING;
  57803. var g = {
  57804. frag: c,
  57805. part: h,
  57806. payload: f.flush(),
  57807. networkDetails: null
  57808. };
  57809. this._handleFragmentLoadProgress(g), m && e.prototype._handleFragmentLoadComplete.call(
  57810. this, g)
  57811. } else if (this.videoTrackCC !== this.waitingVideoCC) v.logger.log(
  57812. "Waiting fragment cc (" + c.cc + ") cancelled because video is at cc " + this
  57813. .videoTrackCC), this.clearWaitingFragment();
  57814. else {
  57815. var y = this.getLoadPosition(),
  57816. _ = s.BufferHelper.bufferInfo(this.mediaBuffer, y, this.config.maxBufferHole);
  57817. Object(p.fragmentWithinToleranceTest)(_.end, this.config.maxFragLookUpTolerance, c) <
  57818. 0 && (v.logger.log("Waiting fragment cc (" + c.cc + ") @ " + c.start +
  57819. " cancelled because another fragment at " + _.end + " is needed"), this
  57820. .clearWaitingFragment())
  57821. }
  57822. } else this.state = n.State.IDLE
  57823. }
  57824. this.onTickEnd()
  57825. }, w.clearWaitingFragment = function() {
  57826. var e = this.waitingData;
  57827. e && (this.fragmentTracker.removeFragment(e.frag), this.waitingData = null, this
  57828. .waitingVideoCC = -1, this.state = n.State.IDLE)
  57829. }, w.onTickEnd = function() {
  57830. var e = this.media;
  57831. if (e && e.readyState) {
  57832. var t = (this.mediaBuffer ? this.mediaBuffer : e).buffered;
  57833. !this.loadedmetadata && t.length && (this.loadedmetadata = !0), this.lastCurrentTime = e
  57834. .currentTime
  57835. }
  57836. }, w.doTickIdle = function() {
  57837. var e, t, i = this.hls,
  57838. r = this.levels,
  57839. s = this.media,
  57840. o = this.trackId,
  57841. u = i.config;
  57842. if (r && r[o] && (s || !this.startFragRequested && u.startFragPrefetch)) {
  57843. var c = r[o].details;
  57844. if (!c || c.live && this.levelLastLoaded !== o || this.waitForCdnTuneIn(c)) this.state = n
  57845. .State.WAITING_TRACK;
  57846. else {
  57847. this.bufferFlushed && (this.bufferFlushed = !1, this.afterBufferFlushed(this.mediaBuffer ?
  57848. this.mediaBuffer : this.media, d.ElementaryStreamTypes.AUDIO, l.PlaylistLevelType
  57849. .AUDIO));
  57850. var h = this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : this.media, l
  57851. .PlaylistLevelType.AUDIO);
  57852. if (null !== h) {
  57853. var f = h.len,
  57854. p = this.getMaxBufferLength(),
  57855. m = this.audioSwitch;
  57856. if (!(f >= p) || m) {
  57857. if (!m && this._streamEnded(h, c)) return i.trigger(a.Events.BUFFER_EOS, {
  57858. type: "audio"
  57859. }), void(this.state = n.State.ENDED);
  57860. var g = c.fragments[0].start,
  57861. v = h.end;
  57862. if (m) {
  57863. var y = this.getLoadPosition();
  57864. v = y, c.PTSKnown && y < g && (h.end > g || h.nextStart) && (this.log(
  57865. "Alt audio track ahead of main track, seek to start of alt audio track"), s
  57866. .currentTime = g + .05)
  57867. }
  57868. var _ = this.getNextFragment(v, c);
  57869. _ ? "identity" !== (null === (e = _.decryptdata) || void 0 === e ? void 0 : e
  57870. .keyFormat) || null !== (t = _.decryptdata) && void 0 !== t && t.key ? this
  57871. .loadFragment(_, c, v) : this.loadKey(_, c) : this.bufferFlushed = !0
  57872. }
  57873. }
  57874. }
  57875. }
  57876. }, w.getMaxBufferLength = function() {
  57877. var t = e.prototype.getMaxBufferLength.call(this),
  57878. i = this.getFwdBufferInfo(this.videoBuffer ? this.videoBuffer : this.media, l
  57879. .PlaylistLevelType.MAIN);
  57880. return null === i ? t : Math.max(t, i.len)
  57881. }, w.onMediaDetaching = function() {
  57882. this.videoBuffer = null, e.prototype.onMediaDetaching.call(this)
  57883. }, w.onAudioTracksUpdated = function(e, t) {
  57884. var i = t.audioTracks;
  57885. this.resetTransmuxer(), this.levels = i.map(function(e) {
  57886. return new u.Level(e)
  57887. })
  57888. }, w.onAudioTrackSwitching = function(e, t) {
  57889. var i = !!t.url;
  57890. this.trackId = t.id;
  57891. var r = this.fragCurrent;
  57892. null !== r && void 0 !== r && r.loader && r.loader.abort(), this.fragCurrent = null, this
  57893. .clearWaitingFragment(), i ? this.setInterval(100) : this.resetTransmuxer(), i ? (this
  57894. .audioSwitch = !0, this.state = n.State.IDLE) : this.state = n.State.STOPPED, this.tick()
  57895. }, w.onManifestLoading = function() {
  57896. this.mainDetails = null, this.fragmentTracker.removeAllFragments(), this.startPosition = this
  57897. .lastCurrentTime = 0, this.bufferFlushed = !1
  57898. }, w.onLevelLoaded = function(e, t) {
  57899. this.mainDetails = t.details, null !== this.cachedTrackLoadedData && (this.hls.trigger(a.Events
  57900. .AUDIO_TRACK_LOADED, this.cachedTrackLoadedData), this.cachedTrackLoadedData = null)
  57901. }, w.onAudioTrackLoaded = function(e, t) {
  57902. var i;
  57903. if (null != this.mainDetails) {
  57904. var r = this.levels,
  57905. a = t.details,
  57906. s = t.id;
  57907. if (r) {
  57908. this.log("Track " + s + " loaded [" + a.startSN + "," + a.endSN + "],duration:" + a
  57909. .totalduration);
  57910. var o = r[s],
  57911. u = 0;
  57912. if (a.live || null !== (i = o.details) && void 0 !== i && i.live) {
  57913. var l = this.mainDetails;
  57914. if (a.fragments[0] || (a.deltaUpdateFailed = !0), a.deltaUpdateFailed || !l) return;
  57915. !o.details && a.hasProgramDateTime && l.hasProgramDateTime ? (Object(m
  57916. .alignMediaPlaylistByPDT)(a, l), u = a.fragments[0].start) : u = this.alignPlaylists(
  57917. a, o.details)
  57918. }
  57919. o.details = a, this.levelLastLoaded = s, this.startFragRequested || !this.mainDetails && a
  57920. .live || this.setStartPosition(o.details, u), this.state !== n.State.WAITING_TRACK || this
  57921. .waitForCdnTuneIn(a) || (this.state = n.State.IDLE), this.tick()
  57922. } else this.warn("Audio tracks were reset while loading level " + s)
  57923. } else this.cachedTrackLoadedData = t
  57924. }, w._handleFragmentLoadProgress = function(e) {
  57925. var t, i = e.frag,
  57926. r = e.part,
  57927. a = e.payload,
  57928. s = this.config,
  57929. o = this.trackId,
  57930. u = this.levels;
  57931. if (u) {
  57932. var d = u[o];
  57933. console.assert(d, "Audio track is defined on fragment load progress");
  57934. var p = d.details;
  57935. console.assert(p, "Audio track details are defined on fragment load progress");
  57936. var m = s.defaultAudioCodec || d.audioCodec || "mp4a.40.2",
  57937. g = this.transmuxer;
  57938. g || (g = this.transmuxer = new h.default(this.hls, l.PlaylistLevelType.AUDIO, this
  57939. ._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this)));
  57940. var y = this.initPTS[i.cc],
  57941. _ = null === (t = i.initSegment) || void 0 === t ? void 0 : t.data;
  57942. if (void 0 !== y) {
  57943. var b = r ? r.index : -1,
  57944. w = -1 !== b,
  57945. E = new f.ChunkMetadata(i.level, i.sn, i.stats.chunkCount, a.byteLength, b, w);
  57946. g.push(a, _, m, "", i, r, p.totalduration, !1, E, y)
  57947. } else {
  57948. v.logger.log("Unknown video PTS for cc " + i.cc +
  57949. ", waiting for video PTS before demuxing audio frag " + i.sn + " of [" + p.startSN +
  57950. " ," + p.endSN + "],track " + o), (this.waitingData = this.waitingData || {
  57951. frag: i,
  57952. part: r,
  57953. cache: new c.default,
  57954. complete: !1
  57955. }).cache.push(new Uint8Array(a)), this.waitingVideoCC = this.videoTrackCC, this.state = n
  57956. .State.WAITING_INIT_PTS
  57957. }
  57958. } else this.warn("Audio tracks were reset while fragment load was in progress. Fragment " + i
  57959. .sn + " of level " + i.level + " will not be buffered")
  57960. }, w._handleFragmentLoadComplete = function(t) {
  57961. this.waitingData ? this.waitingData.complete = !0 : e.prototype._handleFragmentLoadComplete
  57962. .call(this, t)
  57963. }, w.onBufferReset = function() {
  57964. this.mediaBuffer = this.videoBuffer = null, this.loadedmetadata = !1
  57965. }, w.onBufferCreated = function(e, t) {
  57966. var i = t.tracks.audio;
  57967. i && (this.mediaBuffer = i.buffer), t.tracks.video && (this.videoBuffer = t.tracks.video.buffer)
  57968. }, w.onFragBuffered = function(e, t) {
  57969. var i = t.frag,
  57970. r = t.part;
  57971. i.type === l.PlaylistLevelType.AUDIO && (this.fragContextChanged(i) ? this.warn("Fragment " + i
  57972. .sn + (r ? " p: " + r.index : "") + " of level " + i.level +
  57973. " finished buffering, but was aborted. state: " + this.state + ", audioSwitch: " + this
  57974. .audioSwitch) : ("initSegment" !== i.sn && (this.fragPrevious = i, this.audioSwitch && (
  57975. this.audioSwitch = !1, this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED, {
  57976. id: this.trackId
  57977. }))), this.fragBufferedComplete(i, r)))
  57978. }, w.onError = function(t, i) {
  57979. switch (i.details) {
  57980. case g.ErrorDetails.FRAG_LOAD_ERROR:
  57981. case g.ErrorDetails.FRAG_LOAD_TIMEOUT:
  57982. case g.ErrorDetails.KEY_LOAD_ERROR:
  57983. case g.ErrorDetails.KEY_LOAD_TIMEOUT:
  57984. this.onFragmentOrKeyLoadError(l.PlaylistLevelType.AUDIO, i);
  57985. break;
  57986. case g.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:
  57987. case g.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:
  57988. this.state !== n.State.ERROR && this.state !== n.State.STOPPED && (this.state = i.fatal ? n
  57989. .State.ERROR : n.State.IDLE, this.warn(i.details +
  57990. " while loading frag, switching to " + this.state + " state"));
  57991. break;
  57992. case g.ErrorDetails.BUFFER_FULL_ERROR:
  57993. if ("audio" === i.parent && (this.state === n.State.PARSING || this.state === n.State
  57994. .PARSED)) {
  57995. var r = !0,
  57996. a = this.getFwdBufferInfo(this.mediaBuffer, l.PlaylistLevelType.AUDIO);
  57997. a && a.len > .5 && (r = !this.reduceMaxBufferLength(a.len)), r && (this.warn(
  57998. "Buffer full error also media.currentTime is not buffered, flush audio buffer"),
  57999. this.fragCurrent = null, e.prototype.flushMainBuffer.call(this, 0, Number
  58000. .POSITIVE_INFINITY, "audio")), this.resetLoadingState()
  58001. }
  58002. }
  58003. }, w.onBufferFlushed = function(e, t) {
  58004. t.type === d.ElementaryStreamTypes.AUDIO && (this.bufferFlushed = !0)
  58005. }, w._handleTransmuxComplete = function(e) {
  58006. var t, i = "audio",
  58007. r = this.hls,
  58008. s = e.remuxResult,
  58009. o = e.chunkMeta,
  58010. u = this.getCurrentContext(o);
  58011. if (!u) return this.warn("The loading context changed while buffering fragment " + o.sn +
  58012. " of level " + o.level + ". This chunk will not be buffered."), void this
  58013. .resetLiveStartWhenNotLoaded(o.level);
  58014. var l = u.frag,
  58015. c = u.part,
  58016. h = s.audio,
  58017. f = s.text,
  58018. p = s.id3,
  58019. m = s.initSegment;
  58020. if (!this.fragContextChanged(l)) {
  58021. if (this.state = n.State.PARSING, this.audioSwitch && h && this.completeAudioSwitch(),
  58022. null !== m && void 0 !== m && m.tracks && (this._bufferInitSegment(m.tracks, l, o), r
  58023. .trigger(a.Events.FRAG_PARSING_INIT_SEGMENT, {
  58024. frag: l,
  58025. id: i,
  58026. tracks: m.tracks
  58027. })), h) {
  58028. var g = h.startPTS,
  58029. v = h.endPTS,
  58030. _ = h.startDTS,
  58031. b = h.endDTS;
  58032. c && (c.elementaryStreams[d.ElementaryStreamTypes.AUDIO] = {
  58033. startPTS: g,
  58034. endPTS: v,
  58035. startDTS: _,
  58036. endDTS: b
  58037. }), l.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO, g, v, _, b), this
  58038. .bufferFragmentData(h, l, c, o)
  58039. }
  58040. if (null !== p && void 0 !== p && null !== (t = p.samples) && void 0 !== t && t.length) {
  58041. var w = y({
  58042. frag: l,
  58043. id: i
  58044. }, p);
  58045. r.trigger(a.Events.FRAG_PARSING_METADATA, w)
  58046. }
  58047. if (f) {
  58048. var E = y({
  58049. frag: l,
  58050. id: i
  58051. }, f);
  58052. r.trigger(a.Events.FRAG_PARSING_USERDATA, E)
  58053. }
  58054. }
  58055. }, w._bufferInitSegment = function(e, t, i) {
  58056. if (this.state === n.State.PARSING) {
  58057. e.video && delete e.video;
  58058. var r = e.audio;
  58059. if (r) {
  58060. r.levelCodec = r.codec, r.id = "audio", this.log("Init audio buffer, container:" + r
  58061. .container + ", codecs[parsed]=[" + r.codec + "]"), this.hls.trigger(a.Events
  58062. .BUFFER_CODECS, e);
  58063. var s = r.initSegment;
  58064. if (null !== s && void 0 !== s && s.byteLength) {
  58065. var o = {
  58066. type: "audio",
  58067. frag: t,
  58068. part: null,
  58069. chunkMeta: i,
  58070. parent: t.type,
  58071. data: s
  58072. };
  58073. this.hls.trigger(a.Events.BUFFER_APPENDING, o)
  58074. }
  58075. this.tick()
  58076. }
  58077. }
  58078. }, w.loadFragment = function(t, i, a) {
  58079. var s = this.fragmentTracker.getState(t);
  58080. this.fragCurrent = t, (this.audioSwitch || s === o.FragmentState.NOT_LOADED || s === o
  58081. .FragmentState.PARTIAL) && ("initSegment" === t.sn ? this._loadInitSegment(t) : i.live && !
  58082. Object(r.isFiniteNumber)(this.initPTS[t.cc]) ? (this.log(
  58083. "Waiting for video PTS in continuity counter " + t.cc +
  58084. " of live stream before loading audio fragment " + t.sn + " of level " + this.trackId),
  58085. this.state = n.State.WAITING_INIT_PTS) : (this.startFragRequested = !0, e.prototype
  58086. .loadFragment.call(this, t, i, a)))
  58087. }, w.completeAudioSwitch = function() {
  58088. var t = this.hls,
  58089. i = this.media,
  58090. r = this.trackId;
  58091. i && (this.log("Switching audio track : flushing all audio"), e.prototype.flushMainBuffer.call(
  58092. this, 0, Number.POSITIVE_INFINITY, "audio")), this.audioSwitch = !1, t.trigger(a.Events
  58093. .AUDIO_TRACK_SWITCHED, {
  58094. id: r
  58095. })
  58096. }, b
  58097. }(n.default);
  58098. t.default = b
  58099. },
  58100. "./src/controller/audio-track-controller.ts": function(e, t, i) {
  58101. "use strict";
  58102. i.r(t);
  58103. var r = i("./src/events.ts"),
  58104. n = i("./src/errors.ts"),
  58105. a = i("./src/controller/base-playlist-controller.ts"),
  58106. s = i("./src/types/loader.ts");
  58107. function o(e, t) {
  58108. for (var i = 0; i < t.length; i++) {
  58109. var r = t[i];
  58110. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  58111. .defineProperty(e, r.key, r)
  58112. }
  58113. }
  58114. function u(e, t) {
  58115. return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  58116. return e.__proto__ = t, e
  58117. })(e, t)
  58118. }
  58119. var l = function(e) {
  58120. var t, i;
  58121. function a(t) {
  58122. var i;
  58123. return (i = e.call(this, t, "[audio-track-controller]") || this).tracks = [], i.groupId = null, i
  58124. .tracksInGroup = [], i.trackId = -1, i.trackName = "", i.selectDefaultTrack = !0, i
  58125. .registerListeners(), i
  58126. }
  58127. i = e, (t = a).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i);
  58128. var l, d, c, h = a.prototype;
  58129. return h.registerListeners = function() {
  58130. var e = this.hls;
  58131. e.on(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.on(r.Events.MANIFEST_PARSED,
  58132. this.onManifestParsed, this), e.on(r.Events.LEVEL_LOADING, this.onLevelLoading, this), e.on(
  58133. r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e.on(r.Events.AUDIO_TRACK_LOADED,
  58134. this.onAudioTrackLoaded, this), e.on(r.Events.ERROR, this.onError, this)
  58135. }, h.unregisterListeners = function() {
  58136. var e = this.hls;
  58137. e.off(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.off(r.Events.MANIFEST_PARSED,
  58138. this.onManifestParsed, this), e.off(r.Events.LEVEL_LOADING, this.onLevelLoading, this), e
  58139. .off(r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e.off(r.Events
  58140. .AUDIO_TRACK_LOADED, this.onAudioTrackLoaded, this), e.off(r.Events.ERROR, this.onError,
  58141. this)
  58142. }, h.destroy = function() {
  58143. this.unregisterListeners(), this.tracks.length = 0, this.tracksInGroup.length = 0, e.prototype
  58144. .destroy.call(this)
  58145. }, h.onManifestLoading = function() {
  58146. this.tracks = [], this.groupId = null, this.tracksInGroup = [], this.trackId = -1, this
  58147. .trackName = "", this.selectDefaultTrack = !0
  58148. }, h.onManifestParsed = function(e, t) {
  58149. this.tracks = t.audioTracks || []
  58150. }, h.onAudioTrackLoaded = function(e, t) {
  58151. var i = t.id,
  58152. r = t.details,
  58153. n = this.tracksInGroup[i];
  58154. if (n) {
  58155. var a = n.details;
  58156. n.details = t.details, this.log("audioTrack " + i + " loaded [" + r.startSN + "-" + r.endSN +
  58157. "]"), i === this.trackId && (this.retryCount = 0, this.playlistLoaded(i, t, a))
  58158. } else this.warn("Invalid audio track id " + i)
  58159. }, h.onLevelLoading = function(e, t) {
  58160. this.switchLevel(t.level)
  58161. }, h.onLevelSwitching = function(e, t) {
  58162. this.switchLevel(t.level)
  58163. }, h.switchLevel = function(e) {
  58164. var t = this.hls.levels[e];
  58165. if (null !== t && void 0 !== t && t.audioGroupIds) {
  58166. var i = t.audioGroupIds[t.urlId];
  58167. if (this.groupId !== i) {
  58168. this.groupId = i;
  58169. var n = this.tracks.filter(function(e) {
  58170. return !i || e.groupId === i
  58171. });
  58172. this.selectDefaultTrack && !n.some(function(e) {
  58173. return e.default
  58174. }) && (this.selectDefaultTrack = !1), this.tracksInGroup = n;
  58175. var a = {
  58176. audioTracks: n
  58177. };
  58178. this.log("Updating audio tracks, " + n.length + ' track(s) found in "' + i + '" group-id'),
  58179. this.hls.trigger(r.Events.AUDIO_TRACKS_UPDATED, a), this.selectInitialTrack()
  58180. }
  58181. }
  58182. }, h.onError = function(t, i) {
  58183. e.prototype.onError.call(this, t, i), !i.fatal && i.context && i.context.type === s
  58184. .PlaylistContextType.AUDIO_TRACK && i.context.id === this.trackId && i.context.groupId ===
  58185. this.groupId && this.retryLoadingOrFail(i)
  58186. }, h.setAudioTrack = function(e) {
  58187. var t = this.tracksInGroup;
  58188. if (e < 0 || e >= t.length) this.warn("Invalid id passed to audio-track controller");
  58189. else {
  58190. this.clearTimer();
  58191. var i = t[this.trackId];
  58192. this.log("Now switching to audio-track index " + e);
  58193. var n = t[e],
  58194. a = n.id,
  58195. s = n.groupId,
  58196. o = void 0 === s ? "" : s,
  58197. u = n.name,
  58198. l = n.type,
  58199. d = n.url;
  58200. if (this.trackId = e, this.trackName = u, this.selectDefaultTrack = !1, this.hls.trigger(r
  58201. .Events.AUDIO_TRACK_SWITCHING, {
  58202. id: a,
  58203. groupId: o,
  58204. name: u,
  58205. type: l,
  58206. url: d
  58207. }), !n.details || n.details.live) {
  58208. var c = this.switchParams(n.url, null === i || void 0 === i ? void 0 : i.details);
  58209. this.loadPlaylist(c)
  58210. }
  58211. }
  58212. }, h.selectInitialTrack = function() {
  58213. var e = this.tracksInGroup;
  58214. console.assert(e.length, "Initial audio track should be selected when tracks are known");
  58215. var t = this.trackName,
  58216. i = this.findTrackId(t) || this.findTrackId(); - 1 !== i ? this.setAudioTrack(i) : (this.warn(
  58217. "No track found for running audio group-ID: " + this.groupId), this.hls.trigger(r.Events
  58218. .ERROR, {
  58219. type: n.ErrorTypes.MEDIA_ERROR,
  58220. details: n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,
  58221. fatal: !0
  58222. }))
  58223. }, h.findTrackId = function(e) {
  58224. for (var t = this.tracksInGroup, i = 0; i < t.length; i++) {
  58225. var r = t[i];
  58226. if ((!this.selectDefaultTrack || r.default) && (!e || e === r.name)) return r.id
  58227. }
  58228. return -1
  58229. }, h.loadPlaylist = function(e) {
  58230. var t = this.tracksInGroup[this.trackId];
  58231. if (this.shouldLoadTrack(t)) {
  58232. var i = t.id,
  58233. n = t.groupId,
  58234. a = t.url;
  58235. if (e) try {
  58236. a = e.addDirectives(a)
  58237. } catch (e) {
  58238. this.warn("Could not construct new URL with HLS Delivery Directives: " + e)
  58239. }
  58240. this.log("loading audio-track playlist for id: " + i), this.clearTimer(), this.hls.trigger(r
  58241. .Events.AUDIO_TRACK_LOADING, {
  58242. url: a,
  58243. id: i,
  58244. groupId: n,
  58245. deliveryDirectives: e || null
  58246. })
  58247. }
  58248. }, l = a, (d = [{
  58249. key: "audioTracks",
  58250. get: function() {
  58251. return this.tracksInGroup
  58252. }
  58253. }, {
  58254. key: "audioTrack",
  58255. get: function() {
  58256. return this.trackId
  58257. },
  58258. set: function(e) {
  58259. this.selectDefaultTrack = !1, this.setAudioTrack(e)
  58260. }
  58261. }]) && o(l.prototype, d), c && o(l, c), Object.defineProperty(l, "prototype", {
  58262. writable: !1
  58263. }), a
  58264. }(a.default);
  58265. t.default = l
  58266. },
  58267. "./src/controller/base-playlist-controller.ts": function(e, t, i) {
  58268. "use strict";
  58269. i.r(t), i.d(t, "default", function() {
  58270. return u
  58271. });
  58272. var r = i("./src/polyfills/number.ts"),
  58273. n = i("./src/types/level.ts"),
  58274. a = i("./src/controller/level-helper.ts"),
  58275. s = i("./src/utils/logger.ts"),
  58276. o = i("./src/errors.ts"),
  58277. u = function() {
  58278. function e(e, t) {
  58279. this.hls = void 0, this.timer = -1, this.canLoad = !1, this.retryCount = 0, this.log = void 0,
  58280. this.warn = void 0, this.log = s.logger.log.bind(s.logger, t + ":"), this.warn = s.logger.warn
  58281. .bind(s.logger, t + ":"), this.hls = e
  58282. }
  58283. var t = e.prototype;
  58284. return t.destroy = function() {
  58285. this.clearTimer(), this.hls = this.log = this.warn = null
  58286. }, t.onError = function(e, t) {
  58287. t.fatal && t.type === o.ErrorTypes.NETWORK_ERROR && this.clearTimer()
  58288. }, t.clearTimer = function() {
  58289. clearTimeout(this.timer), this.timer = -1
  58290. }, t.startLoad = function() {
  58291. this.canLoad = !0, this.retryCount = 0, this.loadPlaylist()
  58292. }, t.stopLoad = function() {
  58293. this.canLoad = !1, this.clearTimer()
  58294. }, t.switchParams = function(e, t) {
  58295. var i = null === t || void 0 === t ? void 0 : t.renditionReports;
  58296. if (i)
  58297. for (var a = 0; a < i.length; a++) {
  58298. var s = i[a],
  58299. o = "" + s.URI;
  58300. if (o === e.slice(-o.length)) {
  58301. var u = parseInt(s["LAST-MSN"]),
  58302. l = parseInt(s["LAST-PART"]);
  58303. if (t && this.hls.config.lowLatencyMode) {
  58304. var d = Math.min(t.age - t.partTarget, t.targetduration);
  58305. void 0 !== l && d > t.partTarget && (l += 1)
  58306. }
  58307. if (Object(r.isFiniteNumber)(u)) return new n.HlsUrlParameters(u, Object(r.isFiniteNumber)
  58308. (l) ? l : void 0, n.HlsSkip.No)
  58309. }
  58310. }
  58311. }, t.loadPlaylist = function(e) {}, t.shouldLoadTrack = function(e) {
  58312. return this.canLoad && e && !!e.url && (!e.details || e.details.live)
  58313. }, t.playlistLoaded = function(e, t, i) {
  58314. var r = this,
  58315. n = t.details,
  58316. s = t.stats,
  58317. o = s.loading.end ? Math.max(0, self.performance.now() - s.loading.end) : 0;
  58318. if (n.advancedDateTime = Date.now() - o, n.live || null !== i && void 0 !== i && i.live) {
  58319. if (n.reloaded(i), i && this.log("live playlist " + e + " " + (n.advanced ? "REFRESHED " + n
  58320. .lastPartSn + "-" + n.lastPartIndex : "MISSED")), i && n.fragments.length > 0 && Object(a
  58321. .mergeDetails)(i, n), !this.canLoad || !n.live) return;
  58322. var u, l = void 0,
  58323. d = void 0;
  58324. if (n.canBlockReload && n.endSN && n.advanced) {
  58325. var c = this.hls.config.lowLatencyMode,
  58326. h = n.lastPartSn,
  58327. f = n.endSN,
  58328. p = n.lastPartIndex,
  58329. m = h === f; - 1 !== p ? (l = m ? f + 1 : h, d = m ? c ? 0 : p : p + 1) : l = f + 1;
  58330. var g = n.age,
  58331. v = g + n.ageHeader,
  58332. y = Math.min(v - n.partTarget, 1.5 * n.targetduration);
  58333. if (y > 0) {
  58334. if (i && y > i.tuneInGoal) this.warn("CDN Tune-in goal increased from: " + i.tuneInGoal +
  58335. " to: " + y + " with playlist age: " + n.age), y = 0;
  58336. else {
  58337. var _ = Math.floor(y / n.targetduration);
  58338. if (l += _, void 0 !== d) d += Math.round(y % n.targetduration / n.partTarget);
  58339. this.log("CDN Tune-in age: " + n.ageHeader + "s last advanced " + g.toFixed(2) +
  58340. "s goal: " + y + " skip sn " + _ + " to part " + d)
  58341. }
  58342. n.tuneInGoal = y
  58343. }
  58344. if (u = this.getDeliveryDirectives(n, t.deliveryDirectives, l, d), c || !m) return void this
  58345. .loadPlaylist(u)
  58346. } else u = this.getDeliveryDirectives(n, t.deliveryDirectives, l, d);
  58347. var b = Object(a.computeReloadInterval)(n, s);
  58348. void 0 !== l && n.canBlockReload && (b -= n.partTarget || 1), this.log(
  58349. "reload live playlist " + e + " in " + Math.round(b) + " ms"), this.timer = self
  58350. .setTimeout(function() {
  58351. return r.loadPlaylist(u)
  58352. }, b)
  58353. } else this.clearTimer()
  58354. }, t.getDeliveryDirectives = function(e, t, i, r) {
  58355. var a = Object(n.getSkipValue)(e, i);
  58356. return null !== t && void 0 !== t && t.skip && e.deltaUpdateFailed && (i = t.msn, r = t.part,
  58357. a = n.HlsSkip.No), new n.HlsUrlParameters(i, r, a)
  58358. }, t.retryLoadingOrFail = function(e) {
  58359. var t, i = this,
  58360. r = this.hls.config,
  58361. n = this.retryCount < r.levelLoadingMaxRetry;
  58362. if (n)
  58363. if (this.retryCount++, e.details.indexOf("LoadTimeOut") > -1 && null !== (t = e.context) &&
  58364. void 0 !== t && t.deliveryDirectives) this.warn("retry playlist loading #" + this
  58365. .retryCount + ' after "' + e.details + '"'), this.loadPlaylist();
  58366. else {
  58367. var a = Math.min(Math.pow(2, this.retryCount) * r.levelLoadingRetryDelay, r
  58368. .levelLoadingMaxRetryTimeout);
  58369. this.timer = self.setTimeout(function() {
  58370. return i.loadPlaylist()
  58371. }, a), this.warn("retry playlist loading #" + this.retryCount + " in " + a +
  58372. ' ms after "' + e.details + '"')
  58373. }
  58374. else this.warn('cannot recover from error "' + e.details + '"'), this.clearTimer(), e.fatal = !
  58375. 0;
  58376. return n
  58377. }, e
  58378. }()
  58379. },
  58380. "./src/controller/base-stream-controller.ts": function(e, t, i) {
  58381. "use strict";
  58382. i.r(t), i.d(t, "State", function() {
  58383. return w
  58384. }), i.d(t, "default", function() {
  58385. return E
  58386. });
  58387. var r = i("./src/polyfills/number.ts"),
  58388. n = i("./src/task-loop.ts"),
  58389. a = i("./src/controller/fragment-tracker.ts"),
  58390. s = i("./src/utils/buffer-helper.ts"),
  58391. o = i("./src/utils/logger.ts"),
  58392. u = i("./src/events.ts"),
  58393. l = i("./src/errors.ts"),
  58394. d = i("./src/types/transmuxer.ts"),
  58395. c = i("./src/utils/mp4-tools.ts"),
  58396. h = i("./src/utils/discontinuities.ts"),
  58397. f = i("./src/controller/fragment-finders.ts"),
  58398. p = i("./src/controller/level-helper.ts"),
  58399. m = i("./src/loader/fragment-loader.ts"),
  58400. g = i("./src/crypt/decrypter.ts"),
  58401. v = i("./src/utils/time-ranges.ts"),
  58402. y = i("./src/types/loader.ts");
  58403. function _(e, t) {
  58404. for (var i = 0; i < t.length; i++) {
  58405. var r = t[i];
  58406. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  58407. .defineProperty(e, r.key, r)
  58408. }
  58409. }
  58410. function b(e, t) {
  58411. return (b = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  58412. return e.__proto__ = t, e
  58413. })(e, t)
  58414. }
  58415. var w = {
  58416. STOPPED: "STOPPED",
  58417. IDLE: "IDLE",
  58418. KEY_LOADING: "KEY_LOADING",
  58419. FRAG_LOADING: "FRAG_LOADING",
  58420. FRAG_LOADING_WAITING_RETRY: "FRAG_LOADING_WAITING_RETRY",
  58421. WAITING_TRACK: "WAITING_TRACK",
  58422. PARSING: "PARSING",
  58423. PARSED: "PARSED",
  58424. BACKTRACKING: "BACKTRACKING",
  58425. ENDED: "ENDED",
  58426. ERROR: "ERROR",
  58427. WAITING_INIT_PTS: "WAITING_INIT_PTS",
  58428. WAITING_LEVEL: "WAITING_LEVEL"
  58429. },
  58430. E = function(e) {
  58431. var t, i;
  58432. function n(t, i, r) {
  58433. var n;
  58434. return (n = e.call(this) || this).hls = void 0, n.fragPrevious = null, n.fragCurrent = null, n
  58435. .fragmentTracker = void 0, n.transmuxer = null, n._state = w.STOPPED, n.media = void 0, n
  58436. .mediaBuffer = void 0, n.config = void 0, n.bitrateTest = !1, n.lastCurrentTime = 0, n
  58437. .nextLoadPosition = 0, n.startPosition = 0, n.loadedmetadata = !1, n.fragLoadError = 0, n
  58438. .retryDate = 0, n.levels = null, n.fragmentLoader = void 0, n.levelLastLoaded = null, n
  58439. .startFragRequested = !1, n.decrypter = void 0, n.initPTS = [], n.onvseeking = null, n
  58440. .onvended = null, n.logPrefix = "", n.log = void 0, n.warn = void 0, n.logPrefix = r, n.log = o
  58441. .logger.log.bind(o.logger, r + ":"), n.warn = o.logger.warn.bind(o.logger, r + ":"), n.hls = t,
  58442. n.fragmentLoader = new m.default(t.config, t), n.fragmentTracker = i, n.config = t.config, n
  58443. .decrypter = new g.default(t, t.config), t.on(u.Events.KEY_LOADED, n.onKeyLoaded, function(e) {
  58444. if (void 0 === e) throw new ReferenceError(
  58445. "this hasn't been initialised - super() hasn't been called");
  58446. return e
  58447. }(n)), n
  58448. }
  58449. i = e, (t = n).prototype = Object.create(i.prototype), t.prototype.constructor = t, b(t, i);
  58450. var E, T, S, A = n.prototype;
  58451. return A.doTick = function() {
  58452. this.onTickEnd()
  58453. }, A.onTickEnd = function() {}, A.startLoad = function(e) {}, A.stopLoad = function() {
  58454. this.fragmentLoader.abort();
  58455. var e = this.fragCurrent;
  58456. e && this.fragmentTracker.removeFragment(e), this.resetTransmuxer(), this.fragCurrent = null,
  58457. this.fragPrevious = null, this.clearInterval(), this.clearNextTick(), this.state = w.STOPPED
  58458. }, A._streamEnded = function(e, t) {
  58459. var i = this.fragCurrent,
  58460. r = this.fragmentTracker;
  58461. if (!t.live && i && i.sn >= t.endSN && !e.nextStart) {
  58462. var n = t.partList;
  58463. if (null !== n && void 0 !== n && n.length) {
  58464. var o = n[n.length - 1];
  58465. return s.BufferHelper.isBuffered(this.media, o.start + o.duration / 2)
  58466. }
  58467. var u = r.getState(i);
  58468. return u === a.FragmentState.PARTIAL || u === a.FragmentState.OK
  58469. }
  58470. return !1
  58471. }, A.onMediaAttached = function(e, t) {
  58472. var i = this.media = this.mediaBuffer = t.media;
  58473. this.onvseeking = this.onMediaSeeking.bind(this), this.onvended = this.onMediaEnded.bind(this),
  58474. i.addEventListener("seeking", this.onvseeking), i.addEventListener("ended", this.onvended);
  58475. var r = this.config;
  58476. this.levels && r.autoStartLoad && this.state === w.STOPPED && this.startLoad(r.startPosition)
  58477. }, A.onMediaDetaching = function() {
  58478. var e = this.media;
  58479. null !== e && void 0 !== e && e.ended && (this.log(
  58480. "MSE detaching and video ended, reset startPosition"), this.startPosition = this
  58481. .lastCurrentTime = 0), e && (e.removeEventListener("seeking", this.onvseeking), e
  58482. .removeEventListener("ended", this.onvended), this.onvseeking = this.onvended = null), this
  58483. .media = this.mediaBuffer = null, this.loadedmetadata = !1, this.fragmentTracker
  58484. .removeAllFragments(), this.stopLoad()
  58485. }, A.onMediaSeeking = function() {
  58486. var e = this.config,
  58487. t = this.fragCurrent,
  58488. i = this.media,
  58489. n = this.mediaBuffer,
  58490. a = this.state,
  58491. o = i ? i.currentTime : 0,
  58492. u = s.BufferHelper.bufferInfo(n || i, o, e.maxBufferHole);
  58493. if (this.log("media seeking to " + (Object(r.isFiniteNumber)(o) ? o.toFixed(3) : o) +
  58494. ", state: " + a), a === w.ENDED) this.resetLoadingState();
  58495. else if (t && !u.len) {
  58496. var l = e.maxFragLookUpTolerance,
  58497. d = t.start - l,
  58498. c = o > t.start + t.duration + l;
  58499. (o < d || c) && (c && t.loader && (this.log(
  58500. "seeking outside of buffer while fragment load in progress, cancel fragment load"), t
  58501. .loader.abort()), this.resetLoadingState())
  58502. }
  58503. i && (this.lastCurrentTime = o), this.loadedmetadata || u.len || (this.nextLoadPosition = this
  58504. .startPosition = o), this.tickImmediate()
  58505. }, A.onMediaEnded = function() {
  58506. this.startPosition = this.lastCurrentTime = 0
  58507. }, A.onKeyLoaded = function(e, t) {
  58508. if (this.state === w.KEY_LOADING && t.frag === this.fragCurrent && this.levels) {
  58509. this.state = w.IDLE;
  58510. var i = this.levels[t.frag.level].details;
  58511. i && this.loadFragment(t.frag, i, t.frag.start)
  58512. }
  58513. }, A.onHandlerDestroying = function() {
  58514. this.stopLoad(), e.prototype.onHandlerDestroying.call(this)
  58515. }, A.onHandlerDestroyed = function() {
  58516. this.state = w.STOPPED, this.hls.off(u.Events.KEY_LOADED, this.onKeyLoaded, this), this
  58517. .fragmentLoader && this.fragmentLoader.destroy(), this.decrypter && this.decrypter.destroy(),
  58518. this.hls = this.log = this.warn = this.decrypter = this.fragmentLoader = this
  58519. .fragmentTracker = null, e.prototype.onHandlerDestroyed.call(this)
  58520. }, A.loadKey = function(e, t) {
  58521. this.log("Loading key for " + e.sn + " of [" + t.startSN + "-" + t.endSN + "], " + (
  58522. "[stream-controller]" === this.logPrefix ? "level" : "track") + " " + e.level), this.state =
  58523. w.KEY_LOADING, this.fragCurrent = e, this.hls.trigger(u.Events.KEY_LOADING, {
  58524. frag: e
  58525. })
  58526. }, A.loadFragment = function(e, t, i) {
  58527. this._loadFragForPlayback(e, t, i)
  58528. }, A._loadFragForPlayback = function(e, t, i) {
  58529. var r = this;
  58530. this._doFragLoad(e, t, i, function(t) {
  58531. if (r.fragContextChanged(e)) return r.warn("Fragment " + e.sn + (t.part ? " p: " + t.part
  58532. .index : "") + " of level " + e.level + " was dropped during download."), void r
  58533. .fragmentTracker.removeFragment(e);
  58534. e.stats.chunkCount++, r._handleFragmentLoadProgress(t)
  58535. }).then(function(t) {
  58536. if (t) {
  58537. r.fragLoadError = 0;
  58538. var i = r.state;
  58539. if (!r.fragContextChanged(e)) return "payload" in t && (r.log("Loaded fragment " + e
  58540. .sn + " of level " + e.level), r.hls.trigger(u.Events.FRAG_LOADED, t), r
  58541. .state === w.BACKTRACKING) ? (r.fragmentTracker.backtrack(e, t), void r
  58542. .resetFragmentLoading(e)) : void r._handleFragmentLoadComplete(t);
  58543. (i === w.FRAG_LOADING || i === w.BACKTRACKING || !r.fragCurrent && i === w.PARSING) && (
  58544. r.fragmentTracker.removeFragment(e), r.state = w.IDLE)
  58545. }
  58546. }).catch(function(t) {
  58547. r.state !== w.STOPPED && (r.warn(t), r.resetFragmentLoading(e))
  58548. })
  58549. }, A.flushMainBuffer = function(e, t, i) {
  58550. if (void 0 === i && (i = null), e - t) {
  58551. var r = {
  58552. startOffset: e,
  58553. endOffset: t,
  58554. type: i
  58555. };
  58556. this.fragLoadError = 0, this.hls.trigger(u.Events.BUFFER_FLUSHING, r)
  58557. }
  58558. }, A._loadInitSegment = function(e) {
  58559. var t = this;
  58560. this._doFragLoad(e).then(function(i) {
  58561. if (!i || t.fragContextChanged(e) || !t.levels) throw new Error("init load aborted");
  58562. return i
  58563. }).then(function(i) {
  58564. var r = t.hls,
  58565. n = i.payload,
  58566. a = e.decryptdata;
  58567. if (n && n.byteLength > 0 && a && a.key && a.iv && "AES-128" === a.method) {
  58568. var s = self.performance.now();
  58569. return t.decrypter.webCryptoDecrypt(new Uint8Array(n), a.key.buffer, a.iv.buffer).then(
  58570. function(t) {
  58571. var n = self.performance.now();
  58572. return r.trigger(u.Events.FRAG_DECRYPTED, {
  58573. frag: e,
  58574. payload: t,
  58575. stats: {
  58576. tstart: s,
  58577. tdecrypt: n
  58578. }
  58579. }), i.payload = t, i
  58580. })
  58581. }
  58582. return i
  58583. }).then(function(i) {
  58584. var r = t.fragCurrent,
  58585. n = t.hls,
  58586. a = t.levels;
  58587. if (!a) throw new Error("init load aborted, missing levels");
  58588. var s = a[e.level].details;
  58589. console.assert(s, "Level details are defined when init segment is loaded");
  58590. var o = e.stats;
  58591. t.state = w.IDLE, t.fragLoadError = 0, e.data = new Uint8Array(i.payload), o.parsing
  58592. .start = o.buffering.start = self.performance.now(), o.parsing.end = o.buffering.end =
  58593. self.performance.now(), i.frag === r && n.trigger(u.Events.FRAG_BUFFERED, {
  58594. stats: o,
  58595. frag: r,
  58596. part: null,
  58597. id: e.type
  58598. }), t.tick()
  58599. }).catch(function(i) {
  58600. t.warn(i), t.resetFragmentLoading(e)
  58601. })
  58602. }, A.fragContextChanged = function(e) {
  58603. var t = this.fragCurrent;
  58604. return !e || !t || e.level !== t.level || e.sn !== t.sn || e.urlId !== t.urlId
  58605. }, A.fragBufferedComplete = function(e, t) {
  58606. var i = this.mediaBuffer ? this.mediaBuffer : this.media;
  58607. this.log("Buffered " + e.type + " sn: " + e.sn + (t ? " part: " + t.index : "") + " of " + (
  58608. "[stream-controller]" === this.logPrefix ? "level" : "track") + " " + e.level + " " + v
  58609. .default.toString(s.BufferHelper.getBuffered(i))), this.state = w.IDLE, this.tick()
  58610. }, A._handleFragmentLoadComplete = function(e) {
  58611. var t = this.transmuxer;
  58612. if (t) {
  58613. var i = e.frag,
  58614. r = e.part,
  58615. n = e.partsLoaded,
  58616. a = !n || 0 === n.length || n.some(function(e) {
  58617. return !e
  58618. }),
  58619. s = new d.ChunkMetadata(i.level, i.sn, i.stats.chunkCount + 1, 0, r ? r.index : -1, !a);
  58620. t.flush(s)
  58621. }
  58622. }, A._handleFragmentLoadProgress = function(e) {}, A._doFragLoad = function(e, t, i, n) {
  58623. var a = this;
  58624. if (void 0 === i && (i = null), !this.levels) throw new Error(
  58625. "frag load aborted, missing levels");
  58626. if (i = Math.max(e.start, i || 0), this.config.lowLatencyMode && t) {
  58627. var s = t.partList;
  58628. if (s && n) {
  58629. i > e.end && t.fragmentHint && (e = t.fragmentHint);
  58630. var o = this.getNextPart(s, e, i);
  58631. if (o > -1) {
  58632. var l = s[o];
  58633. return this.log("Loading part sn: " + e.sn + " p: " + l.index + " cc: " + e.cc +
  58634. " of playlist [" + t.startSN + "-" + t.endSN + "] parts [0-" + o + "-" + (s.length -
  58635. 1) + "] " + ("[stream-controller]" === this.logPrefix ? "level" : "track") + ": " +
  58636. e.level + ", target: " + parseFloat(i.toFixed(3))), this.nextLoadPosition = l.start +
  58637. l.duration, this.state = w.FRAG_LOADING, this.hls.trigger(u.Events.FRAG_LOADING, {
  58638. frag: e,
  58639. part: s[o],
  58640. targetBufferTime: i
  58641. }), this.doFragPartsLoad(e, s, o, n).catch(function(e) {
  58642. return a.handleFragLoadError(e)
  58643. })
  58644. }
  58645. if (!e.url || this.loadedEndOfParts(s, i)) return Promise.resolve(null)
  58646. }
  58647. }
  58648. return this.log("Loading fragment " + e.sn + " cc: " + e.cc + " " + (t ? "of [" + t.startSN +
  58649. "-" + t.endSN + "] " : "") + ("[stream-controller]" === this.logPrefix ? "level" :
  58650. "track") + ": " + e.level + ", target: " + parseFloat(i.toFixed(3))), Object(r
  58651. .isFiniteNumber)(e.sn) && !this.bitrateTest && (this.nextLoadPosition = e.start + e
  58652. .duration), this.state = w.FRAG_LOADING, this.hls.trigger(u.Events.FRAG_LOADING, {
  58653. frag: e,
  58654. targetBufferTime: i
  58655. }), this.fragmentLoader.load(e, n).catch(function(e) {
  58656. return a.handleFragLoadError(e)
  58657. })
  58658. }, A.doFragPartsLoad = function(e, t, i, r) {
  58659. var n = this;
  58660. return new Promise(function(a, s) {
  58661. var o = [];
  58662. ! function i(l) {
  58663. var d = t[l];
  58664. n.fragmentLoader.loadPart(e, d, r).then(function(r) {
  58665. o[d.index] = r;
  58666. var s = r.part;
  58667. n.hls.trigger(u.Events.FRAG_LOADED, r);
  58668. var c = t[l + 1];
  58669. if (!c || c.fragment !== e) return a({
  58670. frag: e,
  58671. part: s,
  58672. partsLoaded: o
  58673. });
  58674. i(l + 1)
  58675. }).catch(s)
  58676. }(i)
  58677. })
  58678. }, A.handleFragLoadError = function(e) {
  58679. var t = e.data;
  58680. return t && t.details === l.ErrorDetails.INTERNAL_ABORTED ? this.handleFragLoadAborted(t.frag, t
  58681. .part) : this.hls.trigger(u.Events.ERROR, t), null
  58682. }, A._handleTransmuxerFlush = function(e) {
  58683. var t = this.getCurrentContext(e);
  58684. if (t && this.state === w.PARSING) {
  58685. var i = t.frag,
  58686. r = t.part,
  58687. n = t.level,
  58688. a = self.performance.now();
  58689. i.stats.parsing.end = a, r && (r.stats.parsing.end = a), this.updateLevelTiming(i, r, n, e
  58690. .partial)
  58691. } else this.fragCurrent || (this.state = w.IDLE)
  58692. }, A.getCurrentContext = function(e) {
  58693. var t = this.levels,
  58694. i = e.level,
  58695. r = e.sn,
  58696. n = e.part;
  58697. if (!t || !t[i]) return this.warn("Levels object was unset while buffering fragment " + r +
  58698. " of level " + i + ". The current chunk will not be buffered."), null;
  58699. var a = t[i],
  58700. s = n > -1 ? Object(p.getPartWith)(a, r, n) : null,
  58701. o = s ? s.fragment : Object(p.getFragmentWithSN)(a, r, this.fragCurrent);
  58702. return o ? {
  58703. frag: o,
  58704. part: s,
  58705. level: a
  58706. } : null
  58707. }, A.bufferFragmentData = function(e, t, i, r) {
  58708. if (e && this.state === w.PARSING) {
  58709. var n = e.data1,
  58710. a = e.data2,
  58711. s = n;
  58712. if (n && a && (s = Object(c.appendUint8Array)(n, a)), s && s.length) {
  58713. var o = {
  58714. type: e.type,
  58715. frag: t,
  58716. part: i,
  58717. chunkMeta: r,
  58718. parent: t.type,
  58719. data: s
  58720. };
  58721. this.hls.trigger(u.Events.BUFFER_APPENDING, o), e.dropped && e.independent && !i && this
  58722. .flushBufferGap(t)
  58723. }
  58724. }
  58725. }, A.flushBufferGap = function(e) {
  58726. var t = this.media;
  58727. if (t)
  58728. if (s.BufferHelper.isBuffered(t, t.currentTime)) {
  58729. var i = t.currentTime,
  58730. r = s.BufferHelper.bufferInfo(t, i, 0),
  58731. n = e.duration,
  58732. a = Math.min(2 * this.config.maxFragLookUpTolerance, .25 * n),
  58733. o = Math.max(Math.min(e.start - a, r.end - a), i + a);
  58734. e.start - o > a && this.flushMainBuffer(o, e.start)
  58735. } else this.flushMainBuffer(0, e.start)
  58736. }, A.getFwdBufferInfo = function(e, t) {
  58737. var i = this.config,
  58738. n = this.getLoadPosition();
  58739. if (!Object(r.isFiniteNumber)(n)) return null;
  58740. var a = s.BufferHelper.bufferInfo(e, n, i.maxBufferHole);
  58741. if (0 === a.len && void 0 !== a.nextStart) {
  58742. var o = this.fragmentTracker.getBufferedFrag(n, t);
  58743. if (o && a.nextStart < o.end) return s.BufferHelper.bufferInfo(e, n, Math.max(a.nextStart, i
  58744. .maxBufferHole))
  58745. }
  58746. return a
  58747. }, A.getMaxBufferLength = function(e) {
  58748. var t, i = this.config;
  58749. return t = e ? Math.max(8 * i.maxBufferSize / e, i.maxBufferLength) : i.maxBufferLength, Math
  58750. .min(t, i.maxMaxBufferLength)
  58751. }, A.reduceMaxBufferLength = function(e) {
  58752. var t = this.config,
  58753. i = e || t.maxBufferLength;
  58754. return t.maxMaxBufferLength >= i && (t.maxMaxBufferLength /= 2, this.warn(
  58755. "Reduce max buffer length to " + t.maxMaxBufferLength + "s"), !0)
  58756. }, A.getNextFragment = function(e, t) {
  58757. var i, r, n = t.fragments,
  58758. a = n.length;
  58759. if (!a) return null;
  58760. var s, o = this.config,
  58761. u = n[0].start;
  58762. if (t.live) {
  58763. var l = o.initialLiveManifestSize;
  58764. if (a < l) return this.warn("Not enough fragments to start playback (have: " + a +
  58765. ", need: " + l + ")"), null;
  58766. t.PTSKnown || this.startFragRequested || -1 !== this.startPosition || (s = this
  58767. .getInitialLiveFragment(t, n), this.startPosition = s ? this.hls.liveSyncPosition || s
  58768. .start : e)
  58769. } else e <= u && (s = n[0]);
  58770. if (!s) {
  58771. var d = o.lowLatencyMode ? t.partEnd : t.fragmentEnd;
  58772. s = this.getFragmentAtPosition(e, d, t)
  58773. }
  58774. return null === (i = s) || void 0 === i || !i.initSegment || null !== (r = s) && void 0 !== r &&
  58775. r.initSegment.data || this.bitrateTest || (s = s.initSegment), s
  58776. }, A.getNextPart = function(e, t, i) {
  58777. for (var r = -1, n = !1, a = !0, s = 0, o = e.length; s < o; s++) {
  58778. var u = e[s];
  58779. if (a = a && !u.independent, r > -1 && i < u.start) break;
  58780. var l = u.loaded;
  58781. !l && (n || u.independent || a) && u.fragment === t && (r = s), n = l
  58782. }
  58783. return r
  58784. }, A.loadedEndOfParts = function(e, t) {
  58785. var i = e[e.length - 1];
  58786. return i && t > i.start && i.loaded
  58787. }, A.getInitialLiveFragment = function(e, t) {
  58788. var i = this.fragPrevious,
  58789. r = null;
  58790. if (i) {
  58791. if (e.hasProgramDateTime && (this.log(
  58792. "Live playlist, switching playlist, load frag with same PDT: " + i.programDateTime), r =
  58793. Object(f.findFragmentByPDT)(t, i.endProgramDateTime, this.config.maxFragLookUpTolerance)),
  58794. !r) {
  58795. var n = i.sn + 1;
  58796. if (n >= e.startSN && n <= e.endSN) {
  58797. var a = t[n - e.startSN];
  58798. i.cc === a.cc && (r = a, this.log(
  58799. "Live playlist, switching playlist, load frag with next SN: " + r.sn))
  58800. }
  58801. r || (r = Object(f.findFragWithCC)(t, i.cc)) && this.log(
  58802. "Live playlist, switching playlist, load frag with same CC: " + r.sn)
  58803. }
  58804. } else {
  58805. var s = this.hls.liveSyncPosition;
  58806. null !== s && (r = this.getFragmentAtPosition(s, this.bitrateTest ? e.fragmentEnd : e.edge,
  58807. e))
  58808. }
  58809. return r
  58810. }, A.getFragmentAtPosition = function(e, t, i) {
  58811. var r, n = this.config,
  58812. s = this.fragPrevious,
  58813. o = i.fragments,
  58814. u = i.endSN,
  58815. l = i.fragmentHint,
  58816. d = n.maxFragLookUpTolerance,
  58817. c = !!(n.lowLatencyMode && i.partList && l);
  58818. if (c && l && !this.bitrateTest && (o = o.concat(l), u = l.sn), e < t) {
  58819. var h = e > t - d ? 0 : d;
  58820. r = Object(f.findFragmentByPTS)(s, o, e, h)
  58821. } else r = o[o.length - 1];
  58822. if (r) {
  58823. var p = r.sn - i.startSN,
  58824. m = s && r.level === s.level,
  58825. g = o[p + 1];
  58826. if (this.fragmentTracker.getState(r) === a.FragmentState.BACKTRACKED) {
  58827. r = null;
  58828. for (var v = p; o[v] && this.fragmentTracker.getState(o[v]) === a.FragmentState
  58829. .BACKTRACKED;) r = s ? o[v--] : o[--v];
  58830. r || (r = g)
  58831. } else s && r.sn === s.sn && !c && m && (r.sn < u && this.fragmentTracker.getState(g) !== a
  58832. .FragmentState.OK ? (this.log("SN " + r.sn + " just loaded, load next one: " + g.sn), r =
  58833. g) : r = null)
  58834. }
  58835. return r
  58836. }, A.synchronizeToLiveEdge = function(e) {
  58837. var t = this.config,
  58838. i = this.media;
  58839. if (i) {
  58840. var r = this.hls.liveSyncPosition,
  58841. n = i.currentTime,
  58842. a = e.fragments[0].start,
  58843. s = e.edge,
  58844. o = n >= a - t.maxFragLookUpTolerance && n <= s;
  58845. if (null !== r && i.duration > r && (n < r || !o)) {
  58846. var u = void 0 !== t.liveMaxLatencyDuration ? t.liveMaxLatencyDuration : t
  58847. .liveMaxLatencyDurationCount * e.targetduration;
  58848. (!o && i.readyState < 4 || n < s - u) && (this.loadedmetadata || (this.nextLoadPosition =
  58849. r), i.readyState && (this.warn("Playback: " + n.toFixed(3) +
  58850. " is located too far from the end of live sliding playlist: " + s +
  58851. ", reset currentTime to : " + r.toFixed(3)), i.currentTime = r))
  58852. }
  58853. }
  58854. }, A.alignPlaylists = function(e, t) {
  58855. var i = this.levels,
  58856. n = this.levelLastLoaded,
  58857. a = this.fragPrevious,
  58858. s = null !== n ? i[n] : null,
  58859. o = e.fragments.length;
  58860. if (!o) return this.warn("No fragments in live playlist"), 0;
  58861. var u = e.fragments[0].start,
  58862. l = !t,
  58863. d = e.alignedSliding && Object(r.isFiniteNumber)(u);
  58864. if (l || !d && !u) {
  58865. Object(h.alignStream)(a, s, e);
  58866. var c = e.fragments[0].start;
  58867. return this.log("Live playlist sliding: " + c.toFixed(2) + " start-sn: " + (t ? t.startSN :
  58868. "na") + "->" + e.startSN + " prev-sn: " + (a ? a.sn : "na") + " fragments: " + o), c
  58869. }
  58870. return u
  58871. }, A.waitForCdnTuneIn = function(e) {
  58872. return e.live && e.canBlockReload && e.tuneInGoal > Math.max(e.partHoldBack, 3 * e.partTarget)
  58873. }, A.setStartPosition = function(e, t) {
  58874. var i = this.startPosition;
  58875. if (i < t && (i = -1), -1 === i || -1 === this.lastCurrentTime) {
  58876. var n = e.startTimeOffset;
  58877. Object(r.isFiniteNumber)(n) ? (i = t + n, n < 0 && (i += e.totalduration), i = Math.min(Math
  58878. .max(t, i), t + e.totalduration), this.log("Start time offset " + n +
  58879. " found in playlist, adjust startPosition to " + i), this.startPosition = i) : e.live ?
  58880. i = this.hls.liveSyncPosition || t : this.startPosition = i = 0, this.lastCurrentTime = i
  58881. }
  58882. this.nextLoadPosition = i
  58883. }, A.getLoadPosition = function() {
  58884. var e = this.media,
  58885. t = 0;
  58886. return this.loadedmetadata && e ? t = e.currentTime : this.nextLoadPosition && (t = this
  58887. .nextLoadPosition), t
  58888. }, A.handleFragLoadAborted = function(e, t) {
  58889. this.transmuxer && "initSegment" !== e.sn && e.stats.aborted && (this.warn("Fragment " + e.sn +
  58890. (t ? " part" + t.index : "") + " of level " + e.level + " was aborted"), this
  58891. .resetFragmentLoading(e))
  58892. }, A.resetFragmentLoading = function(e) {
  58893. this.fragCurrent && this.fragContextChanged(e) || (this.state = w.IDLE)
  58894. }, A.onFragmentOrKeyLoadError = function(e, t) {
  58895. if (!t.fatal) {
  58896. var i = t.frag;
  58897. if (i && i.type === e) {
  58898. var r = this.fragCurrent;
  58899. console.assert(r && i.sn === r.sn && i.level === r.level && i.urlId === r.urlId,
  58900. "Frag load error must match current frag to retry");
  58901. var n = this.config;
  58902. if (this.fragLoadError + 1 <= n.fragLoadingMaxRetry) {
  58903. if (this.resetLiveStartWhenNotLoaded(i.level)) return;
  58904. var a = Math.min(Math.pow(2, this.fragLoadError) * n.fragLoadingRetryDelay, n
  58905. .fragLoadingMaxRetryTimeout);
  58906. this.warn("Fragment " + i.sn + " of " + e + " " + i.level +
  58907. " failed to load, retrying in " + a + "ms"), this.retryDate = self.performance.now() +
  58908. a, this.fragLoadError++, this.state = w.FRAG_LOADING_WAITING_RETRY
  58909. } else t.levelRetry ? (e === y.PlaylistLevelType.AUDIO && (this.fragCurrent = null), this
  58910. .fragLoadError = 0, this.state = w.IDLE) : (o.logger.error(t.details +
  58911. " reaches max retry, redispatch as fatal ..."), t.fatal = !0, this.hls.stopLoad(),
  58912. this.state = w.ERROR)
  58913. }
  58914. }
  58915. }, A.afterBufferFlushed = function(e, t, i) {
  58916. if (e) {
  58917. var r = s.BufferHelper.getBuffered(e);
  58918. this.fragmentTracker.detectEvictedFragments(t, r, i), this.state === w.ENDED && this
  58919. .resetLoadingState()
  58920. }
  58921. }, A.resetLoadingState = function() {
  58922. this.fragCurrent = null, this.fragPrevious = null, this.state = w.IDLE
  58923. }, A.resetLiveStartWhenNotLoaded = function(e) {
  58924. if (!this.loadedmetadata) {
  58925. this.startFragRequested = !1;
  58926. var t = this.levels ? this.levels[e].details : null;
  58927. if (null !== t && void 0 !== t && t.live) return this.startPosition = -1, this
  58928. .setStartPosition(t, 0), this.resetLoadingState(), !0;
  58929. this.nextLoadPosition = this.startPosition
  58930. }
  58931. return !1
  58932. }, A.updateLevelTiming = function(e, t, i, r) {
  58933. var n = this,
  58934. a = i.details;
  58935. console.assert(!!a, "level.details must be defined"), Object.keys(e.elementaryStreams).reduce(
  58936. function(t, s) {
  58937. var o = e.elementaryStreams[s];
  58938. if (o) {
  58939. var l = o.endPTS - o.startPTS;
  58940. if (l <= 0) return n.warn("Could not parse fragment " + e.sn + " " + s +
  58941. " duration reliably (" + l +
  58942. ") resetting transmuxer to fallback to playlist timing"), n.resetTransmuxer(),
  58943. t || !1;
  58944. var d = r ? 0 : Object(p.updateFragPTSDTS)(a, e, o.startPTS, o.endPTS, o.startDTS, o
  58945. .endDTS);
  58946. return n.hls.trigger(u.Events.LEVEL_PTS_UPDATED, {
  58947. details: a,
  58948. level: i,
  58949. drift: d,
  58950. type: s,
  58951. frag: e,
  58952. start: o.startPTS,
  58953. end: o.endPTS
  58954. }), !0
  58955. }
  58956. return t
  58957. }, !1) ? (this.state = w.PARSED, this.hls.trigger(u.Events.FRAG_PARSED, {
  58958. frag: e,
  58959. part: t
  58960. })) : this.resetLoadingState()
  58961. }, A.resetTransmuxer = function() {
  58962. this.transmuxer && (this.transmuxer.destroy(), this.transmuxer = null)
  58963. }, E = n, (T = [{
  58964. key: "state",
  58965. get: function() {
  58966. return this._state
  58967. },
  58968. set: function(e) {
  58969. var t = this._state;
  58970. t !== e && (this._state = e, this.log(t + "->" + e))
  58971. }
  58972. }]) && _(E.prototype, T), S && _(E, S), Object.defineProperty(E, "prototype", {
  58973. writable: !1
  58974. }), n
  58975. }(n.default)
  58976. },
  58977. "./src/controller/buffer-controller.ts": function(e, t, i) {
  58978. "use strict";
  58979. i.r(t), i.d(t, "default", function() {
  58980. return f
  58981. });
  58982. var r = i("./src/polyfills/number.ts"),
  58983. n = i("./src/events.ts"),
  58984. a = i("./src/utils/logger.ts"),
  58985. s = i("./src/errors.ts"),
  58986. o = i("./src/utils/buffer-helper.ts"),
  58987. u = i("./src/utils/mediasource-helper.ts"),
  58988. l = i("./src/loader/fragment.ts"),
  58989. d = i("./src/controller/buffer-operation-queue.ts"),
  58990. c = Object(u.getMediaSource)(),
  58991. h = /([ha]vc.)(?:\.[^.,]+)+/,
  58992. f = function() {
  58993. function e(e) {
  58994. var t = this;
  58995. this.details = null, this._objectUrl = null, this.operationQueue = void 0, this.listeners =
  58996. void 0, this.hls = void 0, this.bufferCodecEventsExpected = 0, this._bufferCodecEventsTotal = 0,
  58997. this.media = null, this.mediaSource = null, this.appendError = 0, this.tracks = {}, this
  58998. .pendingTracks = {}, this.sourceBuffer = void 0, this._onMediaSourceOpen = function() {
  58999. var e = t.hls,
  59000. i = t.media,
  59001. r = t.mediaSource;
  59002. a.logger.log("[buffer-controller]: Media source opened"), i && (t
  59003. .updateMediaElementDuration(), e.trigger(n.Events.MEDIA_ATTACHED, {
  59004. media: i
  59005. })), r && r.removeEventListener("sourceopen", t._onMediaSourceOpen), t
  59006. .checkPendingTracks()
  59007. }, this._onMediaSourceClose = function() {
  59008. a.logger.log("[buffer-controller]: Media source closed")
  59009. }, this._onMediaSourceEnded = function() {
  59010. a.logger.log("[buffer-controller]: Media source ended")
  59011. }, this.hls = e, this._initSourceBuffer(), this.registerListeners()
  59012. }
  59013. var t = e.prototype;
  59014. return t.hasSourceTypes = function() {
  59015. return this.getSourceBufferTypes().length > 0 || Object.keys(this.pendingTracks).length > 0
  59016. }, t.destroy = function() {
  59017. this.unregisterListeners(), this.details = null
  59018. }, t.registerListeners = function() {
  59019. var e = this.hls;
  59020. e.on(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.on(n.Events.MEDIA_DETACHING, this
  59021. .onMediaDetaching, this), e.on(n.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on(
  59022. n.Events.BUFFER_RESET, this.onBufferReset, this), e.on(n.Events.BUFFER_APPENDING, this
  59023. .onBufferAppending, this), e.on(n.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.on(n
  59024. .Events.BUFFER_EOS, this.onBufferEos, this), e.on(n.Events.BUFFER_FLUSHING, this
  59025. .onBufferFlushing, this), e.on(n.Events.LEVEL_UPDATED, this.onLevelUpdated, this), e.on(n
  59026. .Events.FRAG_PARSED, this.onFragParsed, this), e.on(n.Events.FRAG_CHANGED, this
  59027. .onFragChanged, this)
  59028. }, t.unregisterListeners = function() {
  59029. var e = this.hls;
  59030. e.off(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.off(n.Events.MEDIA_DETACHING,
  59031. this.onMediaDetaching, this), e.off(n.Events.MANIFEST_PARSED, this.onManifestParsed, this),
  59032. e.off(n.Events.BUFFER_RESET, this.onBufferReset, this), e.off(n.Events.BUFFER_APPENDING, this
  59033. .onBufferAppending, this), e.off(n.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.off(n
  59034. .Events.BUFFER_EOS, this.onBufferEos, this), e.off(n.Events.BUFFER_FLUSHING, this
  59035. .onBufferFlushing, this), e.off(n.Events.LEVEL_UPDATED, this.onLevelUpdated, this), e.off(n
  59036. .Events.FRAG_PARSED, this.onFragParsed, this), e.off(n.Events.FRAG_CHANGED, this
  59037. .onFragChanged, this)
  59038. }, t._initSourceBuffer = function() {
  59039. this.sourceBuffer = {}, this.operationQueue = new d.default(this.sourceBuffer), this
  59040. .listeners = {
  59041. audio: [],
  59042. video: [],
  59043. audiovideo: []
  59044. }
  59045. }, t.onManifestParsed = function(e, t) {
  59046. var i = 2;
  59047. (t.audio && !t.video || !t.altAudio) && (i = 1), this.bufferCodecEventsExpected = this
  59048. ._bufferCodecEventsTotal = i, this.details = null, a.logger.log(this
  59049. .bufferCodecEventsExpected + " bufferCodec event(s) expected")
  59050. }, t.onMediaAttaching = function(e, t) {
  59051. var i = this.media = t.media;
  59052. if (i && c) {
  59053. var r = this.mediaSource = new c;
  59054. r.addEventListener("sourceopen", this._onMediaSourceOpen), r.addEventListener("sourceended",
  59055. this._onMediaSourceEnded), r.addEventListener("sourceclose", this._onMediaSourceClose), i
  59056. .src = self.URL.createObjectURL(r), this._objectUrl = i.src
  59057. }
  59058. }, t.onMediaDetaching = function() {
  59059. var e = this.media,
  59060. t = this.mediaSource,
  59061. i = this._objectUrl;
  59062. if (t) {
  59063. if (a.logger.log("[buffer-controller]: media source detaching"), "open" === t.readyState)
  59064. try {
  59065. t.endOfStream()
  59066. } catch (e) {
  59067. a.logger.warn("[buffer-controller]: onMediaDetaching: " + e.message +
  59068. " while calling endOfStream")
  59069. }
  59070. this.onBufferReset(), t.removeEventListener("sourceopen", this._onMediaSourceOpen), t
  59071. .removeEventListener("sourceended", this._onMediaSourceEnded), t.removeEventListener(
  59072. "sourceclose", this._onMediaSourceClose), e && (i && self.URL.revokeObjectURL(i), e
  59073. .src === i ? (e.removeAttribute("src"), e.load()) : a.logger.warn(
  59074. "[buffer-controller]: media.src was changed by a third party - skip cleanup")), this
  59075. .mediaSource = null, this.media = null, this._objectUrl = null, this
  59076. .bufferCodecEventsExpected = this._bufferCodecEventsTotal, this.pendingTracks = {}, this
  59077. .tracks = {}
  59078. }
  59079. this.hls.trigger(n.Events.MEDIA_DETACHED, void 0)
  59080. }, t.onBufferReset = function() {
  59081. var e = this;
  59082. this.getSourceBufferTypes().forEach(function(t) {
  59083. var i = e.sourceBuffer[t];
  59084. try {
  59085. i && (e.removeBufferListeners(t), e.mediaSource && e.mediaSource.removeSourceBuffer(i),
  59086. e.sourceBuffer[t] = void 0)
  59087. } catch (e) {
  59088. a.logger.warn("[buffer-controller]: Failed to reset the " + t + " buffer", e)
  59089. }
  59090. }), this._initSourceBuffer()
  59091. }, t.onBufferCodecs = function(e, t) {
  59092. var i = this,
  59093. r = this.getSourceBufferTypes().length;
  59094. Object.keys(t).forEach(function(e) {
  59095. if (r) {
  59096. var n = i.tracks[e];
  59097. if (n && "function" == typeof n.buffer.changeType) {
  59098. var s = t[e],
  59099. o = s.id,
  59100. u = s.codec,
  59101. l = s.levelCodec,
  59102. d = s.container,
  59103. c = s.metadata,
  59104. f = (n.levelCodec || n.codec).replace(h, "$1"),
  59105. p = (l || u).replace(h, "$1");
  59106. if (f !== p) {
  59107. var m = d + ";codecs=" + (l || u);
  59108. i.appendChangeType(e, m), a.logger.log("[buffer-controller]: switching codec " + f +
  59109. " to " + p), i.tracks[e] = {
  59110. buffer: n.buffer,
  59111. codec: u,
  59112. container: d,
  59113. levelCodec: l,
  59114. metadata: c,
  59115. id: o
  59116. }
  59117. }
  59118. }
  59119. } else i.pendingTracks[e] = t[e]
  59120. }), r || (this.bufferCodecEventsExpected = Math.max(this.bufferCodecEventsExpected - 1, 0),
  59121. this.mediaSource && "open" === this.mediaSource.readyState && this.checkPendingTracks())
  59122. }, t.appendChangeType = function(e, t) {
  59123. var i = this,
  59124. r = this.operationQueue,
  59125. n = {
  59126. execute: function() {
  59127. var n = i.sourceBuffer[e];
  59128. n && (a.logger.log("[buffer-controller]: changing " + e + " sourceBuffer type to " + t),
  59129. n.changeType(t)), r.shiftAndExecuteNext(e)
  59130. },
  59131. onStart: function() {},
  59132. onComplete: function() {},
  59133. onError: function(t) {
  59134. a.logger.warn("[buffer-controller]: Failed to change " + e + " SourceBuffer type", t)
  59135. }
  59136. };
  59137. r.append(n, e)
  59138. }, t.onBufferAppending = function(e, t) {
  59139. var i = this,
  59140. r = this.hls,
  59141. u = this.operationQueue,
  59142. l = this.tracks,
  59143. d = t.data,
  59144. c = t.type,
  59145. h = t.frag,
  59146. f = t.part,
  59147. p = t.chunkMeta,
  59148. m = p.buffering[c],
  59149. g = self.performance.now();
  59150. m.start = g;
  59151. var v = h.stats.buffering,
  59152. y = f ? f.stats.buffering : null;
  59153. 0 === v.start && (v.start = g), y && 0 === y.start && (y.start = g);
  59154. var _ = l.audio,
  59155. b = "audio" === c && 1 === p.id && "audio/mpeg" === (null === _ || void 0 === _ ? void 0 : _
  59156. .container),
  59157. w = {
  59158. execute: function() {
  59159. if (m.executeStart = self.performance.now(), b) {
  59160. var e = i.sourceBuffer[c];
  59161. if (e) {
  59162. var t = h.start - e.timestampOffset;
  59163. Math.abs(t) >= .1 && (a.logger.log(
  59164. "[buffer-controller]: Updating audio SourceBuffer timestampOffset to " + h
  59165. .start + " (delta: " + t + ") sn: " + h.sn + ")"), e.timestampOffset = h
  59166. .start)
  59167. }
  59168. }
  59169. i.appendExecutor(d, c)
  59170. },
  59171. onStart: function() {},
  59172. onComplete: function() {
  59173. var e = self.performance.now();
  59174. m.executeEnd = m.end = e, 0 === v.first && (v.first = e), y && 0 === y.first && (y
  59175. .first = e);
  59176. var t = i.sourceBuffer,
  59177. r = {};
  59178. for (var a in t) r[a] = o.BufferHelper.getBuffered(t[a]);
  59179. i.appendError = 0, i.hls.trigger(n.Events.BUFFER_APPENDED, {
  59180. type: c,
  59181. frag: h,
  59182. part: f,
  59183. chunkMeta: p,
  59184. parent: h.type,
  59185. timeRanges: r
  59186. })
  59187. },
  59188. onError: function(e) {
  59189. a.logger.error("[buffer-controller]: Error encountered while trying to append to the " +
  59190. c + " SourceBuffer", e);
  59191. var t = {
  59192. type: s.ErrorTypes.MEDIA_ERROR,
  59193. parent: h.type,
  59194. details: s.ErrorDetails.BUFFER_APPEND_ERROR,
  59195. err: e,
  59196. fatal: !1
  59197. };
  59198. e.code === DOMException.QUOTA_EXCEEDED_ERR ? t.details = s.ErrorDetails
  59199. .BUFFER_FULL_ERROR : (i.appendError++, t.details = s.ErrorDetails.BUFFER_APPEND_ERROR,
  59200. i.appendError > r.config.appendErrorMaxRetry && (a.logger.error(
  59201. "[buffer-controller]: Failed " + r.config.appendErrorMaxRetry +
  59202. " times to append segment in sourceBuffer"), t.fatal = !0)), r.trigger(n.Events
  59203. .ERROR, t)
  59204. }
  59205. };
  59206. u.append(w, c)
  59207. }, t.onBufferFlushing = function(e, t) {
  59208. var i = this,
  59209. r = this.operationQueue,
  59210. s = function(e) {
  59211. return {
  59212. execute: i.removeExecutor.bind(i, e, t.startOffset, t.endOffset),
  59213. onStart: function() {},
  59214. onComplete: function() {
  59215. i.hls.trigger(n.Events.BUFFER_FLUSHED, {
  59216. type: e
  59217. })
  59218. },
  59219. onError: function(t) {
  59220. a.logger.warn("[buffer-controller]: Failed to remove from " + e + " SourceBuffer", t)
  59221. }
  59222. }
  59223. };
  59224. t.type ? r.append(s(t.type), t.type) : this.getSourceBufferTypes().forEach(function(e) {
  59225. r.append(s(e), e)
  59226. })
  59227. }, t.onFragParsed = function(e, t) {
  59228. var i = this,
  59229. r = t.frag,
  59230. s = t.part,
  59231. o = [],
  59232. u = s ? s.elementaryStreams : r.elementaryStreams;
  59233. u[l.ElementaryStreamTypes.AUDIOVIDEO] ? o.push("audiovideo") : (u[l.ElementaryStreamTypes
  59234. .AUDIO] && o.push("audio"), u[l.ElementaryStreamTypes.VIDEO] && o.push("video"));
  59235. 0 === o.length && a.logger.warn(
  59236. "Fragments must have at least one ElementaryStreamType set. type: " + r.type + " level: " +
  59237. r.level + " sn: " + r.sn), this.blockBuffers(function() {
  59238. var e = self.performance.now();
  59239. r.stats.buffering.end = e, s && (s.stats.buffering.end = e);
  59240. var t = s ? s.stats : r.stats;
  59241. i.hls.trigger(n.Events.FRAG_BUFFERED, {
  59242. frag: r,
  59243. part: s,
  59244. stats: t,
  59245. id: r.type
  59246. })
  59247. }, o)
  59248. }, t.onFragChanged = function(e, t) {
  59249. this.flushBackBuffer()
  59250. }, t.onBufferEos = function(e, t) {
  59251. var i = this;
  59252. this.getSourceBufferTypes().reduce(function(e, r) {
  59253. var n = i.sourceBuffer[r];
  59254. return t.type && t.type !== r || n && !n.ended && (n.ended = !0, a.logger.log(
  59255. "[buffer-controller]: " + r + " sourceBuffer now EOS")), e && !(n && !n.ended)
  59256. }, !0) && this.blockBuffers(function() {
  59257. var e = i.mediaSource;
  59258. e && "open" === e.readyState && e.endOfStream()
  59259. })
  59260. }, t.onLevelUpdated = function(e, t) {
  59261. var i = t.details;
  59262. i.fragments.length && (this.details = i, this.getSourceBufferTypes().length ? this.blockBuffers(
  59263. this.updateMediaElementDuration.bind(this)) : this.updateMediaElementDuration())
  59264. }, t.flushBackBuffer = function() {
  59265. var e = this.hls,
  59266. t = this.details,
  59267. i = this.media,
  59268. a = this.sourceBuffer;
  59269. if (i && null !== t) {
  59270. var s = this.getSourceBufferTypes();
  59271. if (s.length) {
  59272. var u = t.live && null !== e.config.liveBackBufferLength ? e.config.liveBackBufferLength : e
  59273. .config.backBufferLength;
  59274. if (Object(r.isFiniteNumber)(u) && !(u < 0)) {
  59275. var l = i.currentTime,
  59276. d = t.levelTargetDuration,
  59277. c = Math.max(u, d),
  59278. h = Math.floor(l / d) * d - c;
  59279. s.forEach(function(i) {
  59280. var r = a[i];
  59281. if (r) {
  59282. var s = o.BufferHelper.getBuffered(r);
  59283. s.length > 0 && h > s.start(0) && (e.trigger(n.Events.BACK_BUFFER_REACHED, {
  59284. bufferEnd: h
  59285. }), t.live && e.trigger(n.Events.LIVE_BACK_BUFFER_REACHED, {
  59286. bufferEnd: h
  59287. }), e.trigger(n.Events.BUFFER_FLUSHING, {
  59288. startOffset: 0,
  59289. endOffset: h,
  59290. type: i
  59291. }))
  59292. }
  59293. })
  59294. }
  59295. }
  59296. }
  59297. }, t.updateMediaElementDuration = function() {
  59298. if (this.details && this.media && this.mediaSource && "open" === this.mediaSource.readyState) {
  59299. var e = this.details,
  59300. t = this.hls,
  59301. i = this.media,
  59302. n = this.mediaSource,
  59303. s = e.fragments[0].start + e.totalduration,
  59304. o = i.duration,
  59305. u = Object(r.isFiniteNumber)(n.duration) ? n.duration : 0;
  59306. e.live && t.config.liveDurationInfinity ? (a.logger.log(
  59307. "[buffer-controller]: Media Source duration is set to Infinity"), n.duration = 1 / 0,
  59308. this.updateSeekableRange(e)) : (s > u && s > o || !Object(r.isFiniteNumber)(o)) && (a
  59309. .logger.log("[buffer-controller]: Updating Media Source duration to " + s.toFixed(3)), n
  59310. .duration = s)
  59311. }
  59312. }, t.updateSeekableRange = function(e) {
  59313. var t = this.mediaSource,
  59314. i = e.fragments;
  59315. if (i.length && e.live && null !== t && void 0 !== t && t.setLiveSeekableRange) {
  59316. var r = Math.max(0, i[0].start),
  59317. n = Math.max(r, r + e.totalduration);
  59318. t.setLiveSeekableRange(r, n)
  59319. }
  59320. }, t.checkPendingTracks = function() {
  59321. var e = this.bufferCodecEventsExpected,
  59322. t = this.operationQueue,
  59323. i = this.pendingTracks,
  59324. r = Object.keys(i).length;
  59325. if (r && !e || 2 === r) {
  59326. this.createSourceBuffers(i), this.pendingTracks = {};
  59327. var a = this.getSourceBufferTypes();
  59328. if (0 === a.length) return void this.hls.trigger(n.Events.ERROR, {
  59329. type: s.ErrorTypes.MEDIA_ERROR,
  59330. details: s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,
  59331. fatal: !0,
  59332. reason: "could not create source buffer for media codec(s)"
  59333. });
  59334. a.forEach(function(e) {
  59335. t.executeNext(e)
  59336. })
  59337. }
  59338. }, t.createSourceBuffers = function(e) {
  59339. var t = this.sourceBuffer,
  59340. i = this.mediaSource;
  59341. if (!i) throw Error("createSourceBuffers called when mediaSource was null");
  59342. var r = 0;
  59343. for (var o in e)
  59344. if (!t[o]) {
  59345. var u = e[o];
  59346. if (!u) throw Error("source buffer exists for track " + o + ", however track does not");
  59347. console.log("track.levelCodec = ", o, u.levelCodec, u.codec);
  59348. var l = u.levelCodec || u.codec;
  59349. "video" === o ? "avc1.420128" === (l = u.levelCodec || u.codec) && (l = "avc1.4d002a") : l =
  59350. u.levelCodec || u.codec;
  59351. var d = u.container + ";codecs=" + l;
  59352. a.logger.log("[buffer-controller]: creating sourceBuffer(" + d + ")");
  59353. try {
  59354. var c = t[o] = i.addSourceBuffer(d),
  59355. h = o;
  59356. this.addBufferListener(h, "updatestart", this._onSBUpdateStart), this.addBufferListener(h,
  59357. "updateend", this._onSBUpdateEnd), this.addBufferListener(h, "error", this
  59358. ._onSBUpdateError), this.tracks[o] = {
  59359. buffer: c,
  59360. codec: l,
  59361. container: u.container,
  59362. levelCodec: u.levelCodec,
  59363. metadata: u.metadata,
  59364. id: u.id
  59365. }, r++
  59366. } catch (e) {
  59367. a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: " + e
  59368. .message), this.hls.trigger(n.Events.ERROR, {
  59369. type: s.ErrorTypes.MEDIA_ERROR,
  59370. details: s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,
  59371. fatal: !1,
  59372. error: e,
  59373. mimeType: d
  59374. })
  59375. }
  59376. } r && this.hls.trigger(n.Events.BUFFER_CREATED, {
  59377. tracks: this.tracks
  59378. })
  59379. }, t._onSBUpdateStart = function(e) {
  59380. this.operationQueue.current(e).onStart()
  59381. }, t._onSBUpdateEnd = function(e) {
  59382. var t = this.operationQueue;
  59383. t.current(e).onComplete(), t.shiftAndExecuteNext(e)
  59384. }, t._onSBUpdateError = function(e, t) {
  59385. a.logger.error("[buffer-controller]: " + e + " SourceBuffer error", t), this.hls.trigger(n
  59386. .Events.ERROR, {
  59387. type: s.ErrorTypes.MEDIA_ERROR,
  59388. details: s.ErrorDetails.BUFFER_APPENDING_ERROR,
  59389. fatal: !1
  59390. });
  59391. var i = this.operationQueue.current(e);
  59392. i && i.onError(t)
  59393. }, t.removeExecutor = function(e, t, i) {
  59394. var n = this.media,
  59395. s = this.mediaSource,
  59396. o = this.operationQueue,
  59397. u = this.sourceBuffer[e];
  59398. if (!n || !s || !u) return a.logger.warn("[buffer-controller]: Attempting to remove from the " +
  59399. e + " SourceBuffer, but it does not exist"), void o.shiftAndExecuteNext(e);
  59400. var l = Object(r.isFiniteNumber)(n.duration) ? n.duration : 1 / 0,
  59401. d = Object(r.isFiniteNumber)(s.duration) ? s.duration : 1 / 0,
  59402. c = Math.max(0, t),
  59403. h = Math.min(i, l, d);
  59404. h > c ? (a.logger.log("[buffer-controller]: Removing [" + c + "," + h + "] from the " + e +
  59405. " SourceBuffer"), console.assert(!u.updating, e + " sourceBuffer must not be updating"), u
  59406. .remove(c, h)) : o.shiftAndExecuteNext(e)
  59407. }, t.appendExecutor = function(e, t) {
  59408. var i = this.operationQueue,
  59409. r = this.sourceBuffer[t];
  59410. if (!r) return a.logger.warn("[buffer-controller]: Attempting to append to the " + t +
  59411. " SourceBuffer, but it does not exist"), void i.shiftAndExecuteNext(t);
  59412. r.ended = !1, console.assert(!r.updating, t + " sourceBuffer must not be updating"), r
  59413. .appendBuffer(e)
  59414. }, t.blockBuffers = function(e, t) {
  59415. var i = this;
  59416. if (void 0 === t && (t = this.getSourceBufferTypes()), !t.length) return a.logger.log(
  59417. "[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),
  59418. void Promise.resolve(e);
  59419. var r = this.operationQueue,
  59420. n = t.map(function(e) {
  59421. return r.appendBlocker(e)
  59422. });
  59423. Promise.all(n).then(function() {
  59424. e(), t.forEach(function(e) {
  59425. var t = i.sourceBuffer[e];
  59426. t && t.updating || r.shiftAndExecuteNext(e)
  59427. })
  59428. })
  59429. }, t.getSourceBufferTypes = function() {
  59430. return Object.keys(this.sourceBuffer)
  59431. }, t.addBufferListener = function(e, t, i) {
  59432. var r = this.sourceBuffer[e];
  59433. if (r) {
  59434. var n = i.bind(this, e);
  59435. this.listeners[e].push({
  59436. event: t,
  59437. listener: n
  59438. }), r.addEventListener(t, n)
  59439. }
  59440. }, t.removeBufferListeners = function(e) {
  59441. var t = this.sourceBuffer[e];
  59442. t && this.listeners[e].forEach(function(e) {
  59443. t.removeEventListener(e.event, e.listener)
  59444. })
  59445. }, e
  59446. }()
  59447. },
  59448. "./src/controller/buffer-operation-queue.ts": function(e, t, i) {
  59449. "use strict";
  59450. i.r(t), i.d(t, "default", function() {
  59451. return n
  59452. });
  59453. var r = i("./src/utils/logger.ts"),
  59454. n = function() {
  59455. function e(e) {
  59456. this.buffers = void 0, this.queues = {
  59457. video: [],
  59458. audio: [],
  59459. audiovideo: []
  59460. }, this.buffers = e
  59461. }
  59462. var t = e.prototype;
  59463. return t.append = function(e, t) {
  59464. var i = this.queues[t];
  59465. i.push(e), 1 === i.length && this.buffers[t] && this.executeNext(t)
  59466. }, t.insertAbort = function(e, t) {
  59467. this.queues[t].unshift(e), this.executeNext(t)
  59468. }, t.appendBlocker = function(e) {
  59469. var t, i = new Promise(function(e) {
  59470. t = e
  59471. }),
  59472. r = {
  59473. execute: t,
  59474. onStart: function() {},
  59475. onComplete: function() {},
  59476. onError: function() {}
  59477. };
  59478. return this.append(r, e), i
  59479. }, t.executeNext = function(e) {
  59480. var t = this.buffers,
  59481. i = this.queues,
  59482. n = t[e],
  59483. a = i[e];
  59484. if (a.length) {
  59485. var s = a[0];
  59486. try {
  59487. s.execute()
  59488. } catch (t) {
  59489. r.logger.warn(
  59490. "[buffer-operation-queue]: Unhandled exception executing the current operation"), s
  59491. .onError(t), n && n.updating || (a.shift(), this.executeNext(e))
  59492. }
  59493. }
  59494. }, t.shiftAndExecuteNext = function(e) {
  59495. this.queues[e].shift(), this.executeNext(e)
  59496. }, t.current = function(e) {
  59497. return this.queues[e][0]
  59498. }, e
  59499. }()
  59500. },
  59501. "./src/controller/cap-level-controller.ts": function(e, t, i) {
  59502. "use strict";
  59503. i.r(t);
  59504. var r = i("./src/events.ts");
  59505. function n(e, t) {
  59506. for (var i = 0; i < t.length; i++) {
  59507. var r = t[i];
  59508. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  59509. .defineProperty(e, r.key, r)
  59510. }
  59511. }
  59512. var a = function() {
  59513. function e(e) {
  59514. this.autoLevelCapping = void 0, this.firstLevel = void 0, this.media = void 0, this
  59515. .restrictedLevels = void 0, this.timer = void 0, this.hls = void 0, this.streamController =
  59516. void 0, this.clientRect = void 0, this.hls = e, this.autoLevelCapping = Number
  59517. .POSITIVE_INFINITY, this.firstLevel = -1, this.media = null, this.restrictedLevels = [], this
  59518. .timer = void 0, this.clientRect = null, this.registerListeners()
  59519. }
  59520. var t, i, a, s = e.prototype;
  59521. return s.setStreamController = function(e) {
  59522. this.streamController = e
  59523. }, s.destroy = function() {
  59524. this.unregisterListener(), this.hls.config.capLevelToPlayerSize && this.stopCapping(), this
  59525. .media = null, this.clientRect = null, this.hls = this.streamController = null
  59526. }, s.registerListeners = function() {
  59527. var e = this.hls;
  59528. e.on(r.Events.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), e.on(r.Events
  59529. .MEDIA_ATTACHING, this.onMediaAttaching, this), e.on(r.Events.MANIFEST_PARSED, this
  59530. .onManifestParsed, this), e.on(r.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.on(r
  59531. .Events.MEDIA_DETACHING, this.onMediaDetaching, this)
  59532. }, s.unregisterListener = function() {
  59533. var e = this.hls;
  59534. e.off(r.Events.FPS_DROP_LEVEL_CAPPING, this.onFpsDropLevelCapping, this), e.off(r.Events
  59535. .MEDIA_ATTACHING, this.onMediaAttaching, this), e.off(r.Events.MANIFEST_PARSED, this
  59536. .onManifestParsed, this), e.off(r.Events.BUFFER_CODECS, this.onBufferCodecs, this), e.off(r
  59537. .Events.MEDIA_DETACHING, this.onMediaDetaching, this)
  59538. }, s.onFpsDropLevelCapping = function(t, i) {
  59539. e.isLevelAllowed(i.droppedLevel, this.restrictedLevels) && this.restrictedLevels.push(i
  59540. .droppedLevel)
  59541. }, s.onMediaAttaching = function(e, t) {
  59542. this.media = t.media instanceof HTMLVideoElement ? t.media : null
  59543. }, s.onManifestParsed = function(e, t) {
  59544. var i = this.hls;
  59545. this.restrictedLevels = [], this.firstLevel = t.firstLevel, i.config.capLevelToPlayerSize && t
  59546. .video && this.startCapping()
  59547. }, s.onBufferCodecs = function(e, t) {
  59548. this.hls.config.capLevelToPlayerSize && t.video && this.startCapping()
  59549. }, s.onMediaDetaching = function() {
  59550. this.stopCapping()
  59551. }, s.detectPlayerSize = function() {
  59552. if (this.media && this.mediaHeight > 0 && this.mediaWidth > 0) {
  59553. var e = this.hls.levels;
  59554. if (e.length) {
  59555. var t = this.hls;
  59556. t.autoLevelCapping = this.getMaxLevel(e.length - 1), t.autoLevelCapping > this
  59557. .autoLevelCapping && this.streamController && this.streamController.nextLevelSwitch(),
  59558. this.autoLevelCapping = t.autoLevelCapping
  59559. }
  59560. }
  59561. }, s.getMaxLevel = function(t) {
  59562. var i = this,
  59563. r = this.hls.levels;
  59564. if (!r.length) return -1;
  59565. var n = r.filter(function(r, n) {
  59566. return e.isLevelAllowed(n, i.restrictedLevels) && n <= t
  59567. });
  59568. return this.clientRect = null, e.getMaxLevelByMediaSize(n, this.mediaWidth, this.mediaHeight)
  59569. }, s.startCapping = function() {
  59570. this.timer || (this.autoLevelCapping = Number.POSITIVE_INFINITY, this.hls.firstLevel = this
  59571. .getMaxLevel(this.firstLevel), self.clearInterval(this.timer), this.timer = self
  59572. .setInterval(this.detectPlayerSize.bind(this), 1e3), this.detectPlayerSize())
  59573. }, s.stopCapping = function() {
  59574. this.restrictedLevels = [], this.firstLevel = -1, this.autoLevelCapping = Number
  59575. .POSITIVE_INFINITY, this.timer && (self.clearInterval(this.timer), this.timer = void 0)
  59576. }, s.getDimensions = function() {
  59577. if (this.clientRect) return this.clientRect;
  59578. var e = this.media,
  59579. t = {
  59580. width: 0,
  59581. height: 0
  59582. };
  59583. if (e) {
  59584. var i = e.getBoundingClientRect();
  59585. t.width = i.width, t.height = i.height, t.width || t.height || (t.width = i.right - i.left ||
  59586. e.width || 0, t.height = i.bottom - i.top || e.height || 0)
  59587. }
  59588. return this.clientRect = t, t
  59589. }, e.isLevelAllowed = function(e, t) {
  59590. return void 0 === t && (t = []), -1 === t.indexOf(e)
  59591. }, e.getMaxLevelByMediaSize = function(e, t, i) {
  59592. if (!e || !e.length) return -1;
  59593. for (var r, n, a = e.length - 1, s = 0; s < e.length; s += 1) {
  59594. var o = e[s];
  59595. if ((o.width >= t || o.height >= i) && (r = o, !(n = e[s + 1]) || r.width !== n.width || r
  59596. .height !== n.height)) {
  59597. a = s;
  59598. break
  59599. }
  59600. }
  59601. return a
  59602. }, t = e, (i = [{
  59603. key: "mediaWidth",
  59604. get: function() {
  59605. return this.getDimensions().width * this.contentScaleFactor
  59606. }
  59607. }, {
  59608. key: "mediaHeight",
  59609. get: function() {
  59610. return this.getDimensions().height * this.contentScaleFactor
  59611. }
  59612. }, {
  59613. key: "contentScaleFactor",
  59614. get: function() {
  59615. var e = 1;
  59616. if (!this.hls.config.ignoreDevicePixelRatio) try {
  59617. e = self.devicePixelRatio
  59618. } catch (e) {}
  59619. return e
  59620. }
  59621. }]) && n(t.prototype, i), a && n(t, a), Object.defineProperty(t, "prototype", {
  59622. writable: !1
  59623. }), e
  59624. }();
  59625. t.default = a
  59626. },
  59627. "./src/controller/cmcd-controller.ts": function(e, t, i) {
  59628. "use strict";
  59629. i.r(t), i.d(t, "default", function() {
  59630. return h
  59631. });
  59632. var r = i("./src/events.ts"),
  59633. n = i("./src/types/cmcd.ts"),
  59634. a = i("./src/utils/buffer-helper.ts"),
  59635. s = i("./src/utils/logger.ts");
  59636. function o(e, t) {
  59637. for (var i = 0; i < t.length; i++) {
  59638. var r = t[i];
  59639. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  59640. .defineProperty(e, r.key, r)
  59641. }
  59642. }
  59643. function u(e, t, i) {
  59644. return t && o(e.prototype, t), i && o(e, i), Object.defineProperty(e, "prototype", {
  59645. writable: !1
  59646. }), e
  59647. }
  59648. function l(e, t) {
  59649. var i = "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
  59650. if (i) return (i = i.call(e)).next.bind(i);
  59651. if (Array.isArray(e) || (i = function(e, t) {
  59652. if (!e) return;
  59653. if ("string" == typeof e) return d(e, t);
  59654. var i = Object.prototype.toString.call(e).slice(8, -1);
  59655. "Object" === i && e.constructor && (i = e.constructor.name);
  59656. if ("Map" === i || "Set" === i) return Array.from(e);
  59657. if ("Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)) return d(e, t)
  59658. }(e)) || t && e && "number" == typeof e.length) {
  59659. i && (e = i);
  59660. var r = 0;
  59661. return function() {
  59662. return r >= e.length ? {
  59663. done: !0
  59664. } : {
  59665. done: !1,
  59666. value: e[r++]
  59667. }
  59668. }
  59669. }
  59670. throw new TypeError(
  59671. "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."
  59672. )
  59673. }
  59674. function d(e, t) {
  59675. (null == t || t > e.length) && (t = e.length);
  59676. for (var i = 0, r = new Array(t); i < t; i++) r[i] = e[i];
  59677. return r
  59678. }
  59679. function c() {
  59680. return (c = Object.assign ? Object.assign.bind() : function(e) {
  59681. for (var t = 1; t < arguments.length; t++) {
  59682. var i = arguments[t];
  59683. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  59684. }
  59685. return e
  59686. }).apply(this, arguments)
  59687. }
  59688. var h = function() {
  59689. function e(t) {
  59690. var i = this;
  59691. this.hls = void 0, this.config = void 0, this.media = void 0, this.sid = void 0, this.cid =
  59692. void 0, this.useHeaders = !1, this.initialized = !1, this.starved = !1, this.buffering = !0,
  59693. this.audioBuffer = void 0, this.videoBuffer = void 0, this.onWaiting = function() {
  59694. i.initialized && (i.starved = !0), i.buffering = !0
  59695. }, this.onPlaying = function() {
  59696. i.initialized || (i.initialized = !0), i.buffering = !1
  59697. }, this.applyPlaylistData = function(e) {
  59698. try {
  59699. i.apply(e, {
  59700. ot: n.CMCDObjectType.MANIFEST,
  59701. su: !i.initialized
  59702. })
  59703. } catch (e) {
  59704. s.logger.warn("Could not generate manifest CMCD data.", e)
  59705. }
  59706. }, this.applyFragmentData = function(e) {
  59707. try {
  59708. var t = e.frag,
  59709. r = i.hls.levels[t.level],
  59710. a = i.getObjectType(t),
  59711. o = {
  59712. d: 1e3 * t.duration,
  59713. ot: a
  59714. };
  59715. a !== n.CMCDObjectType.VIDEO && a !== n.CMCDObjectType.AUDIO && a != n.CMCDObjectType
  59716. .MUXED || (o.br = r.bitrate / 1e3, o.tb = i.getTopBandwidth(a) / 1e3, o.bl = i
  59717. .getBufferLength(a)), i.apply(e, o)
  59718. } catch (e) {
  59719. s.logger.warn("Could not generate segment CMCD data.", e)
  59720. }
  59721. }, this.hls = t;
  59722. var r = this.config = t.config,
  59723. a = r.cmcd;
  59724. null != a && (r.pLoader = this.createPlaylistLoader(), r.fLoader = this.createFragmentLoader(),
  59725. this.sid = a.sessionId || e.uuid(), this.cid = a.contentId, this.useHeaders = !0 === a
  59726. .useHeaders, this.registerListeners())
  59727. }
  59728. var t = e.prototype;
  59729. return t.registerListeners = function() {
  59730. var e = this.hls;
  59731. e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHED, this
  59732. .onMediaDetached, this), e.on(r.Events.BUFFER_CREATED, this.onBufferCreated, this)
  59733. }, t.unregisterListeners = function() {
  59734. var e = this.hls;
  59735. e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHED, this
  59736. .onMediaDetached, this), e.off(r.Events.BUFFER_CREATED, this.onBufferCreated, this), this
  59737. .onMediaDetached()
  59738. }, t.destroy = function() {
  59739. this.unregisterListeners(), this.hls = this.config = this.audioBuffer = this.videoBuffer = null
  59740. }, t.onMediaAttached = function(e, t) {
  59741. this.media = t.media, this.media.addEventListener("waiting", this.onWaiting), this.media
  59742. .addEventListener("playing", this.onPlaying)
  59743. }, t.onMediaDetached = function() {
  59744. this.media && (this.media.removeEventListener("waiting", this.onWaiting), this.media
  59745. .removeEventListener("playing", this.onPlaying), this.media = null)
  59746. }, t.onBufferCreated = function(e, t) {
  59747. var i, r;
  59748. this.audioBuffer = null === (i = t.tracks.audio) || void 0 === i ? void 0 : i.buffer, this
  59749. .videoBuffer = null === (r = t.tracks.video) || void 0 === r ? void 0 : r.buffer
  59750. }, t.createData = function() {
  59751. var e;
  59752. return {
  59753. v: n.CMCDVersion,
  59754. sf: n.CMCDStreamingFormat.HLS,
  59755. sid: this.sid,
  59756. cid: this.cid,
  59757. pr: null === (e = this.media) || void 0 === e ? void 0 : e.playbackRate,
  59758. mtp: this.hls.bandwidthEstimate / 1e3
  59759. }
  59760. }, t.apply = function(t, i) {
  59761. void 0 === i && (i = {}), c(i, this.createData());
  59762. var r = i.ot === n.CMCDObjectType.INIT || i.ot === n.CMCDObjectType.VIDEO || i.ot === n
  59763. .CMCDObjectType.MUXED;
  59764. if (this.starved && r && (i.bs = !0, i.su = !0, this.starved = !1), null == i.su && (i.su = this
  59765. .buffering), this.useHeaders) {
  59766. var a = e.toHeaders(i);
  59767. if (!Object.keys(a).length) return;
  59768. t.headers || (t.headers = {}), c(t.headers, a)
  59769. } else {
  59770. var s = e.toQuery(i);
  59771. if (!s) return;
  59772. t.url = e.appendQueryToUri(t.url, s)
  59773. }
  59774. }, t.getObjectType = function(e) {
  59775. var t = e.type;
  59776. return "subtitle" === t ? n.CMCDObjectType.TIMED_TEXT : "initSegment" === e.sn ? n
  59777. .CMCDObjectType.INIT : "audio" === t ? n.CMCDObjectType.AUDIO : "main" === t ? this.hls
  59778. .audioTracks.length ? n.CMCDObjectType.VIDEO : n.CMCDObjectType.MUXED : void 0
  59779. }, t.getTopBandwidth = function(e) {
  59780. var t, i = 0,
  59781. r = this.hls;
  59782. if (e === n.CMCDObjectType.AUDIO) t = r.audioTracks;
  59783. else {
  59784. var a = r.maxAutoLevel,
  59785. s = a > -1 ? a + 1 : r.levels.length;
  59786. t = r.levels.slice(0, s)
  59787. }
  59788. for (var o, u = l(t); !(o = u()).done;) {
  59789. var d = o.value;
  59790. d.bitrate > i && (i = d.bitrate)
  59791. }
  59792. return i > 0 ? i : NaN
  59793. }, t.getBufferLength = function(e) {
  59794. var t = this.hls.media,
  59795. i = e === n.CMCDObjectType.AUDIO ? this.audioBuffer : this.videoBuffer;
  59796. return i && t ? 1e3 * a.BufferHelper.bufferInfo(i, t.currentTime, this.config.maxBufferHole)
  59797. .len : NaN
  59798. }, t.createPlaylistLoader = function() {
  59799. var e = this.config.pLoader,
  59800. t = this.applyPlaylistData,
  59801. i = e || this.config.loader;
  59802. return function() {
  59803. function e(e) {
  59804. this.loader = void 0, this.loader = new i(e)
  59805. }
  59806. var r = e.prototype;
  59807. return r.destroy = function() {
  59808. this.loader.destroy()
  59809. }, r.abort = function() {
  59810. this.loader.abort()
  59811. }, r.load = function(e, i, r) {
  59812. t(e), this.loader.load(e, i, r)
  59813. }, u(e, [{
  59814. key: "stats",
  59815. get: function() {
  59816. return this.loader.stats
  59817. }
  59818. }, {
  59819. key: "context",
  59820. get: function() {
  59821. return this.loader.context
  59822. }
  59823. }]), e
  59824. }()
  59825. }, t.createFragmentLoader = function() {
  59826. var e = this.config.fLoader,
  59827. t = this.applyFragmentData,
  59828. i = e || this.config.loader;
  59829. return function() {
  59830. function e(e) {
  59831. this.loader = void 0, this.loader = new i(e)
  59832. }
  59833. var r = e.prototype;
  59834. return r.destroy = function() {
  59835. this.loader.destroy()
  59836. }, r.abort = function() {
  59837. this.loader.abort()
  59838. }, r.load = function(e, i, r) {
  59839. t(e), this.loader.load(e, i, r)
  59840. }, u(e, [{
  59841. key: "stats",
  59842. get: function() {
  59843. return this.loader.stats
  59844. }
  59845. }, {
  59846. key: "context",
  59847. get: function() {
  59848. return this.loader.context
  59849. }
  59850. }]), e
  59851. }()
  59852. }, e.uuid = function() {
  59853. var e = URL.createObjectURL(new Blob),
  59854. t = e.toString();
  59855. return URL.revokeObjectURL(e), t.slice(t.lastIndexOf("/") + 1)
  59856. }, e.serialize = function(e) {
  59857. for (var t, i = [], r = function(e) {
  59858. return !Number.isNaN(e) && null != e && "" !== e && !1 !== e
  59859. }, n = function(e) {
  59860. return Math.round(e)
  59861. }, a = function(e) {
  59862. return 100 * n(e / 100)
  59863. }, s = {
  59864. br: n,
  59865. d: n,
  59866. bl: a,
  59867. dl: a,
  59868. mtp: a,
  59869. nor: function(e) {
  59870. return encodeURIComponent(e)
  59871. },
  59872. rtp: a,
  59873. tb: n
  59874. }, o = l(Object.keys(e || {}).sort()); !(t = o()).done;) {
  59875. var u = t.value,
  59876. d = e[u];
  59877. if (r(d) && !("v" === u && 1 === d || "pr" == u && 1 === d)) {
  59878. var c = s[u];
  59879. c && (d = c(d));
  59880. var h = typeof d,
  59881. f = void 0;
  59882. f = "ot" === u || "sf" === u || "st" === u ? u + "=" + d : "boolean" === h ? u :
  59883. "number" === h ? u + "=" + d : u + "=" + JSON.stringify(d), i.push(f)
  59884. }
  59885. }
  59886. return i.join(",")
  59887. }, e.toHeaders = function(t) {
  59888. for (var i = {}, r = ["Object", "Request", "Session", "Status"], n = [{}, {}, {}, {}], a = {
  59889. br: 0,
  59890. d: 0,
  59891. ot: 0,
  59892. tb: 0,
  59893. bl: 1,
  59894. dl: 1,
  59895. mtp: 1,
  59896. nor: 1,
  59897. nrr: 1,
  59898. su: 1,
  59899. cid: 2,
  59900. pr: 2,
  59901. sf: 2,
  59902. sid: 2,
  59903. st: 2,
  59904. v: 2,
  59905. bs: 3,
  59906. rtp: 3
  59907. }, s = 0, o = Object.keys(t); s < o.length; s++) {
  59908. var u = o[s];
  59909. n[null != a[u] ? a[u] : 1][u] = t[u]
  59910. }
  59911. for (var l = 0; l < n.length; l++) {
  59912. var d = e.serialize(n[l]);
  59913. d && (i["CMCD-" + r[l]] = d)
  59914. }
  59915. return i
  59916. }, e.toQuery = function(t) {
  59917. return "CMCD=" + encodeURIComponent(e.serialize(t))
  59918. }, e.appendQueryToUri = function(e, t) {
  59919. return t ? "" + e + (e.includes("?") ? "&" : "?") + t : e
  59920. }, e
  59921. }()
  59922. },
  59923. "./src/controller/eme-controller.ts": function(e, t, i) {
  59924. "use strict";
  59925. i.r(t);
  59926. var r = i("./src/events.ts"),
  59927. n = i("./src/errors.ts"),
  59928. a = i("./src/utils/logger.ts"),
  59929. s = i("./src/utils/mediakeys-helper.ts");
  59930. function o(e, t) {
  59931. for (var i = 0; i < t.length; i++) {
  59932. var r = t[i];
  59933. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  59934. .defineProperty(e, r.key, r)
  59935. }
  59936. }
  59937. var u = function() {
  59938. function e(e) {
  59939. this.hls = void 0, this._widevineLicenseUrl = void 0, this._licenseXhrSetup = void 0, this
  59940. ._licenseResponseCallback = void 0, this._emeEnabled = void 0, this
  59941. ._requestMediaKeySystemAccess = void 0, this._drmSystemOptions = void 0, this._config = void 0,
  59942. this._mediaKeysList = [], this._media = null, this._hasSetMediaKeys = !1, this
  59943. ._requestLicenseFailureCount = 0, this.mediaKeysPromise = null, this._onMediaEncrypted = this
  59944. .onMediaEncrypted.bind(this), this.hls = e, this._config = e.config, this._widevineLicenseUrl =
  59945. this._config.widevineLicenseUrl, this._licenseXhrSetup = this._config.licenseXhrSetup, this
  59946. ._licenseResponseCallback = this._config.licenseResponseCallback, this._emeEnabled = this
  59947. ._config.emeEnabled, this._requestMediaKeySystemAccess = this._config
  59948. .requestMediaKeySystemAccessFunc, this._drmSystemOptions = this._config.drmSystemOptions, this
  59949. ._registerListeners()
  59950. }
  59951. var t, i, u, l = e.prototype;
  59952. return l.destroy = function() {
  59953. this._unregisterListeners(), this.hls = this._onMediaEncrypted = null, this
  59954. ._requestMediaKeySystemAccess = null
  59955. }, l._registerListeners = function() {
  59956. this.hls.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(r.Events
  59957. .MEDIA_DETACHED, this.onMediaDetached, this), this.hls.on(r.Events.MANIFEST_PARSED, this
  59958. .onManifestParsed, this)
  59959. }, l._unregisterListeners = function() {
  59960. this.hls.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.off(r.Events
  59961. .MEDIA_DETACHED, this.onMediaDetached, this), this.hls.off(r.Events.MANIFEST_PARSED, this
  59962. .onManifestParsed, this)
  59963. }, l.getLicenseServerUrl = function(e) {
  59964. switch (e) {
  59965. case s.KeySystems.WIDEVINE:
  59966. if (!this._widevineLicenseUrl) break;
  59967. return this._widevineLicenseUrl
  59968. }
  59969. throw new Error('no license server URL configured for key-system "' + e + '"')
  59970. }, l._attemptKeySystemAccess = function(e, t, i) {
  59971. var r = this,
  59972. n = function(e, t, i, r) {
  59973. switch (e) {
  59974. case s.KeySystems.WIDEVINE:
  59975. return function(e, t, i) {
  59976. var r = {
  59977. audioCapabilities: [],
  59978. videoCapabilities: []
  59979. };
  59980. return e.forEach(function(e) {
  59981. r.audioCapabilities.push({
  59982. contentType: 'audio/mp4; codecs="' + e + '"',
  59983. robustness: i.audioRobustness || ""
  59984. })
  59985. }), t.forEach(function(e) {
  59986. r.videoCapabilities.push({
  59987. contentType: 'video/mp4; codecs="' + e + '"',
  59988. robustness: i.videoRobustness || ""
  59989. })
  59990. }), [r]
  59991. }(t, i, r);
  59992. default:
  59993. throw new Error("Unknown key-system: " + e)
  59994. }
  59995. }(e, t, i, this._drmSystemOptions);
  59996. a.logger.log("Requesting encrypted media key-system access");
  59997. var o = this.requestMediaKeySystemAccess(e, n);
  59998. this.mediaKeysPromise = o.then(function(t) {
  59999. return r._onMediaKeySystemAccessObtained(e, t)
  60000. }), o.catch(function(t) {
  60001. a.logger.error('Failed to obtain key-system "' + e + '" access:', t)
  60002. })
  60003. }, l._onMediaKeySystemAccessObtained = function(e, t) {
  60004. var i = this;
  60005. a.logger.log('Access for key-system "' + e + '" obtained');
  60006. var r = {
  60007. mediaKeysSessionInitialized: !1,
  60008. mediaKeySystemAccess: t,
  60009. mediaKeySystemDomain: e
  60010. };
  60011. this._mediaKeysList.push(r);
  60012. var n = Promise.resolve().then(function() {
  60013. return t.createMediaKeys()
  60014. }).then(function(t) {
  60015. return r.mediaKeys = t, a.logger.log('Media-keys created for key-system "' + e + '"'), i
  60016. ._onMediaKeysCreated(), t
  60017. });
  60018. return n.catch(function(e) {
  60019. a.logger.error("Failed to create media-keys:", e)
  60020. }), n
  60021. }, l._onMediaKeysCreated = function() {
  60022. var e = this;
  60023. this._mediaKeysList.forEach(function(t) {
  60024. t.mediaKeysSession || (t.mediaKeysSession = t.mediaKeys.createSession(), e
  60025. ._onNewMediaKeySession(t.mediaKeysSession))
  60026. })
  60027. }, l._onNewMediaKeySession = function(e) {
  60028. var t = this;
  60029. a.logger.log("New key-system session " + e.sessionId), e.addEventListener("message", function(
  60030. i) {
  60031. t._onKeySessionMessage(e, i.message)
  60032. }, !1)
  60033. }, l._onKeySessionMessage = function(e, t) {
  60034. a.logger.log("Got EME message event, creating license request"), this._requestLicense(t,
  60035. function(t) {
  60036. a.logger.log("Received license data (length: " + (t ? t.byteLength : t) +
  60037. "), updating key-session"), e.update(t).catch(function(e) {
  60038. a.logger.warn("Updating key-session failed: " + e)
  60039. })
  60040. })
  60041. }, l.onMediaEncrypted = function(e) {
  60042. var t = this;
  60043. if (a.logger.log('Media is encrypted using "' + e.initDataType + '" init data type'), !this
  60044. .mediaKeysPromise) return a.logger.error(
  60045. "Fatal: Media is encrypted but no CDM access or no keys have been requested"), void this
  60046. .hls.trigger(r.Events.ERROR, {
  60047. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60048. details: n.ErrorDetails.KEY_SYSTEM_NO_KEYS,
  60049. fatal: !0
  60050. });
  60051. var i = function(i) {
  60052. t._media && (t._attemptSetMediaKeys(i), t._generateRequestWithPreferredKeySession(e
  60053. .initDataType, e.initData))
  60054. };
  60055. this.mediaKeysPromise.then(i).catch(i)
  60056. }, l._attemptSetMediaKeys = function(e) {
  60057. if (!this._media) throw new Error(
  60058. "Attempted to set mediaKeys without first attaching a media element");
  60059. if (!this._hasSetMediaKeys) {
  60060. var t = this._mediaKeysList[0];
  60061. if (!t || !t.mediaKeys) return a.logger.error(
  60062. "Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),
  60063. void this.hls.trigger(r.Events.ERROR, {
  60064. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60065. details: n.ErrorDetails.KEY_SYSTEM_NO_KEYS,
  60066. fatal: !0
  60067. });
  60068. a.logger.log("Setting keys for encrypted media"), this._media.setMediaKeys(t.mediaKeys), this
  60069. ._hasSetMediaKeys = !0
  60070. }
  60071. }, l._generateRequestWithPreferredKeySession = function(e, t) {
  60072. var i = this,
  60073. s = this._mediaKeysList[0];
  60074. if (!s) return a.logger.error(
  60075. "Fatal: Media is encrypted but not any key-system access has been obtained yet"),
  60076. void this.hls.trigger(r.Events.ERROR, {
  60077. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60078. details: n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,
  60079. fatal: !0
  60080. });
  60081. if (s.mediaKeysSessionInitialized) a.logger.warn(
  60082. "Key-Session already initialized but requested again");
  60083. else {
  60084. var o = s.mediaKeysSession;
  60085. if (!o) return a.logger.error("Fatal: Media is encrypted but no key-session existing"),
  60086. void this.hls.trigger(r.Events.ERROR, {
  60087. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60088. details: n.ErrorDetails.KEY_SYSTEM_NO_SESSION,
  60089. fatal: !0
  60090. });
  60091. if (!t) return a.logger.warn("Fatal: initData required for generating a key session is null"),
  60092. void this.hls.trigger(r.Events.ERROR, {
  60093. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60094. details: n.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,
  60095. fatal: !0
  60096. });
  60097. a.logger.log('Generating key-session request for "' + e + '" init data type'), s
  60098. .mediaKeysSessionInitialized = !0, o.generateRequest(e, t).then(function() {
  60099. a.logger.debug("Key-session generation succeeded")
  60100. }).catch(function(e) {
  60101. a.logger.error("Error generating key-session request:", e), i.hls.trigger(r.Events
  60102. .ERROR, {
  60103. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60104. details: n.ErrorDetails.KEY_SYSTEM_NO_SESSION,
  60105. fatal: !1
  60106. })
  60107. })
  60108. }
  60109. }, l._createLicenseXhr = function(e, t, i) {
  60110. var r = new XMLHttpRequest;
  60111. r.responseType = "arraybuffer", r.onreadystatechange = this._onLicenseRequestReadyStageChange
  60112. .bind(this, r, e, t, i);
  60113. var n = this._licenseXhrSetup;
  60114. if (n) try {
  60115. n.call(this.hls, r, e), n = void 0
  60116. } catch (e) {
  60117. a.logger.error(e)
  60118. }
  60119. try {
  60120. r.readyState || r.open("POST", e, !0), n && n.call(this.hls, r, e)
  60121. } catch (e) {
  60122. throw new Error("issue setting up KeySystem license XHR " + e)
  60123. }
  60124. return r
  60125. }, l._onLicenseRequestReadyStageChange = function(e, t, i, s) {
  60126. switch (e.readyState) {
  60127. case 4:
  60128. if (200 === e.status) {
  60129. this._requestLicenseFailureCount = 0, a.logger.log("License request succeeded");
  60130. var o = e.response,
  60131. u = this._licenseResponseCallback;
  60132. if (u) try {
  60133. o = u.call(this.hls, e, t)
  60134. } catch (e) {
  60135. a.logger.error(e)
  60136. }
  60137. s(o)
  60138. } else {
  60139. if (a.logger.error("License Request XHR failed (" + t + "). Status: " + e.status + " (" +
  60140. e.statusText + ")"), this._requestLicenseFailureCount++, this
  60141. ._requestLicenseFailureCount > 3) return void this.hls.trigger(r.Events.ERROR, {
  60142. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60143. details: n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,
  60144. fatal: !0
  60145. });
  60146. var l = 3 - this._requestLicenseFailureCount + 1;
  60147. a.logger.warn("Retrying license request, " + l + " attempts left"), this._requestLicense(
  60148. i, s)
  60149. }
  60150. }
  60151. }, l._generateLicenseRequestChallenge = function(e, t) {
  60152. switch (e.mediaKeySystemDomain) {
  60153. case s.KeySystems.WIDEVINE:
  60154. return t
  60155. }
  60156. throw new Error("unsupported key-system: " + e.mediaKeySystemDomain)
  60157. }, l._requestLicense = function(e, t) {
  60158. a.logger.log("Requesting content license for key-system");
  60159. var i = this._mediaKeysList[0];
  60160. if (!i) return a.logger.error(
  60161. "Fatal error: Media is encrypted but no key-system access has been obtained yet"),
  60162. void this.hls.trigger(r.Events.ERROR, {
  60163. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60164. details: n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,
  60165. fatal: !0
  60166. });
  60167. try {
  60168. var s = this.getLicenseServerUrl(i.mediaKeySystemDomain),
  60169. o = this._createLicenseXhr(s, e, t);
  60170. a.logger.log("Sending license request to URL: " + s);
  60171. var u = this._generateLicenseRequestChallenge(i, e);
  60172. o.send(u)
  60173. } catch (e) {
  60174. a.logger.error("Failure requesting DRM license: " + e), this.hls.trigger(r.Events.ERROR, {
  60175. type: n.ErrorTypes.KEY_SYSTEM_ERROR,
  60176. details: n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,
  60177. fatal: !0
  60178. })
  60179. }
  60180. }, l.onMediaAttached = function(e, t) {
  60181. if (this._emeEnabled) {
  60182. var i = t.media;
  60183. this._media = i, i.addEventListener("encrypted", this._onMediaEncrypted)
  60184. }
  60185. }, l.onMediaDetached = function() {
  60186. var e = this._media,
  60187. t = this._mediaKeysList;
  60188. e && (e.removeEventListener("encrypted", this._onMediaEncrypted), this._media = null, this
  60189. ._mediaKeysList = [], Promise.all(t.map(function(e) {
  60190. if (e.mediaKeysSession) return e.mediaKeysSession.close().catch(function() {})
  60191. })).then(function() {
  60192. return e.setMediaKeys(null)
  60193. }).catch(function() {}))
  60194. }, l.onManifestParsed = function(e, t) {
  60195. if (this._emeEnabled) {
  60196. var i = t.levels.map(function(e) {
  60197. return e.audioCodec
  60198. }).filter(function(e) {
  60199. return !!e
  60200. }),
  60201. r = t.levels.map(function(e) {
  60202. return e.videoCodec
  60203. }).filter(function(e) {
  60204. return !!e
  60205. });
  60206. this._attemptKeySystemAccess(s.KeySystems.WIDEVINE, i, r)
  60207. }
  60208. }, t = e, (i = [{
  60209. key: "requestMediaKeySystemAccess",
  60210. get: function() {
  60211. if (!this._requestMediaKeySystemAccess) throw new Error(
  60212. "No requestMediaKeySystemAccess function configured");
  60213. return this._requestMediaKeySystemAccess
  60214. }
  60215. }]) && o(t.prototype, i), u && o(t, u), Object.defineProperty(t, "prototype", {
  60216. writable: !1
  60217. }), e
  60218. }();
  60219. t.default = u
  60220. },
  60221. "./src/controller/fps-controller.ts": function(e, t, i) {
  60222. "use strict";
  60223. i.r(t);
  60224. var r = i("./src/events.ts"),
  60225. n = i("./src/utils/logger.ts"),
  60226. a = function() {
  60227. function e(e) {
  60228. this.hls = void 0, this.isVideoPlaybackQualityAvailable = !1, this.timer = void 0, this.media =
  60229. null, this.lastTime = void 0, this.lastDroppedFrames = 0, this.lastDecodedFrames = 0, this
  60230. .streamController = void 0, this.hls = e, this.registerListeners()
  60231. }
  60232. var t = e.prototype;
  60233. return t.setStreamController = function(e) {
  60234. this.streamController = e
  60235. }, t.registerListeners = function() {
  60236. this.hls.on(r.Events.MEDIA_ATTACHING, this.onMediaAttaching, this)
  60237. }, t.unregisterListeners = function() {
  60238. this.hls.off(r.Events.MEDIA_ATTACHING, this.onMediaAttaching)
  60239. }, t.destroy = function() {
  60240. this.timer && clearInterval(this.timer), this.unregisterListeners(), this
  60241. .isVideoPlaybackQualityAvailable = !1, this.media = null
  60242. }, t.onMediaAttaching = function(e, t) {
  60243. var i = this.hls.config;
  60244. if (i.capLevelOnFPSDrop) {
  60245. var r = t.media instanceof self.HTMLVideoElement ? t.media : null;
  60246. this.media = r, r && "function" == typeof r.getVideoPlaybackQuality && (this
  60247. .isVideoPlaybackQualityAvailable = !0), self.clearInterval(this.timer), this.timer = self
  60248. .setInterval(this.checkFPSInterval.bind(this), i.fpsDroppedMonitoringPeriod)
  60249. }
  60250. }, t.checkFPS = function(e, t, i) {
  60251. var a = performance.now();
  60252. if (t) {
  60253. if (this.lastTime) {
  60254. var s = a - this.lastTime,
  60255. o = i - this.lastDroppedFrames,
  60256. u = t - this.lastDecodedFrames,
  60257. l = 1e3 * o / s,
  60258. d = this.hls;
  60259. if (d.trigger(r.Events.FPS_DROP, {
  60260. currentDropped: o,
  60261. currentDecoded: u,
  60262. totalDroppedFrames: i
  60263. }), l > 0 && o > d.config.fpsDroppedMonitoringThreshold * u) {
  60264. var c = d.currentLevel;
  60265. n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: " + c), c >
  60266. 0 && (-1 === d.autoLevelCapping || d.autoLevelCapping >= c) && (c -= 1, d.trigger(r
  60267. .Events.FPS_DROP_LEVEL_CAPPING, {
  60268. level: c,
  60269. droppedLevel: d.currentLevel
  60270. }), d.autoLevelCapping = c, this.streamController.nextLevelSwitch())
  60271. }
  60272. }
  60273. this.lastTime = a, this.lastDroppedFrames = i, this.lastDecodedFrames = t
  60274. }
  60275. }, t.checkFPSInterval = function() {
  60276. var e = this.media;
  60277. if (e)
  60278. if (this.isVideoPlaybackQualityAvailable) {
  60279. var t = e.getVideoPlaybackQuality();
  60280. this.checkFPS(e, t.totalVideoFrames, t.droppedVideoFrames)
  60281. } else this.checkFPS(e, e.webkitDecodedFrameCount, e.webkitDroppedFrameCount)
  60282. }, e
  60283. }();
  60284. t.default = a
  60285. },
  60286. "./src/controller/fragment-finders.ts": function(e, t, i) {
  60287. "use strict";
  60288. i.r(t), i.d(t, "findFragmentByPDT", function() {
  60289. return a
  60290. }), i.d(t, "findFragmentByPTS", function() {
  60291. return s
  60292. }), i.d(t, "fragmentWithinToleranceTest", function() {
  60293. return o
  60294. }), i.d(t, "pdtWithinToleranceTest", function() {
  60295. return u
  60296. }), i.d(t, "findFragWithCC", function() {
  60297. return l
  60298. });
  60299. var r = i("./src/polyfills/number.ts"),
  60300. n = i("./src/utils/binary-search.ts");
  60301. function a(e, t, i) {
  60302. if (null === t || !Array.isArray(e) || !e.length || !Object(r.isFiniteNumber)(t)) return null;
  60303. if (t < (e[0].programDateTime || 0)) return null;
  60304. if (t >= (e[e.length - 1].endProgramDateTime || 0)) return null;
  60305. i = i || 0;
  60306. for (var n = 0; n < e.length; ++n) {
  60307. var a = e[n];
  60308. if (u(t, i, a)) return a
  60309. }
  60310. return null
  60311. }
  60312. function s(e, t, i, r) {
  60313. void 0 === i && (i = 0), void 0 === r && (r = 0);
  60314. var a = null;
  60315. if (e ? a = t[e.sn - t[0].sn + 1] || null : 0 === i && 0 === t[0].start && (a = t[0]), a && 0 === o(i,
  60316. r, a)) return a;
  60317. var s = n.default.search(t, o.bind(null, i, r));
  60318. return s || a
  60319. }
  60320. function o(e, t, i) {
  60321. void 0 === e && (e = 0), void 0 === t && (t = 0);
  60322. var r = Math.min(t, i.duration + (i.deltaPTS ? i.deltaPTS : 0));
  60323. return i.start + i.duration - r <= e ? 1 : i.start - r > e && i.start ? -1 : 0
  60324. }
  60325. function u(e, t, i) {
  60326. var r = 1e3 * Math.min(t, i.duration + (i.deltaPTS ? i.deltaPTS : 0));
  60327. return (i.endProgramDateTime || 0) - r > e
  60328. }
  60329. function l(e, t) {
  60330. return n.default.search(e, function(e) {
  60331. return e.cc < t ? 1 : e.cc > t ? -1 : 0
  60332. })
  60333. }
  60334. },
  60335. "./src/controller/fragment-tracker.ts": function(e, t, i) {
  60336. "use strict";
  60337. i.r(t), i.d(t, "FragmentState", function() {
  60338. return r
  60339. }), i.d(t, "FragmentTracker", function() {
  60340. return s
  60341. });
  60342. var r, n = i("./src/events.ts"),
  60343. a = i("./src/types/loader.ts");
  60344. ! function(e) {
  60345. e.NOT_LOADED = "NOT_LOADED", e.BACKTRACKED = "BACKTRACKED", e.APPENDING = "APPENDING", e.PARTIAL =
  60346. "PARTIAL", e.OK = "OK"
  60347. }(r || (r = {}));
  60348. var s = function() {
  60349. function e(e) {
  60350. this.activeFragment = null, this.activeParts = null, this.fragments = Object.create(null), this
  60351. .timeRanges = Object.create(null), this.bufferPadding = .2, this.hls = void 0, this.hls = e,
  60352. this._registerListeners()
  60353. }
  60354. var t = e.prototype;
  60355. return t._registerListeners = function() {
  60356. var e = this.hls;
  60357. e.on(n.Events.BUFFER_APPENDED, this.onBufferAppended, this), e.on(n.Events.FRAG_BUFFERED, this
  60358. .onFragBuffered, this), e.on(n.Events.FRAG_LOADED, this.onFragLoaded, this)
  60359. }, t._unregisterListeners = function() {
  60360. var e = this.hls;
  60361. e.off(n.Events.BUFFER_APPENDED, this.onBufferAppended, this), e.off(n.Events.FRAG_BUFFERED, this
  60362. .onFragBuffered, this), e.off(n.Events.FRAG_LOADED, this.onFragLoaded, this)
  60363. }, t.destroy = function() {
  60364. this._unregisterListeners(), this.fragments = this.timeRanges = null
  60365. }, t.getAppendedFrag = function(e, t) {
  60366. if (t === a.PlaylistLevelType.MAIN) {
  60367. var i = this.activeFragment,
  60368. r = this.activeParts;
  60369. if (!i) return null;
  60370. if (r)
  60371. for (var n = r.length; n--;) {
  60372. var s = r[n],
  60373. o = s ? s.end : i.appendedPTS;
  60374. if (s.start <= e && void 0 !== o && e <= o) return n > 9 && (this.activeParts = r.slice(
  60375. n - 9)), s
  60376. } else if (i.start <= e && void 0 !== i.appendedPTS && e <= i.appendedPTS) return i
  60377. }
  60378. return this.getBufferedFrag(e, t)
  60379. }, t.getBufferedFrag = function(e, t) {
  60380. for (var i = this.fragments, r = Object.keys(i), n = r.length; n--;) {
  60381. var a = i[r[n]];
  60382. if ((null === a || void 0 === a ? void 0 : a.body.type) === t && a.buffered) {
  60383. var s = a.body;
  60384. if (s.start <= e && e <= s.end) return s
  60385. }
  60386. }
  60387. return null
  60388. }, t.detectEvictedFragments = function(e, t, i) {
  60389. var r = this;
  60390. Object.keys(this.fragments).forEach(function(n) {
  60391. var a = r.fragments[n];
  60392. if (a)
  60393. if (a.buffered) {
  60394. var s = a.range[e];
  60395. s && s.time.some(function(e) {
  60396. var i = !r.isTimeBuffered(e.startPTS, e.endPTS, t);
  60397. return i && r.removeFragment(a.body), i
  60398. })
  60399. } else a.body.type === i && r.removeFragment(a.body)
  60400. })
  60401. }, t.detectPartialFragments = function(e) {
  60402. var t = this,
  60403. i = this.timeRanges,
  60404. r = e.frag,
  60405. n = e.part;
  60406. if (i && "initSegment" !== r.sn) {
  60407. var a = u(r),
  60408. s = this.fragments[a];
  60409. s && (Object.keys(i).forEach(function(e) {
  60410. var a = r.elementaryStreams[e];
  60411. if (a) {
  60412. var o = i[e],
  60413. u = null !== n || !0 === a.partial;
  60414. s.range[e] = t.getBufferedTimes(r, n, u, o)
  60415. }
  60416. }), s.backtrack = s.loaded = null, Object.keys(s.range).length ? s.buffered = !0 : this
  60417. .removeFragment(s.body))
  60418. }
  60419. }, t.fragBuffered = function(e) {
  60420. var t = u(e),
  60421. i = this.fragments[t];
  60422. i && (i.backtrack = i.loaded = null, i.buffered = !0)
  60423. }, t.getBufferedTimes = function(e, t, i, r) {
  60424. for (var n = {
  60425. time: [],
  60426. partial: i
  60427. }, a = t ? t.start : e.start, s = t ? t.end : e.end, o = e.minEndPTS || s, u = e
  60428. .maxStartPTS || a, l = 0; l < r.length; l++) {
  60429. var d = r.start(l) - this.bufferPadding,
  60430. c = r.end(l) + this.bufferPadding;
  60431. if (u >= d && o <= c) {
  60432. n.time.push({
  60433. startPTS: Math.max(a, r.start(l)),
  60434. endPTS: Math.min(s, r.end(l))
  60435. });
  60436. break
  60437. }
  60438. if (a < c && s > d) n.partial = !0, n.time.push({
  60439. startPTS: Math.max(a, r.start(l)),
  60440. endPTS: Math.min(s, r.end(l))
  60441. });
  60442. else if (s <= d) break
  60443. }
  60444. return n
  60445. }, t.getPartialFragment = function(e) {
  60446. var t, i, r, n = null,
  60447. a = 0,
  60448. s = this.bufferPadding,
  60449. u = this.fragments;
  60450. return Object.keys(u).forEach(function(l) {
  60451. var d = u[l];
  60452. d && o(d) && (i = d.body.start - s, r = d.body.end + s, e >= i && e <= r && (t = Math.min(
  60453. e - i, r - e), a <= t && (n = d.body, a = t)))
  60454. }), n
  60455. }, t.getState = function(e) {
  60456. var t = u(e),
  60457. i = this.fragments[t];
  60458. return i ? i.buffered ? o(i) ? r.PARTIAL : r.OK : i.backtrack ? r.BACKTRACKED : r.APPENDING : r
  60459. .NOT_LOADED
  60460. }, t.backtrack = function(e, t) {
  60461. var i = u(e),
  60462. r = this.fragments[i];
  60463. if (!r || r.backtrack) return null;
  60464. var n = r.backtrack = t || r.loaded;
  60465. return r.loaded = null, n
  60466. }, t.getBacktrackData = function(e) {
  60467. var t = u(e),
  60468. i = this.fragments[t];
  60469. if (i) {
  60470. var r, n = i.backtrack;
  60471. if (null !== n && void 0 !== n && null !== (r = n.payload) && void 0 !== r && r.byteLength)
  60472. return n;
  60473. this.removeFragment(e)
  60474. }
  60475. return null
  60476. }, t.isTimeBuffered = function(e, t, i) {
  60477. for (var r, n, a = 0; a < i.length; a++) {
  60478. if (r = i.start(a) - this.bufferPadding, n = i.end(a) + this.bufferPadding, e >= r && t <= n)
  60479. return !0;
  60480. if (t <= r) return !1
  60481. }
  60482. return !1
  60483. }, t.onFragLoaded = function(e, t) {
  60484. var i = t.frag,
  60485. r = t.part;
  60486. if ("initSegment" !== i.sn && !i.bitrateTest && !r) {
  60487. var n = u(i);
  60488. this.fragments[n] = {
  60489. body: i,
  60490. loaded: t,
  60491. backtrack: null,
  60492. buffered: !1,
  60493. range: Object.create(null)
  60494. }
  60495. }
  60496. }, t.onBufferAppended = function(e, t) {
  60497. var i = this,
  60498. r = t.frag,
  60499. n = t.part,
  60500. s = t.timeRanges;
  60501. if (r.type === a.PlaylistLevelType.MAIN)
  60502. if (this.activeFragment = r, n) {
  60503. var o = this.activeParts;
  60504. o || (this.activeParts = o = []), o.push(n)
  60505. } else this.activeParts = null;
  60506. this.timeRanges = s, Object.keys(s).forEach(function(e) {
  60507. var t = s[e];
  60508. if (i.detectEvictedFragments(e, t), !n)
  60509. for (var a = 0; a < t.length; a++) r.appendedPTS = Math.max(t.end(a), r.appendedPTS ||
  60510. 0)
  60511. })
  60512. }, t.onFragBuffered = function(e, t) {
  60513. this.detectPartialFragments(t)
  60514. }, t.hasFragment = function(e) {
  60515. var t = u(e);
  60516. return !!this.fragments[t]
  60517. }, t.removeFragmentsInRange = function(e, t, i) {
  60518. var r = this;
  60519. Object.keys(this.fragments).forEach(function(n) {
  60520. var a = r.fragments[n];
  60521. if (a && a.buffered) {
  60522. var s = a.body;
  60523. s.type === i && s.start < t && s.end > e && r.removeFragment(s)
  60524. }
  60525. })
  60526. }, t.removeFragment = function(e) {
  60527. var t = u(e);
  60528. e.stats.loaded = 0, e.clearElementaryStreamInfo(), delete this.fragments[t]
  60529. }, t.removeAllFragments = function() {
  60530. this.fragments = Object.create(null), this.activeFragment = null, this.activeParts = null
  60531. }, e
  60532. }();
  60533. function o(e) {
  60534. var t, i;
  60535. return e.buffered && ((null === (t = e.range.video) || void 0 === t ? void 0 : t.partial) || (null ===
  60536. (i = e.range.audio) || void 0 === i ? void 0 : i.partial))
  60537. }
  60538. function u(e) {
  60539. return e.type + "_" + e.level + "_" + e.urlId + "_" + e.sn
  60540. }
  60541. },
  60542. "./src/controller/gap-controller.ts": function(e, t, i) {
  60543. "use strict";
  60544. i.r(t), i.d(t, "STALL_MINIMUM_DURATION_MS", function() {
  60545. return o
  60546. }), i.d(t, "MAX_START_GAP_JUMP", function() {
  60547. return u
  60548. }), i.d(t, "SKIP_BUFFER_HOLE_STEP_SECONDS", function() {
  60549. return l
  60550. }), i.d(t, "SKIP_BUFFER_RANGE_START", function() {
  60551. return d
  60552. }), i.d(t, "default", function() {
  60553. return c
  60554. });
  60555. var r = i("./src/utils/buffer-helper.ts"),
  60556. n = i("./src/errors.ts"),
  60557. a = i("./src/events.ts"),
  60558. s = i("./src/utils/logger.ts"),
  60559. o = 250,
  60560. u = 2,
  60561. l = .1,
  60562. d = .05,
  60563. c = function() {
  60564. function e(e, t, i, r) {
  60565. this.config = void 0, this.media = void 0, this.fragmentTracker = void 0, this.hls = void 0, this
  60566. .nudgeRetry = 0, this.stallReported = !1, this.stalled = null, this.moved = !1, this.seeking = !
  60567. 1, this.config = e, this.media = t, this.fragmentTracker = i, this.hls = r
  60568. }
  60569. var t = e.prototype;
  60570. return t.destroy = function() {
  60571. this.hls = this.fragmentTracker = this.media = null
  60572. }, t.poll = function(e) {
  60573. var t = this.config,
  60574. i = this.media,
  60575. n = this.stalled,
  60576. a = i.currentTime,
  60577. l = i.seeking,
  60578. d = this.seeking && !l,
  60579. c = !this.seeking && l;
  60580. if (this.seeking = l, a === e) {
  60581. if ((c || d) && (this.stalled = null), !i.paused && !i.ended && 0 !== i.playbackRate && r
  60582. .BufferHelper.getBuffered(i).length) {
  60583. var h = r.BufferHelper.bufferInfo(i, a, 0),
  60584. f = h.len > 0,
  60585. p = h.nextStart || 0;
  60586. if (f || p) {
  60587. if (l) {
  60588. var m = h.len > u,
  60589. g = !p || p - a > u && !this.fragmentTracker.getPartialFragment(a);
  60590. if (m || g) return;
  60591. this.moved = !1
  60592. }
  60593. if (!this.moved && null !== this.stalled) {
  60594. var v, y = Math.max(p, h.start || 0) - a,
  60595. _ = this.hls.levels ? this.hls.levels[this.hls.currentLevel] : null,
  60596. b = (null === _ || void 0 === _ ? void 0 : null === (v = _.details) || void 0 === v ?
  60597. void 0 : v.live) ? 2 * _.details.targetduration : u;
  60598. if (y > 0 && y <= b) return void this._trySkipBufferHole(null)
  60599. }
  60600. var w = self.performance.now();
  60601. if (null !== n) {
  60602. var E = w - n;
  60603. !l && E >= o && this._reportStall(h.len);
  60604. var T = r.BufferHelper.bufferInfo(i, a, t.maxBufferHole);
  60605. this._tryFixBufferStall(T, E)
  60606. } else this.stalled = w
  60607. }
  60608. }
  60609. } else if (this.moved = !0, null !== n) {
  60610. if (this.stallReported) {
  60611. var S = self.performance.now() - n;
  60612. s.logger.warn("playback not stuck anymore @" + a + ", after " + Math.round(S) + "ms"), this
  60613. .stallReported = !1
  60614. }
  60615. this.stalled = null, this.nudgeRetry = 0
  60616. }
  60617. }, t._tryFixBufferStall = function(e, t) {
  60618. var i = this.config,
  60619. r = this.fragmentTracker,
  60620. n = this.media.currentTime,
  60621. a = r.getPartialFragment(n);
  60622. if (a && this._trySkipBufferHole(a)) return;
  60623. e.len > i.maxBufferHole && t > 1e3 * i.highBufferWatchdogPeriod && (s.logger.warn(
  60624. "Trying to nudge playhead over buffer-hole"), this.stalled = null, this._tryNudgeBuffer())
  60625. }, t._reportStall = function(e) {
  60626. var t = this.hls,
  60627. i = this.media;
  60628. this.stallReported || (this.stallReported = !0, s.logger.warn("Playback stalling at @" + i
  60629. .currentTime + " due to low buffer (buffer=" + e + ")"), t.trigger(a.Events.ERROR, {
  60630. type: n.ErrorTypes.MEDIA_ERROR,
  60631. details: n.ErrorDetails.BUFFER_STALLED_ERROR,
  60632. fatal: !1,
  60633. buffer: e
  60634. }))
  60635. }, t._trySkipBufferHole = function(e) {
  60636. for (var t = this.config, i = this.hls, o = this.media, u = o.currentTime, c = 0, h = r
  60637. .BufferHelper.getBuffered(o), f = 0; f < h.length; f++) {
  60638. var p = h.start(f);
  60639. if (u + t.maxBufferHole >= c && u < p) {
  60640. var m = Math.max(p + d, o.currentTime + l);
  60641. return s.logger.warn("skipping hole, adjusting currentTime from " + u + " to " + m), this
  60642. .moved = !0, this.stalled = null, o.currentTime = m, e && i.trigger(a.Events.ERROR, {
  60643. type: n.ErrorTypes.MEDIA_ERROR,
  60644. details: n.ErrorDetails.BUFFER_SEEK_OVER_HOLE,
  60645. fatal: !1,
  60646. reason: "fragment loaded with buffer holes, seeking from " + u + " to " + m,
  60647. frag: e
  60648. }), m
  60649. }
  60650. c = h.end(f)
  60651. }
  60652. return 0
  60653. }, t._tryNudgeBuffer = function() {
  60654. var e = this.config,
  60655. t = this.hls,
  60656. i = this.media,
  60657. r = this.nudgeRetry,
  60658. o = i.currentTime;
  60659. if (this.nudgeRetry++, r < e.nudgeMaxRetry) {
  60660. var u = o + (r + 1) * e.nudgeOffset;
  60661. s.logger.warn("Nudging 'currentTime' from " + o + " to " + u), i.currentTime = u, t.trigger(a
  60662. .Events.ERROR, {
  60663. type: n.ErrorTypes.MEDIA_ERROR,
  60664. details: n.ErrorDetails.BUFFER_NUDGE_ON_STALL,
  60665. fatal: !1
  60666. })
  60667. } else s.logger.error("Playhead still not moving while enough data buffered @" + o + " after " +
  60668. e.nudgeMaxRetry + " nudges"), t.trigger(a.Events.ERROR, {
  60669. type: n.ErrorTypes.MEDIA_ERROR,
  60670. details: n.ErrorDetails.BUFFER_STALLED_ERROR,
  60671. fatal: !0
  60672. })
  60673. }, e
  60674. }()
  60675. },
  60676. "./src/controller/id3-track-controller.ts": function(e, t, i) {
  60677. "use strict";
  60678. i.r(t);
  60679. var r = i("./src/events.ts"),
  60680. n = i("./src/utils/texttrack-utils.ts"),
  60681. a = i("./src/demux/id3.ts"),
  60682. s = function() {
  60683. function e(e) {
  60684. this.hls = void 0, this.id3Track = null, this.media = null, this.hls = e, this
  60685. ._registerListeners()
  60686. }
  60687. var t = e.prototype;
  60688. return t.destroy = function() {
  60689. this._unregisterListeners()
  60690. }, t._registerListeners = function() {
  60691. var e = this.hls;
  60692. e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHING, this
  60693. .onMediaDetaching, this), e.on(r.Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata,
  60694. this), e.on(r.Events.BUFFER_FLUSHING, this.onBufferFlushing, this)
  60695. }, t._unregisterListeners = function() {
  60696. var e = this.hls;
  60697. e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHING, this
  60698. .onMediaDetaching, this), e.off(r.Events.FRAG_PARSING_METADATA, this.onFragParsingMetadata,
  60699. this), e.off(r.Events.BUFFER_FLUSHING, this.onBufferFlushing, this)
  60700. }, t.onMediaAttached = function(e, t) {
  60701. this.media = t.media
  60702. }, t.onMediaDetaching = function() {
  60703. this.id3Track && (Object(n.clearCurrentCues)(this.id3Track), this.id3Track = null, this.media =
  60704. null)
  60705. }, t.getID3Track = function(e) {
  60706. if (this.media) {
  60707. for (var t = 0; t < e.length; t++) {
  60708. var i = e[t];
  60709. if ("metadata" === i.kind && "id3" === i.label) return Object(n.sendAddTrackEvent)(i, this
  60710. .media), i
  60711. }
  60712. return this.media.addTextTrack("metadata", "id3")
  60713. }
  60714. }, t.onFragParsingMetadata = function(e, t) {
  60715. if (this.media) {
  60716. var i = t.frag,
  60717. r = t.samples;
  60718. this.id3Track || (this.id3Track = this.getID3Track(this.media.textTracks), this.id3Track
  60719. .mode = "hidden");
  60720. for (var n = self.WebKitDataCue || self.VTTCue || self.TextTrackCue, s = 0; s < r
  60721. .length; s++) {
  60722. var o = a.getID3Frames(r[s].data);
  60723. if (o) {
  60724. var u = r[s].pts,
  60725. l = s < r.length - 1 ? r[s + 1].pts : i.end;
  60726. l - u <= 0 && (l = u + .25);
  60727. for (var d = 0; d < o.length; d++) {
  60728. var c = o[d];
  60729. if (!a.isTimeStampFrame(c)) {
  60730. var h = new n(u, l, "");
  60731. h.value = c, this.id3Track.addCue(h)
  60732. }
  60733. }
  60734. }
  60735. }
  60736. }
  60737. }, t.onBufferFlushing = function(e, t) {
  60738. var i = t.startOffset,
  60739. r = t.endOffset,
  60740. a = t.type;
  60741. if (!a || "audio" === a) {
  60742. var s = this.id3Track;
  60743. s && Object(n.removeCuesInRange)(s, i, r)
  60744. }
  60745. }, e
  60746. }();
  60747. t.default = s
  60748. },
  60749. "./src/controller/latency-controller.ts": function(e, t, i) {
  60750. "use strict";
  60751. i.r(t), i.d(t, "default", function() {
  60752. return o
  60753. });
  60754. var r = i("./src/errors.ts"),
  60755. n = i("./src/events.ts"),
  60756. a = i("./src/utils/logger.ts");
  60757. function s(e, t) {
  60758. for (var i = 0; i < t.length; i++) {
  60759. var r = t[i];
  60760. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  60761. .defineProperty(e, r.key, r)
  60762. }
  60763. }
  60764. var o = function() {
  60765. function e(e) {
  60766. var t = this;
  60767. this.hls = void 0, this.config = void 0, this.media = null, this.levelDetails = null, this
  60768. .currentTime = 0, this.stallCount = 0, this._latency = null, this.timeupdateHandler =
  60769. function() {
  60770. return t.timeupdate()
  60771. }, this.hls = e, this.config = e.config, this.registerListeners()
  60772. }
  60773. var t, i, o, u = e.prototype;
  60774. return u.destroy = function() {
  60775. this.unregisterListeners(), this.onMediaDetaching(), this.levelDetails = null, this.hls = this
  60776. .timeupdateHandler = null
  60777. }, u.registerListeners = function() {
  60778. this.hls.on(n.Events.MEDIA_ATTACHED, this.onMediaAttached, this), this.hls.on(n.Events
  60779. .MEDIA_DETACHING, this.onMediaDetaching, this), this.hls.on(n.Events.MANIFEST_LOADING, this
  60780. .onManifestLoading, this), this.hls.on(n.Events.LEVEL_UPDATED, this.onLevelUpdated, this),
  60781. this.hls.on(n.Events.ERROR, this.onError, this)
  60782. }, u.unregisterListeners = function() {
  60783. this.hls.off(n.Events.MEDIA_ATTACHED, this.onMediaAttached), this.hls.off(n.Events
  60784. .MEDIA_DETACHING, this.onMediaDetaching), this.hls.off(n.Events.MANIFEST_LOADING, this
  60785. .onManifestLoading), this.hls.off(n.Events.LEVEL_UPDATED, this.onLevelUpdated), this.hls
  60786. .off(n.Events.ERROR, this.onError)
  60787. }, u.onMediaAttached = function(e, t) {
  60788. this.media = t.media, this.media.addEventListener("timeupdate", this.timeupdateHandler)
  60789. }, u.onMediaDetaching = function() {
  60790. this.media && (this.media.removeEventListener("timeupdate", this.timeupdateHandler), this
  60791. .media = null)
  60792. }, u.onManifestLoading = function() {
  60793. this.levelDetails = null, this._latency = null, this.stallCount = 0
  60794. }, u.onLevelUpdated = function(e, t) {
  60795. var i = t.details;
  60796. this.levelDetails = i, i.advanced && this.timeupdate(), !i.live && this.media && this.media
  60797. .removeEventListener("timeupdate", this.timeupdateHandler)
  60798. }, u.onError = function(e, t) {
  60799. t.details === r.ErrorDetails.BUFFER_STALLED_ERROR && (this.stallCount++, a.logger.warn(
  60800. "[playback-rate-controller]: Stall detected, adjusting target latency"))
  60801. }, u.timeupdate = function() {
  60802. var e = this.media,
  60803. t = this.levelDetails;
  60804. if (e && t) {
  60805. this.currentTime = e.currentTime;
  60806. var i = this.computeLatency();
  60807. if (null !== i) {
  60808. this._latency = i;
  60809. var r = this.config,
  60810. n = r.lowLatencyMode,
  60811. a = r.maxLiveSyncPlaybackRate;
  60812. if (n && 1 !== a) {
  60813. var s = this.targetLatency;
  60814. if (null !== s) {
  60815. var o = i - s,
  60816. u = o < Math.min(this.maxLatency, s + t.targetduration);
  60817. if (t.live && u && o > .05 && this.forwardBufferLength > 1) {
  60818. var l = Math.min(2, Math.max(1, a)),
  60819. d = Math.round(2 / (1 + Math.exp(-.75 * o - this.edgeStalled)) * 20) / 20;
  60820. e.playbackRate = Math.min(l, Math.max(1, d))
  60821. } else 1 !== e.playbackRate && 0 !== e.playbackRate && (e.playbackRate = 1)
  60822. }
  60823. }
  60824. }
  60825. }
  60826. }, u.estimateLiveEdge = function() {
  60827. var e = this.levelDetails;
  60828. return null === e ? null : e.edge + e.age
  60829. }, u.computeLatency = function() {
  60830. var e = this.estimateLiveEdge();
  60831. return null === e ? null : e - this.currentTime
  60832. }, t = e, (i = [{
  60833. key: "latency",
  60834. get: function() {
  60835. return this._latency || 0
  60836. }
  60837. }, {
  60838. key: "maxLatency",
  60839. get: function() {
  60840. var e = this.config,
  60841. t = this.levelDetails;
  60842. return void 0 !== e.liveMaxLatencyDuration ? e.liveMaxLatencyDuration : t ? e
  60843. .liveMaxLatencyDurationCount * t.targetduration : 0
  60844. }
  60845. }, {
  60846. key: "targetLatency",
  60847. get: function() {
  60848. var e = this.levelDetails;
  60849. if (null === e) return null;
  60850. var t = e.holdBack,
  60851. i = e.partHoldBack,
  60852. r = e.targetduration,
  60853. n = this.config,
  60854. a = n.liveSyncDuration,
  60855. s = n.liveSyncDurationCount,
  60856. o = n.lowLatencyMode,
  60857. u = this.hls.userConfig,
  60858. l = o && i || t;
  60859. (u.liveSyncDuration || u.liveSyncDurationCount || 0 === l) && (l = void 0 !== a ? a :
  60860. s * r);
  60861. var d = r;
  60862. return l + Math.min(1 * this.stallCount, d)
  60863. }
  60864. }, {
  60865. key: "liveSyncPosition",
  60866. get: function() {
  60867. var e = this.estimateLiveEdge(),
  60868. t = this.targetLatency,
  60869. i = this.levelDetails;
  60870. if (null === e || null === t || null === i) return null;
  60871. var r = i.edge,
  60872. n = e - t - this.edgeStalled,
  60873. a = r - i.totalduration,
  60874. s = r - (this.config.lowLatencyMode && i.partTarget || i.targetduration);
  60875. return Math.min(Math.max(a, n), s)
  60876. }
  60877. }, {
  60878. key: "drift",
  60879. get: function() {
  60880. var e = this.levelDetails;
  60881. return null === e ? 1 : e.drift
  60882. }
  60883. }, {
  60884. key: "edgeStalled",
  60885. get: function() {
  60886. var e = this.levelDetails;
  60887. if (null === e) return 0;
  60888. var t = 3 * (this.config.lowLatencyMode && e.partTarget || e.targetduration);
  60889. return Math.max(e.age - t, 0)
  60890. }
  60891. }, {
  60892. key: "forwardBufferLength",
  60893. get: function() {
  60894. var e = this.media,
  60895. t = this.levelDetails;
  60896. if (!e || !t) return 0;
  60897. var i = e.buffered.length;
  60898. return (i ? e.buffered.end(i - 1) : t.edge) - this.currentTime
  60899. }
  60900. }]) && s(t.prototype, i), o && s(t, o), Object.defineProperty(t, "prototype", {
  60901. writable: !1
  60902. }), e
  60903. }()
  60904. },
  60905. "./src/controller/level-controller.ts": function(e, t, i) {
  60906. "use strict";
  60907. i.r(t), i.d(t, "default", function() {
  60908. return p
  60909. });
  60910. var r = i("./src/types/level.ts"),
  60911. n = i("./src/events.ts"),
  60912. a = i("./src/errors.ts"),
  60913. s = i("./src/utils/codecs.ts"),
  60914. o = i("./src/controller/level-helper.ts"),
  60915. u = i("./src/controller/base-playlist-controller.ts"),
  60916. l = i("./src/types/loader.ts");
  60917. function d() {
  60918. return (d = Object.assign ? Object.assign.bind() : function(e) {
  60919. for (var t = 1; t < arguments.length; t++) {
  60920. var i = arguments[t];
  60921. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  60922. }
  60923. return e
  60924. }).apply(this, arguments)
  60925. }
  60926. function c(e, t) {
  60927. for (var i = 0; i < t.length; i++) {
  60928. var r = t[i];
  60929. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  60930. .defineProperty(e, r.key, r)
  60931. }
  60932. }
  60933. function h(e, t) {
  60934. return (h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  60935. return e.__proto__ = t, e
  60936. })(e, t)
  60937. }
  60938. var f = /chrome|firefox/.test(navigator.userAgent.toLowerCase()),
  60939. p = function(e) {
  60940. var t, i;
  60941. function u(t) {
  60942. var i;
  60943. return (i = e.call(this, t, "[level-controller]") || this)._levels = [], i._firstLevel = -1, i
  60944. ._startLevel = void 0, i.currentLevelIndex = -1, i.manualLevelIndex = -1, i.onParsedComplete =
  60945. void 0, i._registerListeners(), i
  60946. }
  60947. i = e, (t = u).prototype = Object.create(i.prototype), t.prototype.constructor = t, h(t, i);
  60948. var p, m, g, v = u.prototype;
  60949. return v._registerListeners = function() {
  60950. var e = this.hls;
  60951. e.on(n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.on(n.Events.LEVEL_LOADED, this
  60952. .onLevelLoaded, this), e.on(n.Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this),
  60953. e.on(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.on(n.Events.ERROR, this.onError, this)
  60954. }, v._unregisterListeners = function() {
  60955. var e = this.hls;
  60956. e.off(n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.off(n.Events.LEVEL_LOADED, this
  60957. .onLevelLoaded, this), e.off(n.Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched,
  60958. this), e.off(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.off(n.Events.ERROR, this
  60959. .onError, this)
  60960. }, v.destroy = function() {
  60961. this._unregisterListeners(), this.manualLevelIndex = -1, this._levels.length = 0, e.prototype
  60962. .destroy.call(this)
  60963. }, v.startLoad = function() {
  60964. this._levels.forEach(function(e) {
  60965. e.loadError = 0
  60966. }), e.prototype.startLoad.call(this)
  60967. }, v.onManifestLoaded = function(e, t) {
  60968. var i, u, l = [],
  60969. d = [],
  60970. c = [],
  60971. h = {},
  60972. p = !1,
  60973. m = !1,
  60974. g = !1;
  60975. if (t.levels.forEach(function(e) {
  60976. var t = e.attrs;
  60977. p = p || !(!e.width || !e.height), m = m || !!e.videoCodec, g = g || !!e.audioCodec, f &&
  60978. e.audioCodec && -1 !== e.audioCodec.indexOf("mp4a.40.34") && (e.audioCodec = void 0);
  60979. var i = e.bitrate + "-" + e.attrs.RESOLUTION + "-" + e.attrs.CODECS;
  60980. (u = h[i]) ? u.url.push(e.url): (u = new r.Level(e), h[i] = u, l.push(u)), t && (t
  60981. .AUDIO && Object(o.addGroupId)(u, "audio", t.AUDIO), t.SUBTITLES && Object(o
  60982. .addGroupId)(u, "text", t.SUBTITLES))
  60983. }), (p || m) && g && (l = l.filter(function(e) {
  60984. var t = e.videoCodec,
  60985. i = e.width,
  60986. r = e.height;
  60987. return !!t || !(!i || !r)
  60988. })), l = l.filter(function(e) {
  60989. var t = e.audioCodec,
  60990. i = e.videoCodec;
  60991. return (!t || Object(s.isCodecSupportedInMp4)(t, "audio")) && (!i || Object(s
  60992. .isCodecSupportedInMp4)(i, "video"))
  60993. }), t.audioTracks && (d = t.audioTracks.filter(function(e) {
  60994. return !e.audioCodec || Object(s.isCodecSupportedInMp4)(e.audioCodec, "audio")
  60995. }), Object(o.assignTrackIdsByGroup)(d)), t.subtitles && (c = t.subtitles, Object(o
  60996. .assignTrackIdsByGroup)(c)), l.length > 0) {
  60997. i = l[0].bitrate, l.sort(function(e, t) {
  60998. return e.bitrate - t.bitrate
  60999. }), this._levels = l;
  61000. for (var v = 0; v < l.length; v++)
  61001. if (l[v].bitrate === i) {
  61002. this._firstLevel = v, this.log("manifest loaded, " + l.length +
  61003. " level(s) found, first bitrate: " + i);
  61004. break
  61005. } var y = g && !m,
  61006. _ = {
  61007. levels: l,
  61008. audioTracks: d,
  61009. subtitleTracks: c,
  61010. firstLevel: this._firstLevel,
  61011. stats: t.stats,
  61012. audio: g,
  61013. video: m,
  61014. altAudio: !y && d.some(function(e) {
  61015. return !!e.url
  61016. })
  61017. };
  61018. this.hls.trigger(n.Events.MANIFEST_PARSED, _), (this.hls.config.autoStartLoad || this.hls
  61019. .forceStartLoad) && this.hls.startLoad(this.hls.config.startPosition)
  61020. } else this.hls.trigger(n.Events.ERROR, {
  61021. type: a.ErrorTypes.MEDIA_ERROR,
  61022. details: a.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,
  61023. fatal: !0,
  61024. url: t.url,
  61025. reason: "no level with compatible codecs found in manifest"
  61026. })
  61027. }, v.onError = function(t, i) {
  61028. if (e.prototype.onError.call(this, t, i), !i.fatal) {
  61029. var r = i.context,
  61030. n = this._levels[this.currentLevelIndex];
  61031. if (r && (r.type === l.PlaylistContextType.AUDIO_TRACK && n.audioGroupIds && r.groupId === n
  61032. .audioGroupIds[n.urlId] || r.type === l.PlaylistContextType.SUBTITLE_TRACK && n
  61033. .textGroupIds && r.groupId === n.textGroupIds[n.urlId])) this.redundantFailover(this
  61034. .currentLevelIndex);
  61035. else {
  61036. var s, o = !1,
  61037. u = !0;
  61038. switch (i.details) {
  61039. case a.ErrorDetails.FRAG_LOAD_ERROR:
  61040. case a.ErrorDetails.FRAG_LOAD_TIMEOUT:
  61041. case a.ErrorDetails.KEY_LOAD_ERROR:
  61042. case a.ErrorDetails.KEY_LOAD_TIMEOUT:
  61043. if (i.frag) {
  61044. var d = this._levels[i.frag.level];
  61045. d ? (d.fragmentError++, d.fragmentError > this.hls.config.fragLoadingMaxRetry && (s =
  61046. i.frag.level)) : s = i.frag.level
  61047. }
  61048. break;
  61049. case a.ErrorDetails.LEVEL_LOAD_ERROR:
  61050. case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:
  61051. r && (r.deliveryDirectives && (u = !1), s = r.level), o = !0;
  61052. break;
  61053. case a.ErrorDetails.REMUX_ALLOC_ERROR:
  61054. s = i.level, o = !0
  61055. }
  61056. void 0 !== s && this.recoverLevel(i, s, o, u)
  61057. }
  61058. }
  61059. }, v.recoverLevel = function(e, t, i, r) {
  61060. var n = e.details,
  61061. a = this._levels[t];
  61062. if (a.loadError++, i) {
  61063. if (!this.retryLoadingOrFail(e)) return void(this.currentLevelIndex = -1);
  61064. e.levelRetry = !0
  61065. }
  61066. if (r) {
  61067. var s = a.url.length;
  61068. if (s > 1 && a.loadError < s) e.levelRetry = !0, this.redundantFailover(t);
  61069. else if (-1 === this.manualLevelIndex) {
  61070. var o = 0 === t ? this._levels.length - 1 : t - 1;
  61071. this.currentLevelIndex !== o && 0 === this._levels[o].loadError && (this.warn(n +
  61072. ": switch to " + o), e.levelRetry = !0, this.hls.nextAutoLevel = o)
  61073. }
  61074. }
  61075. }, v.redundantFailover = function(e) {
  61076. var t = this._levels[e],
  61077. i = t.url.length;
  61078. if (i > 1) {
  61079. var r = (t.urlId + 1) % i;
  61080. this.warn("Switching to redundant URL-id " + r), this._levels.forEach(function(e) {
  61081. e.urlId = r
  61082. }), this.level = e
  61083. }
  61084. }, v.onFragLoaded = function(e, t) {
  61085. var i = t.frag;
  61086. if (void 0 !== i && i.type === l.PlaylistLevelType.MAIN) {
  61087. var r = this._levels[i.level];
  61088. void 0 !== r && (r.fragmentError = 0, r.loadError = 0)
  61089. }
  61090. }, v.onLevelLoaded = function(e, t) {
  61091. var i, r, n = t.level,
  61092. a = t.details,
  61093. s = this._levels[n];
  61094. if (!s) return this.warn("Invalid level index " + n), void(null !== (r = t
  61095. .deliveryDirectives) && void 0 !== r && r.skip && (a.deltaUpdateFailed = !0));
  61096. n === this.currentLevelIndex ? (0 === s.fragmentError && (s.loadError = 0, this.retryCount = 0),
  61097. this.playlistLoaded(n, t, s.details)) : null !== (i = t.deliveryDirectives) && void 0 !==
  61098. i && i.skip && (a.deltaUpdateFailed = !0)
  61099. }, v.onAudioTrackSwitched = function(e, t) {
  61100. var i = this.hls.levels[this.currentLevelIndex];
  61101. if (i && i.audioGroupIds) {
  61102. for (var r = -1, n = this.hls.audioTracks[t.id].groupId, a = 0; a < i.audioGroupIds
  61103. .length; a++)
  61104. if (i.audioGroupIds[a] === n) {
  61105. r = a;
  61106. break
  61107. } r !== i.urlId && (i.urlId = r, this.startLoad())
  61108. }
  61109. }, v.loadPlaylist = function(e) {
  61110. var t = this.currentLevelIndex,
  61111. i = this._levels[t];
  61112. if (this.canLoad && i && i.url.length > 0) {
  61113. var r = i.urlId,
  61114. a = i.url[r];
  61115. if (e) try {
  61116. a = e.addDirectives(a)
  61117. } catch (e) {
  61118. this.warn("Could not construct new URL with HLS Delivery Directives: " + e)
  61119. }
  61120. this.log("Attempt loading level index " + t + (e ? " at sn " + e.msn + " part " + e.part :
  61121. "") + " with URL-id " + r + " " + a), this.clearTimer(), this.hls.trigger(n.Events
  61122. .LEVEL_LOADING, {
  61123. url: a,
  61124. level: t,
  61125. id: r,
  61126. deliveryDirectives: e || null
  61127. })
  61128. }
  61129. }, v.removeLevel = function(e, t) {
  61130. var i = function(e, i) {
  61131. return i !== t
  61132. },
  61133. r = this._levels.filter(function(r, n) {
  61134. return n !== e || r.url.length > 1 && void 0 !== t && (r.url = r.url.filter(i), r
  61135. .audioGroupIds && (r.audioGroupIds = r.audioGroupIds.filter(i)), r.textGroupIds && (r
  61136. .textGroupIds = r.textGroupIds.filter(i)), r.urlId = 0, !0)
  61137. }).map(function(e, t) {
  61138. var i = e.details;
  61139. return null !== i && void 0 !== i && i.fragments && i.fragments.forEach(function(e) {
  61140. e.level = t
  61141. }), e
  61142. });
  61143. this._levels = r, this.hls.trigger(n.Events.LEVELS_UPDATED, {
  61144. levels: r
  61145. })
  61146. }, p = u, (m = [{
  61147. key: "levels",
  61148. get: function() {
  61149. return 0 === this._levels.length ? null : this._levels
  61150. }
  61151. }, {
  61152. key: "level",
  61153. get: function() {
  61154. return this.currentLevelIndex
  61155. },
  61156. set: function(e) {
  61157. var t, i = this._levels;
  61158. if (0 !== i.length && (this.currentLevelIndex !== e || null === (t = i[e]) || void 0 ===
  61159. t || !t.details)) {
  61160. if (e < 0 || e >= i.length) {
  61161. var r = e < 0;
  61162. if (this.hls.trigger(n.Events.ERROR, {
  61163. type: a.ErrorTypes.OTHER_ERROR,
  61164. details: a.ErrorDetails.LEVEL_SWITCH_ERROR,
  61165. level: e,
  61166. fatal: r,
  61167. reason: "invalid level idx"
  61168. }), r) return;
  61169. e = Math.min(e, i.length - 1)
  61170. }
  61171. this.clearTimer();
  61172. var s = this.currentLevelIndex,
  61173. o = i[s],
  61174. u = i[e];
  61175. this.log("switching to level " + e + " from " + s), this.currentLevelIndex = e;
  61176. var l = d({}, u, {
  61177. level: e,
  61178. maxBitrate: u.maxBitrate,
  61179. uri: u.uri,
  61180. urlId: u.urlId
  61181. });
  61182. delete l._urlId, this.hls.trigger(n.Events.LEVEL_SWITCHING, l);
  61183. var c = u.details;
  61184. if (!c || c.live) {
  61185. var h = this.switchParams(u.uri, null === o || void 0 === o ? void 0 : o.details);
  61186. this.loadPlaylist(h)
  61187. }
  61188. }
  61189. }
  61190. }, {
  61191. key: "manualLevel",
  61192. get: function() {
  61193. return this.manualLevelIndex
  61194. },
  61195. set: function(e) {
  61196. this.manualLevelIndex = e, void 0 === this._startLevel && (this._startLevel = e), -1 !==
  61197. e && (this.level = e)
  61198. }
  61199. }, {
  61200. key: "firstLevel",
  61201. get: function() {
  61202. return this._firstLevel
  61203. },
  61204. set: function(e) {
  61205. this._firstLevel = e
  61206. }
  61207. }, {
  61208. key: "startLevel",
  61209. get: function() {
  61210. if (void 0 === this._startLevel) {
  61211. var e = this.hls.config.startLevel;
  61212. return void 0 !== e ? e : this._firstLevel
  61213. }
  61214. return this._startLevel
  61215. },
  61216. set: function(e) {
  61217. this._startLevel = e
  61218. }
  61219. }, {
  61220. key: "nextLoadLevel",
  61221. get: function() {
  61222. return -1 !== this.manualLevelIndex ? this.manualLevelIndex : this.hls.nextAutoLevel
  61223. },
  61224. set: function(e) {
  61225. this.level = e, -1 === this.manualLevelIndex && (this.hls.nextAutoLevel = e)
  61226. }
  61227. }]) && c(p.prototype, m), g && c(p, g), Object.defineProperty(p, "prototype", {
  61228. writable: !1
  61229. }), u
  61230. }(u.default)
  61231. },
  61232. "./src/controller/level-helper.ts": function(e, t, i) {
  61233. "use strict";
  61234. i.r(t), i.d(t, "addGroupId", function() {
  61235. return a
  61236. }), i.d(t, "assignTrackIdsByGroup", function() {
  61237. return s
  61238. }), i.d(t, "updatePTS", function() {
  61239. return o
  61240. }), i.d(t, "updateFragPTSDTS", function() {
  61241. return l
  61242. }), i.d(t, "mergeDetails", function() {
  61243. return d
  61244. }), i.d(t, "mapPartIntersection", function() {
  61245. return c
  61246. }), i.d(t, "mapFragmentIntersection", function() {
  61247. return h
  61248. }), i.d(t, "adjustSliding", function() {
  61249. return f
  61250. }), i.d(t, "addSliding", function() {
  61251. return p
  61252. }), i.d(t, "computeReloadInterval", function() {
  61253. return m
  61254. }), i.d(t, "getFragmentWithSN", function() {
  61255. return g
  61256. }), i.d(t, "getPartWith", function() {
  61257. return v
  61258. });
  61259. var r = i("./src/polyfills/number.ts"),
  61260. n = i("./src/utils/logger.ts");
  61261. function a(e, t, i) {
  61262. switch (t) {
  61263. case "audio":
  61264. e.audioGroupIds || (e.audioGroupIds = []), e.audioGroupIds.push(i);
  61265. break;
  61266. case "text":
  61267. e.textGroupIds || (e.textGroupIds = []), e.textGroupIds.push(i)
  61268. }
  61269. }
  61270. function s(e) {
  61271. var t = {};
  61272. e.forEach(function(e) {
  61273. var i = e.groupId || "";
  61274. e.id = t[i] = t[i] || 0, t[i]++
  61275. })
  61276. }
  61277. function o(e, t, i) {
  61278. u(e[t], e[i])
  61279. }
  61280. function u(e, t) {
  61281. var i = t.startPTS;
  61282. if (Object(r.isFiniteNumber)(i)) {
  61283. var n, a = 0;
  61284. t.sn > e.sn ? (a = i - e.start, n = e) : (a = e.start - i, n = t), n.duration !== a && (n.duration =
  61285. a)
  61286. } else if (t.sn > e.sn) {
  61287. e.cc === t.cc && e.minEndPTS ? t.start = e.start + (e.minEndPTS - e.start) : t.start = e.start + e
  61288. .duration
  61289. } else t.start = Math.max(e.start - t.duration, 0)
  61290. }
  61291. function l(e, t, i, a, s, o) {
  61292. a - i <= 0 && (n.logger.warn("Fragment should have a positive duration", t), a = i + t.duration, o =
  61293. s + t.duration);
  61294. var l = i,
  61295. d = a,
  61296. c = t.startPTS,
  61297. h = t.endPTS;
  61298. if (Object(r.isFiniteNumber)(c)) {
  61299. var f = Math.abs(c - i);
  61300. Object(r.isFiniteNumber)(t.deltaPTS) ? t.deltaPTS = Math.max(f, t.deltaPTS) : t.deltaPTS = f, l =
  61301. Math.max(i, c), i = Math.min(i, c), s = Math.min(s, t.startDTS), d = Math.min(a, h), a = Math.max(
  61302. a, h), o = Math.max(o, t.endDTS)
  61303. }
  61304. t.duration = a - i;
  61305. var p = i - t.start;
  61306. t.appendedPTS = a, t.start = t.startPTS = i, t.maxStartPTS = l, t.startDTS = s, t.endPTS = a, t
  61307. .minEndPTS = d, t.endDTS = o;
  61308. var m, g = t.sn;
  61309. if (!e || g < e.startSN || g > e.endSN) return 0;
  61310. var v = g - e.startSN,
  61311. y = e.fragments;
  61312. for (y[v] = t, m = v; m > 0; m--) u(y[m], y[m - 1]);
  61313. for (m = v; m < y.length - 1; m++) u(y[m], y[m + 1]);
  61314. return e.fragmentHint && u(y[y.length - 1], e.fragmentHint), e.PTSKnown = e.alignedSliding = !0, p
  61315. }
  61316. function d(e, t) {
  61317. for (var i = null, a = e.fragments, s = a.length - 1; s >= 0; s--) {
  61318. var o = a[s].initSegment;
  61319. if (o) {
  61320. i = o;
  61321. break
  61322. }
  61323. }
  61324. e.fragmentHint && delete e.fragmentHint.endPTS;
  61325. var u, d = 0;
  61326. (h(e, t, function(e, n) {
  61327. e.relurl && (d = e.cc - n.cc), Object(r.isFiniteNumber)(e.startPTS) && Object(r.isFiniteNumber)(
  61328. e.endPTS) && (n.start = n.startPTS = e.startPTS, n.startDTS = e.startDTS, n.appendedPTS = e
  61329. .appendedPTS, n.maxStartPTS = e.maxStartPTS, n.endPTS = e.endPTS, n.endDTS = e.endDTS, n
  61330. .minEndPTS = e.minEndPTS, n.duration = e.endPTS - e.startPTS, n.duration && (u = n), t
  61331. .PTSKnown = t.alignedSliding = !0), n.elementaryStreams = e.elementaryStreams, n.loader = e
  61332. .loader, n.stats = e.stats, n.urlId = e.urlId, e.initSegment && (n.initSegment = e
  61333. .initSegment, i = e.initSegment)
  61334. }), i) && (t.fragmentHint ? t.fragments.concat(t.fragmentHint) : t.fragments).forEach(function(e) {
  61335. var t;
  61336. e.initSegment && e.initSegment.relurl !== (null === (t = i) || void 0 === t ? void 0 : t
  61337. .relurl) || (e.initSegment = i)
  61338. });
  61339. if (t.skippedSegments && (t.deltaUpdateFailed = t.fragments.some(function(e) {
  61340. return !e
  61341. }), t.deltaUpdateFailed)) {
  61342. n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");
  61343. for (var p = t.skippedSegments; p--;) t.fragments.shift();
  61344. t.startSN = t.fragments[0].sn, t.startCC = t.fragments[0].cc
  61345. }
  61346. var m = t.fragments;
  61347. if (d) {
  61348. n.logger.warn("discontinuity sliding from playlist, take drift into account");
  61349. for (var g = 0; g < m.length; g++) m[g].cc += d
  61350. }
  61351. t.skippedSegments && (t.startCC = t.fragments[0].cc), c(e.partList, t.partList, function(e, t) {
  61352. t.elementaryStreams = e.elementaryStreams, t.stats = e.stats
  61353. }), u ? l(t, u, u.startPTS, u.endPTS, u.startDTS, u.endDTS) : f(e, t), m.length && (t
  61354. .totalduration = t.edge - m[0].start), t.driftStartTime = e.driftStartTime, t.driftStart = e
  61355. .driftStart;
  61356. var v = t.advancedDateTime;
  61357. if (t.advanced && v) {
  61358. var y = t.edge;
  61359. t.driftStart || (t.driftStartTime = v, t.driftStart = y), t.driftEndTime = v, t.driftEnd = y
  61360. } else t.driftEndTime = e.driftEndTime, t.driftEnd = e.driftEnd, t.advancedDateTime = e
  61361. .advancedDateTime
  61362. }
  61363. function c(e, t, i) {
  61364. if (e && t)
  61365. for (var r = 0, n = 0, a = e.length; n <= a; n++) {
  61366. var s = e[n],
  61367. o = t[n + r];
  61368. s && o && s.index === o.index && s.fragment.sn === o.fragment.sn ? i(s, o) : r--
  61369. }
  61370. }
  61371. function h(e, t, i) {
  61372. for (var r = t.skippedSegments, n = Math.max(e.startSN, t.startSN) - t.startSN, a = (e.fragmentHint ?
  61373. 1 : 0) + (r ? t.endSN : Math.min(e.endSN, t.endSN)) - t.startSN, s = t.startSN - e.startSN, o =
  61374. t.fragmentHint ? t.fragments.concat(t.fragmentHint) : t.fragments, u = e.fragmentHint ? e
  61375. .fragments.concat(e.fragmentHint) : e.fragments, l = n; l <= a; l++) {
  61376. var d = u[s + l],
  61377. c = o[l];
  61378. r && !c && l < r && (c = t.fragments[l] = d), d && c && i(d, c)
  61379. }
  61380. }
  61381. function f(e, t) {
  61382. var i = t.startSN + t.skippedSegments - e.startSN,
  61383. r = e.fragments;
  61384. i < 0 || i >= r.length || p(t, r[i].start)
  61385. }
  61386. function p(e, t) {
  61387. if (t) {
  61388. for (var i = e.fragments, r = e.skippedSegments; r < i.length; r++) i[r].start += t;
  61389. e.fragmentHint && (e.fragmentHint.start += t)
  61390. }
  61391. }
  61392. function m(e, t) {
  61393. var i, r = 1e3 * e.levelTargetDuration,
  61394. n = r / 2,
  61395. a = e.age,
  61396. s = a > 0 && a < 3 * r,
  61397. o = t.loading.end - t.loading.start,
  61398. u = e.availabilityDelay;
  61399. if (!1 === e.updated)
  61400. if (s) {
  61401. var l = 333 * e.misses;
  61402. i = Math.max(Math.min(n, 2 * o), l), e.availabilityDelay = (e.availabilityDelay || 0) + i
  61403. } else i = n;
  61404. else s ? (u = Math.min(u || r / 2, a), e.availabilityDelay = u, i = u + r - a) : i = r - o;
  61405. return Math.round(i)
  61406. }
  61407. function g(e, t, i) {
  61408. if (!e || !e.details) return null;
  61409. var r = e.details,
  61410. n = r.fragments[t - r.startSN];
  61411. return n || ((n = r.fragmentHint) && n.sn === t ? n : t < r.startSN && i && i.sn === t ? i : null)
  61412. }
  61413. function v(e, t, i) {
  61414. if (!e || !e.details) return null;
  61415. var r = e.details.partList;
  61416. if (r)
  61417. for (var n = r.length; n--;) {
  61418. var a = r[n];
  61419. if (a.index === i && a.fragment.sn === t) return a
  61420. }
  61421. return null
  61422. }
  61423. },
  61424. "./src/controller/stream-controller.ts": function(e, t, i) {
  61425. "use strict";
  61426. i.r(t), i.d(t, "default", function() {
  61427. return y
  61428. });
  61429. var r = i("./src/polyfills/number.ts"),
  61430. n = i("./src/controller/base-stream-controller.ts"),
  61431. a = i("./src/is-supported.ts"),
  61432. s = i("./src/events.ts"),
  61433. o = i("./src/utils/buffer-helper.ts"),
  61434. u = i("./src/controller/fragment-tracker.ts"),
  61435. l = i("./src/types/loader.ts"),
  61436. d = i("./src/loader/fragment.ts"),
  61437. c = i("./src/demux/transmuxer-interface.ts"),
  61438. h = i("./src/types/transmuxer.ts"),
  61439. f = i("./src/controller/gap-controller.ts"),
  61440. p = i("./src/errors.ts"),
  61441. m = i("./src/utils/logger.ts");
  61442. function g(e, t) {
  61443. for (var i = 0; i < t.length; i++) {
  61444. var r = t[i];
  61445. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  61446. .defineProperty(e, r.key, r)
  61447. }
  61448. }
  61449. function v(e, t) {
  61450. return (v = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  61451. return e.__proto__ = t, e
  61452. })(e, t)
  61453. }
  61454. var y = function(e) {
  61455. var t, i;
  61456. function y(t, i) {
  61457. var r;
  61458. return (r = e.call(this, t, i, "[stream-controller]") || this).audioCodecSwap = !1, r
  61459. .gapController = null, r.level = -1, r._forceStartLoad = !1, r.altAudio = !1, r.audioOnly = !1,
  61460. r.fragPlaying = null, r.onvplaying = null, r.onvseeked = null, r.fragLastKbps = 0, r.stalled = !
  61461. 1, r.couldBacktrack = !1, r.audioCodecSwitch = !1, r.videoBuffer = null, r._registerListeners(),
  61462. r
  61463. }
  61464. i = e, (t = y).prototype = Object.create(i.prototype), t.prototype.constructor = t, v(t, i);
  61465. var _, b, w, E = y.prototype;
  61466. return E._registerListeners = function() {
  61467. var e = this.hls;
  61468. e.on(s.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(s.Events.MEDIA_DETACHING, this
  61469. .onMediaDetaching, this), e.on(s.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  61470. .on(s.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on(s.Events.LEVEL_LOADING, this
  61471. .onLevelLoading, this), e.on(s.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.on(s.Events
  61472. .FRAG_LOAD_EMERGENCY_ABORTED, this.onFragLoadEmergencyAborted, this), e.on(s.Events.ERROR,
  61473. this.onError, this), e.on(s.Events.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this),
  61474. e.on(s.Events.AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), e.on(s.Events
  61475. .BUFFER_CREATED, this.onBufferCreated, this), e.on(s.Events.BUFFER_FLUSHED, this
  61476. .onBufferFlushed, this), e.on(s.Events.LEVELS_UPDATED, this.onLevelsUpdated, this), e.on(s
  61477. .Events.FRAG_BUFFERED, this.onFragBuffered, this)
  61478. }, E._unregisterListeners = function() {
  61479. var e = this.hls;
  61480. e.off(s.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(s.Events.MEDIA_DETACHING, this
  61481. .onMediaDetaching, this), e.off(s.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  61482. .off(s.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.off(s.Events.LEVEL_LOADED, this
  61483. .onLevelLoaded, this), e.off(s.Events.FRAG_LOAD_EMERGENCY_ABORTED, this
  61484. .onFragLoadEmergencyAborted, this), e.off(s.Events.ERROR, this.onError, this), e.off(s
  61485. .Events.AUDIO_TRACK_SWITCHING, this.onAudioTrackSwitching, this), e.off(s.Events
  61486. .AUDIO_TRACK_SWITCHED, this.onAudioTrackSwitched, this), e.off(s.Events.BUFFER_CREATED, this
  61487. .onBufferCreated, this), e.off(s.Events.BUFFER_FLUSHED, this.onBufferFlushed, this), e.off(s
  61488. .Events.LEVELS_UPDATED, this.onLevelsUpdated, this), e.off(s.Events.FRAG_BUFFERED, this
  61489. .onFragBuffered, this)
  61490. }, E.onHandlerDestroying = function() {
  61491. this._unregisterListeners(), this.onMediaDetaching()
  61492. }, E.startLoad = function(e) {
  61493. if (this.levels) {
  61494. var t = this.lastCurrentTime,
  61495. i = this.hls;
  61496. if (this.stopLoad(), this.setInterval(100), this.level = -1, this.fragLoadError = 0, !this
  61497. .startFragRequested) {
  61498. var r = i.startLevel; - 1 === r && (i.config.testBandwidth ? (r = 0, this.bitrateTest = !
  61499. 0) : r = i.nextAutoLevel), this.level = i.nextLoadLevel = r, this.loadedmetadata = !1
  61500. }
  61501. t > 0 && -1 === e && (this.log("Override startPosition with lastCurrentTime @" + t.toFixed(
  61502. 3)), e = t), this.state = n.State.IDLE, this.nextLoadPosition = this.startPosition = this
  61503. .lastCurrentTime = e, this.tick()
  61504. } else this._forceStartLoad = !0, this.state = n.State.STOPPED
  61505. }, E.stopLoad = function() {
  61506. this._forceStartLoad = !1, e.prototype.stopLoad.call(this)
  61507. }, E.doTick = function() {
  61508. switch (this.state) {
  61509. case n.State.IDLE:
  61510. this.doTickIdle();
  61511. break;
  61512. case n.State.WAITING_LEVEL:
  61513. var e, t = this.levels,
  61514. i = this.level,
  61515. r = null === t || void 0 === t ? void 0 : null === (e = t[i]) || void 0 === e ? void 0 : e
  61516. .details;
  61517. if (r && (!r.live || this.levelLastLoaded === this.level)) {
  61518. if (this.waitForCdnTuneIn(r)) break;
  61519. this.state = n.State.IDLE;
  61520. break
  61521. }
  61522. break;
  61523. case n.State.FRAG_LOADING_WAITING_RETRY:
  61524. var a, s = self.performance.now(),
  61525. o = this.retryDate;
  61526. (!o || s >= o || null !== (a = this.media) && void 0 !== a && a.seeking) && (this.log(
  61527. "retryDate reached, switch back to IDLE state"), this.state = n.State.IDLE)
  61528. }
  61529. this.onTickEnd()
  61530. }, E.onTickEnd = function() {
  61531. e.prototype.onTickEnd.call(this), this.checkBuffer(), this.checkFragmentChanged()
  61532. }, E.doTickIdle = function() {
  61533. var e, t, i = this.hls,
  61534. r = this.levelLastLoaded,
  61535. a = this.levels,
  61536. o = this.media,
  61537. c = i.config,
  61538. h = i.nextLoadLevel;
  61539. if (null !== r && (o || !this.startFragRequested && c.startFragPrefetch) && (!this.altAudio || !
  61540. this.audioOnly) && a && a[h]) {
  61541. var f = a[h];
  61542. this.level = i.nextLoadLevel = h;
  61543. var p = f.details;
  61544. if (!p || this.state === n.State.WAITING_LEVEL || p.live && this.levelLastLoaded !== h) this
  61545. .state = n.State.WAITING_LEVEL;
  61546. else {
  61547. var m = this.getFwdBufferInfo(this.mediaBuffer ? this.mediaBuffer : o, l.PlaylistLevelType
  61548. .MAIN);
  61549. if (null !== m)
  61550. if (!(m.len >= this.getMaxBufferLength(f.maxBitrate))) {
  61551. if (this._streamEnded(m, p)) {
  61552. var g = {};
  61553. return this.altAudio && (g.type = "video"), this.hls.trigger(s.Events.BUFFER_EOS, g),
  61554. void(this.state = n.State.ENDED)
  61555. }
  61556. var v = m.end,
  61557. y = this.getNextFragment(v, p);
  61558. if (this.couldBacktrack && !this.fragPrevious && y && "initSegment" !== y.sn) {
  61559. var _ = y.sn - p.startSN;
  61560. _ > 1 && (y = p.fragments[_ - 1], this.fragmentTracker.removeFragment(y))
  61561. }
  61562. if (y && this.fragmentTracker.getState(y) === u.FragmentState.OK && this
  61563. .nextLoadPosition > v) {
  61564. var b = this.audioOnly && !this.altAudio ? d.ElementaryStreamTypes.AUDIO : d
  61565. .ElementaryStreamTypes.VIDEO;
  61566. this.afterBufferFlushed(o, b, l.PlaylistLevelType.MAIN), y = this.getNextFragment(this
  61567. .nextLoadPosition, p)
  61568. }
  61569. y && (!y.initSegment || y.initSegment.data || this.bitrateTest || (y = y.initSegment),
  61570. "identity" !== (null === (e = y.decryptdata) || void 0 === e ? void 0 : e
  61571. .keyFormat) || null !== (t = y.decryptdata) && void 0 !== t && t.key ? this
  61572. .loadFragment(y, p, v) : this.loadKey(y, p))
  61573. }
  61574. }
  61575. }
  61576. }, E.loadFragment = function(t, i, r) {
  61577. var n, a = this.fragmentTracker.getState(t);
  61578. if (this.fragCurrent = t, a === u.FragmentState.BACKTRACKED) {
  61579. var s = this.fragmentTracker.getBacktrackData(t);
  61580. if (s) return this._handleFragmentLoadProgress(s), void this._handleFragmentLoadComplete(s);
  61581. a = u.FragmentState.NOT_LOADED
  61582. }
  61583. a === u.FragmentState.NOT_LOADED || a === u.FragmentState.PARTIAL ? "initSegment" === t.sn ?
  61584. this._loadInitSegment(t) : this.bitrateTest ? (t.bitrateTest = !0, this.log("Fragment " + t
  61585. .sn + " of level " + t.level +
  61586. " is being downloaded to test bitrate and will not be buffered"), this
  61587. ._loadBitrateTestFrag(t)) : (this.startFragRequested = !0, e.prototype.loadFragment.call(
  61588. this, t, i, r)) : a === u.FragmentState.APPENDING ? this.reduceMaxBufferLength(t
  61589. .duration) && this.fragmentTracker.removeFragment(t) : 0 === (null === (n = this.media) ||
  61590. void 0 === n ? void 0 : n.buffered.length) && this.fragmentTracker.removeAllFragments()
  61591. }, E.getAppendedFrag = function(e) {
  61592. var t = this.fragmentTracker.getAppendedFrag(e, l.PlaylistLevelType.MAIN);
  61593. return t && "fragment" in t ? t.fragment : t
  61594. }, E.getBufferedFrag = function(e) {
  61595. return this.fragmentTracker.getBufferedFrag(e, l.PlaylistLevelType.MAIN)
  61596. }, E.followingBufferedFrag = function(e) {
  61597. return e ? this.getBufferedFrag(e.end + .5) : null
  61598. }, E.immediateLevelSwitch = function() {
  61599. this.abortCurrentFrag(), this.flushMainBuffer(0, Number.POSITIVE_INFINITY)
  61600. }, E.nextLevelSwitch = function() {
  61601. var e = this.levels,
  61602. t = this.media;
  61603. if (null !== t && void 0 !== t && t.readyState) {
  61604. var i, r = this.getAppendedFrag(t.currentTime);
  61605. if (r && r.start > 1 && this.flushMainBuffer(0, r.start - 1), !t.paused && e) {
  61606. var n = e[this.hls.nextLoadLevel],
  61607. a = this.fragLastKbps;
  61608. i = a && this.fragCurrent ? this.fragCurrent.duration * n.maxBitrate / (1e3 * a) + 1 : 0
  61609. } else i = 0;
  61610. var s = this.getBufferedFrag(t.currentTime + i);
  61611. if (s) {
  61612. var o = this.followingBufferedFrag(s);
  61613. if (o) {
  61614. this.abortCurrentFrag();
  61615. var u = o.maxStartPTS ? o.maxStartPTS : o.start,
  61616. l = o.duration,
  61617. d = Math.max(s.end, u + Math.min(Math.max(l - this.config.maxFragLookUpTolerance, .5 *
  61618. l), .75 * l));
  61619. this.flushMainBuffer(d, Number.POSITIVE_INFINITY)
  61620. }
  61621. }
  61622. }
  61623. }, E.abortCurrentFrag = function() {
  61624. var e = this.fragCurrent;
  61625. switch (this.fragCurrent = null, null !== e && void 0 !== e && e.loader && e.loader.abort(),
  61626. this.state) {
  61627. case n.State.KEY_LOADING:
  61628. case n.State.FRAG_LOADING:
  61629. case n.State.FRAG_LOADING_WAITING_RETRY:
  61630. case n.State.PARSING:
  61631. case n.State.PARSED:
  61632. case n.State.BACKTRACKING:
  61633. this.state = n.State.IDLE
  61634. }
  61635. this.nextLoadPosition = this.getLoadPosition()
  61636. }, E.flushMainBuffer = function(t, i) {
  61637. e.prototype.flushMainBuffer.call(this, t, i, this.altAudio ? "video" : null)
  61638. }, E.onMediaAttached = function(t, i) {
  61639. e.prototype.onMediaAttached.call(this, t, i);
  61640. var r = i.media;
  61641. this.onvplaying = this.onMediaPlaying.bind(this), this.onvseeked = this.onMediaSeeked.bind(
  61642. this), r.addEventListener("playing", this.onvplaying), r.addEventListener("seeked", this
  61643. .onvseeked), this.gapController = new f.default(this.config, r, this.fragmentTracker, this
  61644. .hls)
  61645. }, E.onMediaDetaching = function() {
  61646. var t = this.media;
  61647. t && (t.removeEventListener("playing", this.onvplaying), t.removeEventListener("seeked", this
  61648. .onvseeked), this.onvplaying = this.onvseeked = null, this.videoBuffer = null), this
  61649. .fragPlaying = null, this.gapController && (this.gapController.destroy(), this.gapController =
  61650. null), e.prototype.onMediaDetaching.call(this)
  61651. }, E.onMediaPlaying = function() {
  61652. this.tick()
  61653. }, E.onMediaSeeked = function() {
  61654. var e = this.media,
  61655. t = e ? e.currentTime : null;
  61656. Object(r.isFiniteNumber)(t) && this.log("Media seeked to " + t.toFixed(3)), this.tick()
  61657. }, E.onManifestLoading = function() {
  61658. this.log("Trigger BUFFER_RESET"), this.hls.trigger(s.Events.BUFFER_RESET, void 0), this
  61659. .fragmentTracker.removeAllFragments(), this.couldBacktrack = this.stalled = !1, this
  61660. .startPosition = this.lastCurrentTime = 0, this.fragPlaying = null
  61661. }, E.onManifestParsed = function(e, t) {
  61662. var i, r = !1,
  61663. n = !1;
  61664. t.levels.forEach(function(e) {
  61665. (i = e.audioCodec) && (-1 !== i.indexOf("mp4a.40.2") && (r = !0), -1 !== i.indexOf(
  61666. "mp4a.40.5") && (n = !0))
  61667. }), this.audioCodecSwitch = r && n && !Object(a.changeTypeSupported)(), this
  61668. .audioCodecSwitch && this.log(
  61669. "Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"), this.levels = t
  61670. .levels, this.startFragRequested = !1
  61671. }, E.onLevelLoading = function(e, t) {
  61672. var i = this.levels;
  61673. if (i && this.state === n.State.IDLE) {
  61674. var r = i[t.level];
  61675. (!r.details || r.details.live && this.levelLastLoaded !== t.level || this.waitForCdnTuneIn(r
  61676. .details)) && (this.state = n.State.WAITING_LEVEL)
  61677. }
  61678. }, E.onLevelLoaded = function(e, t) {
  61679. var i, r = this.levels,
  61680. a = t.level,
  61681. o = t.details,
  61682. u = o.totalduration;
  61683. if (r) {
  61684. this.log("Level " + a + " loaded [" + o.startSN + "," + o.endSN + "], cc [" + o.startCC +
  61685. ", " + o.endCC + "] duration:" + u);
  61686. var l = this.fragCurrent;
  61687. !l || this.state !== n.State.FRAG_LOADING && this.state !== n.State
  61688. .FRAG_LOADING_WAITING_RETRY || l.level !== t.level && l.loader && (this.state = n.State
  61689. .IDLE, l.loader.abort());
  61690. var d = r[a],
  61691. c = 0;
  61692. if (o.live || null !== (i = d.details) && void 0 !== i && i.live) {
  61693. if (o.fragments[0] || (o.deltaUpdateFailed = !0), o.deltaUpdateFailed) return;
  61694. c = this.alignPlaylists(o, d.details)
  61695. }
  61696. if (d.details = o, this.levelLastLoaded = a, this.hls.trigger(s.Events.LEVEL_UPDATED, {
  61697. details: o,
  61698. level: a
  61699. }), this.state === n.State.WAITING_LEVEL) {
  61700. if (this.waitForCdnTuneIn(o)) return;
  61701. this.state = n.State.IDLE
  61702. }
  61703. this.startFragRequested ? o.live && this.synchronizeToLiveEdge(o) : this.setStartPosition(o,
  61704. c), this.tick()
  61705. } else this.warn("Levels were reset while loading level " + a)
  61706. }, E._handleFragmentLoadProgress = function(e) {
  61707. var t, i = e.frag,
  61708. r = e.part,
  61709. n = e.payload,
  61710. a = this.levels;
  61711. if (a) {
  61712. var s = a[i.level],
  61713. o = s.details;
  61714. if (o) {
  61715. var u = s.videoCodec,
  61716. d = o.PTSKnown || !o.live,
  61717. f = null === (t = i.initSegment) || void 0 === t ? void 0 : t.data,
  61718. p = this._getAudioCodec(s),
  61719. m = this.transmuxer = this.transmuxer || new c.default(this.hls, l.PlaylistLevelType.MAIN,
  61720. this._handleTransmuxComplete.bind(this), this._handleTransmuxerFlush.bind(this)),
  61721. g = r ? r.index : -1,
  61722. v = -1 !== g,
  61723. y = new h.ChunkMetadata(i.level, i.sn, i.stats.chunkCount, n.byteLength, g, v),
  61724. _ = this.initPTS[i.cc];
  61725. m.push(n, f, p, u, i, r, o.totalduration, d, y, _)
  61726. } else this.warn("Dropping fragment " + i.sn + " of level " + i.level +
  61727. " after level details were reset")
  61728. } else this.warn("Levels were reset while fragment load was in progress. Fragment " + i.sn +
  61729. " of level " + i.level + " will not be buffered")
  61730. }, E.onAudioTrackSwitching = function(e, t) {
  61731. var i = this.altAudio,
  61732. r = !!t.url,
  61733. n = t.id;
  61734. if (!r) {
  61735. if (this.mediaBuffer !== this.media) {
  61736. this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),
  61737. this.mediaBuffer = this.media;
  61738. var a = this.fragCurrent;
  61739. null !== a && void 0 !== a && a.loader && (this.log(
  61740. "Switching to main audio track, cancel main fragment load"), a.loader.abort()), this
  61741. .resetTransmuxer(), this.resetLoadingState()
  61742. } else this.audioOnly && this.resetTransmuxer();
  61743. var o = this.hls;
  61744. i && o.trigger(s.Events.BUFFER_FLUSHING, {
  61745. startOffset: 0,
  61746. endOffset: Number.POSITIVE_INFINITY,
  61747. type: "audio"
  61748. }), o.trigger(s.Events.AUDIO_TRACK_SWITCHED, {
  61749. id: n
  61750. })
  61751. }
  61752. }, E.onAudioTrackSwitched = function(e, t) {
  61753. var i = t.id,
  61754. r = !!this.hls.audioTracks[i].url;
  61755. if (r) {
  61756. var n = this.videoBuffer;
  61757. n && this.mediaBuffer !== n && (this.log(
  61758. "Switching on alternate audio, use video.buffered to schedule main fragment loading"),
  61759. this.mediaBuffer = n)
  61760. }
  61761. this.altAudio = r, this.tick()
  61762. }, E.onBufferCreated = function(e, t) {
  61763. var i, r, n = t.tracks,
  61764. a = !1;
  61765. for (var s in n) {
  61766. var o = n[s];
  61767. if ("main" === o.id) {
  61768. if (r = s, i = o, "video" === s) {
  61769. var u = n[s];
  61770. u && (this.videoBuffer = u.buffer)
  61771. }
  61772. } else a = !0
  61773. }
  61774. a && i ? (this.log("Alternate track found, use " + r +
  61775. ".buffered to schedule main fragment loading"), this.mediaBuffer = i.buffer) : this
  61776. .mediaBuffer = this.media
  61777. }, E.onFragBuffered = function(e, t) {
  61778. var i = t.frag,
  61779. r = t.part;
  61780. if (!i || i.type === l.PlaylistLevelType.MAIN) {
  61781. if (this.fragContextChanged(i)) return this.warn("Fragment " + i.sn + (r ? " p: " + r.index :
  61782. "") + " of level " + i.level + " finished buffering, but was aborted. state: " + this
  61783. .state), void(this.state === n.State.PARSED && (this.state = n.State.IDLE));
  61784. var a = r ? r.stats : i.stats;
  61785. this.fragLastKbps = Math.round(8 * a.total / (a.buffering.end - a.loading.first)),
  61786. "initSegment" !== i.sn && (this.fragPrevious = i), this.fragBufferedComplete(i, r)
  61787. }
  61788. }, E.onError = function(e, t) {
  61789. switch (t.details) {
  61790. case p.ErrorDetails.FRAG_LOAD_ERROR:
  61791. case p.ErrorDetails.FRAG_LOAD_TIMEOUT:
  61792. case p.ErrorDetails.KEY_LOAD_ERROR:
  61793. case p.ErrorDetails.KEY_LOAD_TIMEOUT:
  61794. this.onFragmentOrKeyLoadError(l.PlaylistLevelType.MAIN, t);
  61795. break;
  61796. case p.ErrorDetails.LEVEL_LOAD_ERROR:
  61797. case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:
  61798. this.state !== n.State.ERROR && (t.fatal ? (this.warn("" + t.details), this.state = n.State
  61799. .ERROR) : t.levelRetry || this.state !== n.State.WAITING_LEVEL || (this.state = n
  61800. .State.IDLE));
  61801. break;
  61802. case p.ErrorDetails.BUFFER_FULL_ERROR:
  61803. if ("main" === t.parent && (this.state === n.State.PARSING || this.state === n.State
  61804. .PARSED)) {
  61805. var i = !0,
  61806. r = this.getFwdBufferInfo(this.media, l.PlaylistLevelType.MAIN);
  61807. r && r.len > .5 && (i = !this.reduceMaxBufferLength(r.len)), i && (this.warn(
  61808. "buffer full error also media.currentTime is not buffered, flush main"), this
  61809. .immediateLevelSwitch()), this.resetLoadingState()
  61810. }
  61811. }
  61812. }, E.checkBuffer = function() {
  61813. var e = this.media,
  61814. t = this.gapController;
  61815. if (e && t && e.readyState) {
  61816. var i = o.BufferHelper.getBuffered(e);
  61817. !this.loadedmetadata && i.length ? (this.loadedmetadata = !0, this.seekToStartPos()) : t.poll(
  61818. this.lastCurrentTime), this.lastCurrentTime = e.currentTime
  61819. }
  61820. }, E.onFragLoadEmergencyAborted = function() {
  61821. this.state = n.State.IDLE, this.loadedmetadata || (this.startFragRequested = !1, this
  61822. .nextLoadPosition = this.startPosition), this.tickImmediate()
  61823. }, E.onBufferFlushed = function(e, t) {
  61824. var i = t.type;
  61825. if (i !== d.ElementaryStreamTypes.AUDIO || this.audioOnly && !this.altAudio) {
  61826. var r = (i === d.ElementaryStreamTypes.VIDEO ? this.videoBuffer : this.mediaBuffer) || this
  61827. .media;
  61828. this.afterBufferFlushed(r, i, l.PlaylistLevelType.MAIN)
  61829. }
  61830. }, E.onLevelsUpdated = function(e, t) {
  61831. this.levels = t.levels
  61832. }, E.swapAudioCodec = function() {
  61833. this.audioCodecSwap = !this.audioCodecSwap
  61834. }, E.seekToStartPos = function() {
  61835. var e = this.media,
  61836. t = e.currentTime,
  61837. i = this.startPosition;
  61838. if (i >= 0 && t < i) {
  61839. if (e.seeking) return void m.logger.log("could not seek to " + i + ", already seeking at " +
  61840. t);
  61841. var r = o.BufferHelper.getBuffered(e),
  61842. n = (r.length ? r.start(0) : 0) - i;
  61843. n > 0 && (n < this.config.maxBufferHole || n < this.config.maxFragLookUpTolerance) && (m
  61844. .logger.log("adjusting start position by " + n + " to match buffer start"), i += n, this
  61845. .startPosition = i), this.log("seek to target start position " + i +
  61846. " from current time " + t), e.currentTime = i
  61847. }
  61848. }, E._getAudioCodec = function(e) {
  61849. var t = this.config.defaultAudioCodec || e.audioCodec;
  61850. return this.audioCodecSwap && t && (this.log("Swapping audio codec"), t = -1 !== t.indexOf(
  61851. "mp4a.40.5") ? "mp4a.40.2" : "mp4a.40.5"), t
  61852. }, E._loadBitrateTestFrag = function(e) {
  61853. var t = this;
  61854. this._doFragLoad(e).then(function(i) {
  61855. var r = t.hls;
  61856. if (i && !r.nextLoadLevel && !t.fragContextChanged(e)) {
  61857. t.fragLoadError = 0, t.state = n.State.IDLE, t.startFragRequested = !1, t
  61858. .bitrateTest = !1;
  61859. var a = e.stats;
  61860. a.parsing.start = a.parsing.end = a.buffering.start = a.buffering.end = self.performance
  61861. .now(), r.trigger(s.Events.FRAG_LOADED, i)
  61862. }
  61863. })
  61864. }, E._handleTransmuxComplete = function(e) {
  61865. var t, i = "main",
  61866. a = this.hls,
  61867. o = e.remuxResult,
  61868. u = e.chunkMeta,
  61869. l = this.getCurrentContext(u);
  61870. if (!l) return this.warn("The loading context changed while buffering fragment " + u.sn +
  61871. " of level " + u.level + ". This chunk will not be buffered."), void this
  61872. .resetLiveStartWhenNotLoaded(u.level);
  61873. var c = l.frag,
  61874. h = l.part,
  61875. f = l.level,
  61876. p = o.video,
  61877. m = o.text,
  61878. g = o.id3,
  61879. v = o.initSegment,
  61880. y = this.altAudio ? void 0 : o.audio;
  61881. if (!this.fragContextChanged(c)) {
  61882. if (this.state = n.State.PARSING, v) {
  61883. v.tracks && (this._bufferInitSegment(f, v.tracks, c, u), a.trigger(s.Events
  61884. .FRAG_PARSING_INIT_SEGMENT, {
  61885. frag: c,
  61886. id: i,
  61887. tracks: v.tracks
  61888. }));
  61889. var _ = v.initPTS,
  61890. b = v.timescale;
  61891. Object(r.isFiniteNumber)(_) && (this.initPTS[c.cc] = _, a.trigger(s.Events.INIT_PTS_FOUND, {
  61892. frag: c,
  61893. id: i,
  61894. initPTS: _,
  61895. timescale: b
  61896. }))
  61897. }
  61898. if (p && !1 !== o.independent) {
  61899. if (f.details) {
  61900. var w = p.startPTS,
  61901. E = p.endPTS,
  61902. T = p.startDTS,
  61903. S = p.endDTS;
  61904. if (h) h.elementaryStreams[p.type] = {
  61905. startPTS: w,
  61906. endPTS: E,
  61907. startDTS: T,
  61908. endDTS: S
  61909. };
  61910. else if (p.firstKeyFrame && p.independent && (this.couldBacktrack = !0), p.dropped && p
  61911. .independent) {
  61912. if (this.getLoadPosition() + this.config.maxBufferHole < w) return void this.backtrack(
  61913. c);
  61914. c.setElementaryStreamInfo(p.type, c.start, E, c.start, S, !0)
  61915. }
  61916. c.setElementaryStreamInfo(p.type, w, E, T, S), this.bufferFragmentData(p, c, h, u)
  61917. }
  61918. } else if (!1 === o.independent) return void this.backtrack(c);
  61919. if (y) {
  61920. var A = y.startPTS,
  61921. k = y.endPTS,
  61922. R = y.startDTS,
  61923. M = y.endDTS;
  61924. h && (h.elementaryStreams[d.ElementaryStreamTypes.AUDIO] = {
  61925. startPTS: A,
  61926. endPTS: k,
  61927. startDTS: R,
  61928. endDTS: M
  61929. }), c.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO, A, k, R, M), this
  61930. .bufferFragmentData(y, c, h, u)
  61931. }
  61932. if (null !== g && void 0 !== g && null !== (t = g.samples) && void 0 !== t && t.length) {
  61933. var O = {
  61934. frag: c,
  61935. id: i,
  61936. samples: g.samples
  61937. };
  61938. a.trigger(s.Events.FRAG_PARSING_METADATA, O)
  61939. }
  61940. if (m) {
  61941. var C = {
  61942. frag: c,
  61943. id: i,
  61944. samples: m.samples
  61945. };
  61946. a.trigger(s.Events.FRAG_PARSING_USERDATA, C)
  61947. }
  61948. }
  61949. }, E._bufferInitSegment = function(e, t, i, r) {
  61950. var a = this;
  61951. if (this.state === n.State.PARSING) {
  61952. this.audioOnly = !!t.audio && !t.video, this.altAudio && !this.audioOnly && delete t.audio;
  61953. var o = t.audio,
  61954. u = t.video,
  61955. l = t.audiovideo;
  61956. if (o) {
  61957. var d = e.audioCodec,
  61958. c = navigator.userAgent.toLowerCase();
  61959. this.audioCodecSwitch && (d && (d = -1 !== d.indexOf("mp4a.40.5") ? "mp4a.40.2" :
  61960. "mp4a.40.5"), 1 !== o.metadata.channelCount && -1 === c.indexOf("firefox") && (d =
  61961. "mp4a.40.5")), -1 !== c.indexOf("android") && "audio/mpeg" !== o.container && (d =
  61962. "mp4a.40.2", this.log("Android: force audio codec to " + d)), e.audioCodec && e
  61963. .audioCodec !== d && this.log('Swapping manifest audio codec "' + e.audioCodec +
  61964. '" for "' + d + '"'), o.levelCodec = d, o.id = "main", this.log(
  61965. "Init audio buffer, container:" + o.container + ", codecs[selected/level/parsed]=[" + (
  61966. d || "") + "/" + (e.audioCodec || "") + "/" + o.codec + "]")
  61967. }
  61968. u && (u.levelCodec = e.videoCodec, u.id = "main", this.log("Init video buffer, container:" + u
  61969. .container + ", codecs[level/parsed]=[" + (e.videoCodec || "") + "/" + u.codec + "]")),
  61970. l && this.log("Init audiovideo buffer, container:" + l.container +
  61971. ", codecs[level/parsed]=[" + (e.attrs.CODECS || "") + "/" + l.codec + "]"), this.hls
  61972. .trigger(s.Events.BUFFER_CODECS, t), Object.keys(t).forEach(function(e) {
  61973. var n = t[e].initSegment;
  61974. null !== n && void 0 !== n && n.byteLength && a.hls.trigger(s.Events.BUFFER_APPENDING, {
  61975. type: e,
  61976. data: n,
  61977. frag: i,
  61978. part: null,
  61979. chunkMeta: r,
  61980. parent: i.type
  61981. })
  61982. }), this.tick()
  61983. }
  61984. }, E.backtrack = function(e) {
  61985. this.couldBacktrack = !0, this.resetTransmuxer(), this.flushBufferGap(e);
  61986. var t = this.fragmentTracker.backtrack(e);
  61987. this.fragPrevious = null, this.nextLoadPosition = e.start, t ? this.resetFragmentLoading(e) :
  61988. this.state = n.State.BACKTRACKING
  61989. }, E.checkFragmentChanged = function() {
  61990. var e = this.media,
  61991. t = null;
  61992. if (e && e.readyState > 1 && !1 === e.seeking) {
  61993. var i = e.currentTime;
  61994. if (o.BufferHelper.isBuffered(e, i) ? t = this.getAppendedFrag(i) : o.BufferHelper.isBuffered(
  61995. e, i + .1) && (t = this.getAppendedFrag(i + .1)), t) {
  61996. var r = this.fragPlaying,
  61997. n = t.level;
  61998. r && t.sn === r.sn && r.level === n && t.urlId === r.urlId || (this.hls.trigger(s.Events
  61999. .FRAG_CHANGED, {
  62000. frag: t
  62001. }), r && r.level === n || this.hls.trigger(s.Events.LEVEL_SWITCHED, {
  62002. level: n
  62003. }), this.fragPlaying = t)
  62004. }
  62005. }
  62006. }, _ = y, (b = [{
  62007. key: "nextLevel",
  62008. get: function() {
  62009. var e = this.nextBufferedFrag;
  62010. return e ? e.level : -1
  62011. }
  62012. }, {
  62013. key: "currentLevel",
  62014. get: function() {
  62015. var e = this.media;
  62016. if (e) {
  62017. var t = this.getAppendedFrag(e.currentTime);
  62018. if (t) return t.level
  62019. }
  62020. return -1
  62021. }
  62022. }, {
  62023. key: "nextBufferedFrag",
  62024. get: function() {
  62025. var e = this.media;
  62026. if (e) {
  62027. var t = this.getAppendedFrag(e.currentTime);
  62028. return this.followingBufferedFrag(t)
  62029. }
  62030. return null
  62031. }
  62032. }, {
  62033. key: "forceStartLoad",
  62034. get: function() {
  62035. return this._forceStartLoad
  62036. }
  62037. }]) && g(_.prototype, b), w && g(_, w), Object.defineProperty(_, "prototype", {
  62038. writable: !1
  62039. }), y
  62040. }(n.default)
  62041. },
  62042. "./src/controller/subtitle-stream-controller.ts": function(e, t, i) {
  62043. "use strict";
  62044. i.r(t), i.d(t, "SubtitleStreamController", function() {
  62045. return p
  62046. });
  62047. var r = i("./src/events.ts"),
  62048. n = i("./src/utils/buffer-helper.ts"),
  62049. a = i("./src/controller/fragment-finders.ts"),
  62050. s = i("./src/utils/discontinuities.ts"),
  62051. o = i("./src/controller/level-helper.ts"),
  62052. u = i("./src/controller/fragment-tracker.ts"),
  62053. l = i("./src/controller/base-stream-controller.ts"),
  62054. d = i("./src/types/loader.ts"),
  62055. c = i("./src/types/level.ts");
  62056. function h(e, t) {
  62057. for (var i = 0; i < t.length; i++) {
  62058. var r = t[i];
  62059. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  62060. .defineProperty(e, r.key, r)
  62061. }
  62062. }
  62063. function f(e, t) {
  62064. return (f = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  62065. return e.__proto__ = t, e
  62066. })(e, t)
  62067. }
  62068. var p = function(e) {
  62069. var t, i;
  62070. function p(t, i) {
  62071. var r;
  62072. return (r = e.call(this, t, i, "[subtitle-stream-controller]") || this).levels = [], r
  62073. .currentTrackId = -1, r.tracksBuffered = [], r.mainDetails = null, r._registerListeners(), r
  62074. }
  62075. i = e, (t = p).prototype = Object.create(i.prototype), t.prototype.constructor = t, f(t, i);
  62076. var m, g, v, y = p.prototype;
  62077. return y.onHandlerDestroying = function() {
  62078. this._unregisterListeners(), this.mainDetails = null
  62079. }, y._registerListeners = function() {
  62080. var e = this.hls;
  62081. e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHING, this
  62082. .onMediaDetaching, this), e.on(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  62083. .on(r.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.on(r.Events.ERROR, this.onError,
  62084. this), e.on(r.Events.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.on(r
  62085. .Events.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), e.on(r.Events
  62086. .SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.on(r.Events
  62087. .SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), e.on(r.Events
  62088. .BUFFER_FLUSHING, this.onBufferFlushing, this)
  62089. }, y._unregisterListeners = function() {
  62090. var e = this.hls;
  62091. e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHING, this
  62092. .onMediaDetaching, this), e.off(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  62093. .off(r.Events.LEVEL_LOADED, this.onLevelLoaded, this), e.off(r.Events.ERROR, this.onError,
  62094. this), e.off(r.Events.SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.off(r
  62095. .Events.SUBTITLE_TRACK_SWITCH, this.onSubtitleTrackSwitch, this), e.off(r.Events
  62096. .SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.off(r.Events
  62097. .SUBTITLE_FRAG_PROCESSED, this.onSubtitleFragProcessed, this), e.off(r.Events
  62098. .BUFFER_FLUSHING, this.onBufferFlushing, this)
  62099. }, y.startLoad = function() {
  62100. this.stopLoad(), this.state = l.State.IDLE, this.setInterval(500), this.tick()
  62101. }, y.onManifestLoading = function() {
  62102. this.mainDetails = null, this.fragmentTracker.removeAllFragments()
  62103. }, y.onLevelLoaded = function(e, t) {
  62104. this.mainDetails = t.details
  62105. }, y.onSubtitleFragProcessed = function(e, t) {
  62106. var i = t.frag,
  62107. r = t.success;
  62108. if (this.fragPrevious = i, this.state = l.State.IDLE, r) {
  62109. var n = this.tracksBuffered[this.currentTrackId];
  62110. if (n) {
  62111. for (var a, s = i.start, o = 0; o < n.length; o++)
  62112. if (s >= n[o].start && s <= n[o].end) {
  62113. a = n[o];
  62114. break
  62115. } var u = i.start + i.duration;
  62116. a ? a.end = u : (a = {
  62117. start: s,
  62118. end: u
  62119. }, n.push(a)), this.fragmentTracker.fragBuffered(i)
  62120. }
  62121. }
  62122. }, y.onBufferFlushing = function(e, t) {
  62123. var i = t.startOffset,
  62124. r = t.endOffset;
  62125. if (0 === i && r !== Number.POSITIVE_INFINITY) {
  62126. var n = this.currentTrackId,
  62127. a = this.levels;
  62128. if (!a.length || !a[n] || !a[n].details) return;
  62129. var s = r - a[n].details.targetduration;
  62130. if (s <= 0) return;
  62131. t.endOffsetSubtitles = Math.max(0, s), this.tracksBuffered.forEach(function(e) {
  62132. for (var t = 0; t < e.length;)
  62133. if (e[t].end <= s) e.shift();
  62134. else {
  62135. if (!(e[t].start < s)) break;
  62136. e[t].start = s, t++
  62137. }
  62138. }), this.fragmentTracker.removeFragmentsInRange(i, s, d.PlaylistLevelType.SUBTITLE)
  62139. }
  62140. }, y.onError = function(e, t) {
  62141. var i, r = t.frag;
  62142. r && r.type === d.PlaylistLevelType.SUBTITLE && (null !== (i = this.fragCurrent) && void 0 !==
  62143. i && i.loader && this.fragCurrent.loader.abort(), this.state = l.State.IDLE)
  62144. }, y.onSubtitleTracksUpdated = function(e, t) {
  62145. var i = this,
  62146. r = t.subtitleTracks;
  62147. this.tracksBuffered = [], this.levels = r.map(function(e) {
  62148. return new c.Level(e)
  62149. }), this.fragmentTracker.removeAllFragments(), this.fragPrevious = null, this.levels.forEach(
  62150. function(e) {
  62151. i.tracksBuffered[e.id] = []
  62152. }), this.mediaBuffer = null
  62153. }, y.onSubtitleTrackSwitch = function(e, t) {
  62154. if (this.currentTrackId = t.id, this.levels.length && -1 !== this.currentTrackId) {
  62155. var i = this.levels[this.currentTrackId];
  62156. null !== i && void 0 !== i && i.details ? this.mediaBuffer = this.mediaBufferTimeRanges : this
  62157. .mediaBuffer = null, i && this.setInterval(500)
  62158. } else this.clearInterval()
  62159. }, y.onSubtitleTrackLoaded = function(e, t) {
  62160. var i, r = t.details,
  62161. n = t.id,
  62162. u = this.currentTrackId,
  62163. d = this.levels;
  62164. if (d.length) {
  62165. var c = d[u];
  62166. if (!(n >= d.length || n !== u) && c) {
  62167. if (this.mediaBuffer = this.mediaBufferTimeRanges, r.live || null !== (i = c.details) &&
  62168. void 0 !== i && i.live) {
  62169. var h = this.mainDetails;
  62170. if (r.deltaUpdateFailed || !h) return;
  62171. var f = h.fragments[0];
  62172. if (c.details) 0 === this.alignPlaylists(r, c.details) && f && Object(o.addSliding)(r, f
  62173. .start);
  62174. else r.hasProgramDateTime && h.hasProgramDateTime ? Object(s.alignMediaPlaylistByPDT)(r,
  62175. h) : f && Object(o.addSliding)(r, f.start)
  62176. }
  62177. if (c.details = r, this.levelLastLoaded = n, this.tick(), r.live && !this.fragCurrent &&
  62178. this.media && this.state === l.State.IDLE) Object(a.findFragmentByPTS)(null, r.fragments,
  62179. this.media.currentTime, 0) || (this.warn("Subtitle playlist not aligned with playback"),
  62180. c.details = void 0)
  62181. }
  62182. }
  62183. }, y._handleFragmentLoadComplete = function(e) {
  62184. var t = e.frag,
  62185. i = e.payload,
  62186. n = t.decryptdata,
  62187. a = this.hls;
  62188. if (!this.fragContextChanged(t) && i && i.byteLength > 0 && n && n.key && n.iv && "AES-128" ===
  62189. n.method) {
  62190. var s = performance.now();
  62191. this.decrypter.webCryptoDecrypt(new Uint8Array(i), n.key.buffer, n.iv.buffer).then(function(
  62192. e) {
  62193. var i = performance.now();
  62194. a.trigger(r.Events.FRAG_DECRYPTED, {
  62195. frag: t,
  62196. payload: e,
  62197. stats: {
  62198. tstart: s,
  62199. tdecrypt: i
  62200. }
  62201. })
  62202. })
  62203. }
  62204. }, y.doTick = function() {
  62205. if (this.media) {
  62206. if (this.state === l.State.IDLE) {
  62207. var e, t = this.currentTrackId,
  62208. i = this.levels;
  62209. if (!i.length || !i[t] || !i[t].details) return;
  62210. var r = i[t].details,
  62211. s = r.targetduration,
  62212. o = this.config,
  62213. d = this.media,
  62214. c = n.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges, d.currentTime - s, o
  62215. .maxBufferHole),
  62216. h = c.end;
  62217. if (c.len > this.getMaxBufferLength() + s) return;
  62218. console.assert(r,
  62219. "Subtitle track details are defined on idle subtitle stream controller tick");
  62220. var f, p = r.fragments,
  62221. m = p.length,
  62222. g = r.edge,
  62223. v = this.fragPrevious;
  62224. if (h < g) {
  62225. var y = o.maxFragLookUpTolerance;
  62226. !(f = Object(a.findFragmentByPTS)(v, p, Math.max(p[0].start, h), y)) && v && v.start < p[
  62227. 0].start && (f = p[0])
  62228. } else f = p[m - 1];
  62229. null !== (e = f) && void 0 !== e && e.encrypted ? this.loadKey(f, r) : f && this
  62230. .fragmentTracker.getState(f) === u.FragmentState.NOT_LOADED && this.loadFragment(f, r, h)
  62231. }
  62232. } else this.state = l.State.IDLE
  62233. }, y.loadFragment = function(t, i, r) {
  62234. this.fragCurrent = t, e.prototype.loadFragment.call(this, t, i, r)
  62235. }, m = p, (g = [{
  62236. key: "mediaBufferTimeRanges",
  62237. get: function() {
  62238. return this.tracksBuffered[this.currentTrackId] || []
  62239. }
  62240. }]) && h(m.prototype, g), v && h(m, v), Object.defineProperty(m, "prototype", {
  62241. writable: !1
  62242. }), p
  62243. }(l.default)
  62244. },
  62245. "./src/controller/subtitle-track-controller.ts": function(e, t, i) {
  62246. "use strict";
  62247. i.r(t);
  62248. var r = i("./src/events.ts"),
  62249. n = i("./src/utils/texttrack-utils.ts"),
  62250. a = i("./src/controller/base-playlist-controller.ts"),
  62251. s = i("./src/types/loader.ts");
  62252. function o(e, t) {
  62253. for (var i = 0; i < t.length; i++) {
  62254. var r = t[i];
  62255. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  62256. .defineProperty(e, r.key, r)
  62257. }
  62258. }
  62259. function u(e, t) {
  62260. return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  62261. return e.__proto__ = t, e
  62262. })(e, t)
  62263. }
  62264. var l = function(e) {
  62265. var t, i;
  62266. function a(t) {
  62267. var i;
  62268. return (i = e.call(this, t, "[subtitle-track-controller]") || this).media = null, i.tracks = [], i
  62269. .groupId = null, i.tracksInGroup = [], i.trackId = -1, i.selectDefaultTrack = !0, i
  62270. .queuedDefaultTrack = -1, i.trackChangeListener = function() {
  62271. return i.onTextTracksChanged()
  62272. }, i.asyncPollTrackChange = function() {
  62273. return i.pollTrackChange(0)
  62274. }, i.useTextTrackPolling = !1, i.subtitlePollingInterval = -1, i.subtitleDisplay = !0, i
  62275. .registerListeners(), i
  62276. }
  62277. i = e, (t = a).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i);
  62278. var l, c, h, f = a.prototype;
  62279. return f.destroy = function() {
  62280. this.unregisterListeners(), this.tracks.length = 0, this.tracksInGroup.length = 0, this
  62281. .trackChangeListener = this.asyncPollTrackChange = null, e.prototype.destroy.call(this)
  62282. }, f.registerListeners = function() {
  62283. var e = this.hls;
  62284. e.on(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.on(r.Events.MEDIA_DETACHING, this
  62285. .onMediaDetaching, this), e.on(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  62286. .on(r.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.on(r.Events.LEVEL_LOADING, this
  62287. .onLevelLoading, this), e.on(r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e.on(r
  62288. .Events.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.on(r.Events.ERROR, this
  62289. .onError, this)
  62290. }, f.unregisterListeners = function() {
  62291. var e = this.hls;
  62292. e.off(r.Events.MEDIA_ATTACHED, this.onMediaAttached, this), e.off(r.Events.MEDIA_DETACHING, this
  62293. .onMediaDetaching, this), e.off(r.Events.MANIFEST_LOADING, this.onManifestLoading, this), e
  62294. .off(r.Events.MANIFEST_PARSED, this.onManifestParsed, this), e.off(r.Events.LEVEL_LOADING,
  62295. this.onLevelLoading, this), e.off(r.Events.LEVEL_SWITCHING, this.onLevelSwitching, this), e
  62296. .off(r.Events.SUBTITLE_TRACK_LOADED, this.onSubtitleTrackLoaded, this), e.off(r.Events.ERROR,
  62297. this.onError, this)
  62298. }, f.onMediaAttached = function(e, t) {
  62299. this.media = t.media, this.media && (this.queuedDefaultTrack > -1 && (this.subtitleTrack = this
  62300. .queuedDefaultTrack, this.queuedDefaultTrack = -1), this.useTextTrackPolling = !(this
  62301. .media.textTracks && "onchange" in this.media.textTracks), this.useTextTrackPolling ? this
  62302. .pollTrackChange(500) : this.media.textTracks.addEventListener("change", this
  62303. .asyncPollTrackChange))
  62304. }, f.pollTrackChange = function(e) {
  62305. self.clearInterval(this.subtitlePollingInterval), this.subtitlePollingInterval = self
  62306. .setInterval(this.trackChangeListener, e)
  62307. }, f.onMediaDetaching = function() {
  62308. this.media && (self.clearInterval(this.subtitlePollingInterval), this.useTextTrackPolling ||
  62309. this.media.textTracks.removeEventListener("change", this.asyncPollTrackChange), this
  62310. .trackId > -1 && (this.queuedDefaultTrack = this.trackId), d(this.media.textTracks).forEach(
  62311. function(e) {
  62312. Object(n.clearCurrentCues)(e)
  62313. }), this.subtitleTrack = -1, this.media = null)
  62314. }, f.onManifestLoading = function() {
  62315. this.tracks = [], this.groupId = null, this.tracksInGroup = [], this.trackId = -1, this
  62316. .selectDefaultTrack = !0
  62317. }, f.onManifestParsed = function(e, t) {
  62318. this.tracks = t.subtitleTracks
  62319. }, f.onSubtitleTrackLoaded = function(e, t) {
  62320. var i = t.id,
  62321. r = t.details,
  62322. n = this.trackId,
  62323. a = this.tracksInGroup[n];
  62324. if (a) {
  62325. var s = a.details;
  62326. a.details = t.details, this.log("subtitle track " + i + " loaded [" + r.startSN + "-" + r
  62327. .endSN + "]"), i === this.trackId && (this.retryCount = 0, this.playlistLoaded(i, t, s))
  62328. } else this.warn("Invalid subtitle track id " + i)
  62329. }, f.onLevelLoading = function(e, t) {
  62330. this.switchLevel(t.level)
  62331. }, f.onLevelSwitching = function(e, t) {
  62332. this.switchLevel(t.level)
  62333. }, f.switchLevel = function(e) {
  62334. var t = this.hls.levels[e];
  62335. if (null !== t && void 0 !== t && t.textGroupIds) {
  62336. var i = t.textGroupIds[t.urlId];
  62337. if (this.groupId !== i) {
  62338. var n = this.tracksInGroup ? this.tracksInGroup[this.trackId] : void 0,
  62339. a = this.tracks.filter(function(e) {
  62340. return !i || e.groupId === i
  62341. });
  62342. this.tracksInGroup = a;
  62343. var s = this.findTrackId(null === n || void 0 === n ? void 0 : n.name) || this
  62344. .findTrackId();
  62345. this.groupId = i;
  62346. var o = {
  62347. subtitleTracks: a
  62348. };
  62349. this.log("Updating subtitle tracks, " + a.length + ' track(s) found in "' + i +
  62350. '" group-id'), this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED, o), -1 !== s && this
  62351. .setSubtitleTrack(s, n)
  62352. }
  62353. }
  62354. }, f.findTrackId = function(e) {
  62355. for (var t = this.tracksInGroup, i = 0; i < t.length; i++) {
  62356. var r = t[i];
  62357. if ((!this.selectDefaultTrack || r.default) && (!e || e === r.name)) return r.id
  62358. }
  62359. return -1
  62360. }, f.onError = function(t, i) {
  62361. e.prototype.onError.call(this, t, i), !i.fatal && i.context && i.context.type === s
  62362. .PlaylistContextType.SUBTITLE_TRACK && i.context.id === this.trackId && i.context.groupId ===
  62363. this.groupId && this.retryLoadingOrFail(i)
  62364. }, f.loadPlaylist = function(e) {
  62365. var t = this.tracksInGroup[this.trackId];
  62366. if (this.shouldLoadTrack(t)) {
  62367. var i = t.id,
  62368. n = t.groupId,
  62369. a = t.url;
  62370. if (e) try {
  62371. a = e.addDirectives(a)
  62372. } catch (e) {
  62373. this.warn("Could not construct new URL with HLS Delivery Directives: " + e)
  62374. }
  62375. this.log("Loading subtitle playlist for id " + i), this.hls.trigger(r.Events
  62376. .SUBTITLE_TRACK_LOADING, {
  62377. url: a,
  62378. id: i,
  62379. groupId: n,
  62380. deliveryDirectives: e || null
  62381. })
  62382. }
  62383. }, f.toggleTrackModes = function(e) {
  62384. var t = this,
  62385. i = this.media,
  62386. r = this.subtitleDisplay,
  62387. n = this.trackId;
  62388. if (i) {
  62389. var a = d(i.textTracks),
  62390. s = a.filter(function(e) {
  62391. return e.groupId === t.groupId
  62392. });
  62393. if (-1 === e)[].slice.call(a).forEach(function(e) {
  62394. e.mode = "disabled"
  62395. });
  62396. else {
  62397. var o = s[n];
  62398. o && (o.mode = "disabled")
  62399. }
  62400. var u = s[e];
  62401. u && (u.mode = r ? "showing" : "hidden")
  62402. }
  62403. }, f.setSubtitleTrack = function(e, t) {
  62404. var i, n = this.tracksInGroup;
  62405. if (this.media) {
  62406. if (this.trackId !== e && this.toggleTrackModes(e), !(this.trackId === e && (-1 === e ||
  62407. null !== (i = n[e]) && void 0 !== i && i.details) || e < -1 || e >= n.length)) {
  62408. this.clearTimer();
  62409. var a = n[e];
  62410. if (this.log("Switching to subtitle track " + e), this.trackId = e, a) {
  62411. var s = a.id,
  62412. o = a.groupId,
  62413. u = void 0 === o ? "" : o,
  62414. l = a.name,
  62415. d = a.type,
  62416. c = a.url;
  62417. this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH, {
  62418. id: s,
  62419. groupId: u,
  62420. name: l,
  62421. type: d,
  62422. url: c
  62423. });
  62424. var h = this.switchParams(a.url, null === t || void 0 === t ? void 0 : t.details);
  62425. this.loadPlaylist(h)
  62426. } else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH, {
  62427. id: e
  62428. })
  62429. }
  62430. } else this.queuedDefaultTrack = e
  62431. }, f.onTextTracksChanged = function() {
  62432. if (this.useTextTrackPolling || self.clearInterval(this.subtitlePollingInterval), this.media &&
  62433. this.hls.config.renderTextTracksNatively) {
  62434. for (var e = -1, t = d(this.media.textTracks), i = 0; i < t.length; i++)
  62435. if ("hidden" === t[i].mode) e = i;
  62436. else if ("showing" === t[i].mode) {
  62437. e = i;
  62438. break
  62439. }
  62440. this.subtitleTrack !== e && (this.subtitleTrack = e)
  62441. }
  62442. }, l = a, (c = [{
  62443. key: "subtitleTracks",
  62444. get: function() {
  62445. return this.tracksInGroup
  62446. }
  62447. }, {
  62448. key: "subtitleTrack",
  62449. get: function() {
  62450. return this.trackId
  62451. },
  62452. set: function(e) {
  62453. this.selectDefaultTrack = !1;
  62454. var t = this.tracksInGroup ? this.tracksInGroup[this.trackId] : void 0;
  62455. this.setSubtitleTrack(e, t)
  62456. }
  62457. }]) && o(l.prototype, c), h && o(l, h), Object.defineProperty(l, "prototype", {
  62458. writable: !1
  62459. }), a
  62460. }(a.default);
  62461. function d(e) {
  62462. for (var t = [], i = 0; i < e.length; i++) {
  62463. var r = e[i];
  62464. "subtitles" === r.kind && r.label && t.push(e[i])
  62465. }
  62466. return t
  62467. }
  62468. t.default = l
  62469. },
  62470. "./src/controller/timeline-controller.ts": function(e, t, i) {
  62471. "use strict";
  62472. i.r(t), i.d(t, "TimelineController", function() {
  62473. return h
  62474. });
  62475. var r = i("./src/polyfills/number.ts"),
  62476. n = i("./src/events.ts"),
  62477. a = i("./src/utils/cea-608-parser.ts"),
  62478. s = i("./src/utils/output-filter.ts"),
  62479. o = i("./src/utils/webvtt-parser.ts"),
  62480. u = i("./src/utils/texttrack-utils.ts"),
  62481. l = i("./src/utils/imsc1-ttml-parser.ts"),
  62482. d = i("./src/types/loader.ts"),
  62483. c = i("./src/utils/logger.ts"),
  62484. h = function() {
  62485. function e(e) {
  62486. if (this.hls = void 0, this.media = null, this.config = void 0, this.enabled = !0, this.Cues =
  62487. void 0, this.textTracks = [], this.tracks = [], this.initPTS = [], this.timescale = [], this
  62488. .unparsedVttFrags = [], this.captionsTracks = {}, this.nonNativeCaptionsTracks = {}, this
  62489. .cea608Parser1 = void 0, this.cea608Parser2 = void 0, this.lastSn = -1, this.lastPartIndex = -1,
  62490. this.prevCC = -1, this.vttCCs = {
  62491. ccOffset: 0,
  62492. presentationOffset: 0,
  62493. 0: {
  62494. start: 0,
  62495. prevCC: -1,
  62496. new: !1
  62497. }
  62498. }, this.captionsProperties = void 0, this.hls = e, this.config = e.config, this.Cues = e.config
  62499. .cueHandler, this.captionsProperties = {
  62500. textTrack1: {
  62501. label: this.config.captionsTextTrack1Label,
  62502. languageCode: this.config.captionsTextTrack1LanguageCode
  62503. },
  62504. textTrack2: {
  62505. label: this.config.captionsTextTrack2Label,
  62506. languageCode: this.config.captionsTextTrack2LanguageCode
  62507. },
  62508. textTrack3: {
  62509. label: this.config.captionsTextTrack3Label,
  62510. languageCode: this.config.captionsTextTrack3LanguageCode
  62511. },
  62512. textTrack4: {
  62513. label: this.config.captionsTextTrack4Label,
  62514. languageCode: this.config.captionsTextTrack4LanguageCode
  62515. }
  62516. }, this.config.enableCEA708Captions) {
  62517. var t = new s.default(this, "textTrack1"),
  62518. i = new s.default(this, "textTrack2"),
  62519. r = new s.default(this, "textTrack3"),
  62520. o = new s.default(this, "textTrack4");
  62521. this.cea608Parser1 = new a.default(1, t, i), this.cea608Parser2 = new a.default(3, r, o)
  62522. }
  62523. e.on(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.on(n.Events.MEDIA_DETACHING, this
  62524. .onMediaDetaching, this), e.on(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.on(
  62525. n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.on(n.Events.SUBTITLE_TRACKS_UPDATED,
  62526. this.onSubtitleTracksUpdated, this), e.on(n.Events.FRAG_LOADING, this.onFragLoading, this), e
  62527. .on(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.on(n.Events.FRAG_PARSING_USERDATA, this
  62528. .onFragParsingUserdata, this), e.on(n.Events.FRAG_DECRYPTED, this.onFragDecrypted, this), e
  62529. .on(n.Events.INIT_PTS_FOUND, this.onInitPtsFound, this), e.on(n.Events.SUBTITLE_TRACKS_CLEARED,
  62530. this.onSubtitleTracksCleared, this), e.on(n.Events.BUFFER_FLUSHING, this.onBufferFlushing,
  62531. this)
  62532. }
  62533. var t = e.prototype;
  62534. return t.destroy = function() {
  62535. var e = this.hls;
  62536. e.off(n.Events.MEDIA_ATTACHING, this.onMediaAttaching, this), e.off(n.Events.MEDIA_DETACHING,
  62537. this.onMediaDetaching, this), e.off(n.Events.MANIFEST_LOADING, this.onManifestLoading,
  62538. this), e.off(n.Events.MANIFEST_LOADED, this.onManifestLoaded, this), e.off(n.Events
  62539. .SUBTITLE_TRACKS_UPDATED, this.onSubtitleTracksUpdated, this), e.off(n.Events.FRAG_LOADING,
  62540. this.onFragLoading, this), e.off(n.Events.FRAG_LOADED, this.onFragLoaded, this), e.off(n
  62541. .Events.FRAG_PARSING_USERDATA, this.onFragParsingUserdata, this), e.off(n.Events
  62542. .FRAG_DECRYPTED, this.onFragDecrypted, this), e.off(n.Events.INIT_PTS_FOUND, this
  62543. .onInitPtsFound, this), e.off(n.Events.SUBTITLE_TRACKS_CLEARED, this
  62544. .onSubtitleTracksCleared, this), e.off(n.Events.BUFFER_FLUSHING, this.onBufferFlushing,
  62545. this), this.hls = this.config = this.cea608Parser1 = this.cea608Parser2 = null
  62546. }, t.addCues = function(e, t, i, r, a) {
  62547. for (var s, o, u, l, d = !1, c = a.length; c--;) {
  62548. var h = a[c],
  62549. f = (s = h[0], o = h[1], u = t, l = i, Math.min(o, l) - Math.max(s, u));
  62550. if (f >= 0 && (h[0] = Math.min(h[0], t), h[1] = Math.max(h[1], i), d = !0, f / (i - t) > .5))
  62551. return
  62552. }
  62553. if (d || a.push([t, i]), this.config.renderTextTracksNatively) {
  62554. var p = this.captionsTracks[e];
  62555. this.Cues.newCue(p, t, i, r)
  62556. } else {
  62557. var m = this.Cues.newCue(null, t, i, r);
  62558. this.hls.trigger(n.Events.CUES_PARSED, {
  62559. type: "captions",
  62560. cues: m,
  62561. track: e
  62562. })
  62563. }
  62564. }, t.onInitPtsFound = function(e, t) {
  62565. var i = this,
  62566. r = t.frag,
  62567. a = t.id,
  62568. s = t.initPTS,
  62569. o = t.timescale,
  62570. u = this.unparsedVttFrags;
  62571. "main" === a && (this.initPTS[r.cc] = s, this.timescale[r.cc] = o), u.length && (this
  62572. .unparsedVttFrags = [], u.forEach(function(e) {
  62573. i.onFragLoaded(n.Events.FRAG_LOADED, e)
  62574. }))
  62575. }, t.getExistingTrack = function(e) {
  62576. var t = this.media;
  62577. if (t)
  62578. for (var i = 0; i < t.textTracks.length; i++) {
  62579. var r = t.textTracks[i];
  62580. if (r[e]) return r
  62581. }
  62582. return null
  62583. }, t.createCaptionsTrack = function(e) {
  62584. this.config.renderTextTracksNatively ? this.createNativeTrack(e) : this.createNonNativeTrack(e)
  62585. }, t.createNativeTrack = function(e) {
  62586. if (!this.captionsTracks[e]) {
  62587. var t = this.captionsProperties,
  62588. i = this.captionsTracks,
  62589. r = this.media,
  62590. n = t[e],
  62591. a = n.label,
  62592. s = n.languageCode,
  62593. o = this.getExistingTrack(e);
  62594. if (o) i[e] = o, Object(u.clearCurrentCues)(i[e]), Object(u.sendAddTrackEvent)(i[e], r);
  62595. else {
  62596. var l = this.createTextTrack("captions", a, s);
  62597. l && (l[e] = !0, i[e] = l)
  62598. }
  62599. }
  62600. }, t.createNonNativeTrack = function(e) {
  62601. if (!this.nonNativeCaptionsTracks[e]) {
  62602. var t = this.captionsProperties[e];
  62603. if (t) {
  62604. var i = {
  62605. _id: e,
  62606. label: t.label,
  62607. kind: "captions",
  62608. default: !!t.media && !!t.media.default,
  62609. closedCaptions: t.media
  62610. };
  62611. this.nonNativeCaptionsTracks[e] = i, this.hls.trigger(n.Events
  62612. .NON_NATIVE_TEXT_TRACKS_FOUND, {
  62613. tracks: [i]
  62614. })
  62615. }
  62616. }
  62617. }, t.createTextTrack = function(e, t, i) {
  62618. var r = this.media;
  62619. if (r) return r.addTextTrack(e, t, i)
  62620. }, t.onMediaAttaching = function(e, t) {
  62621. this.media = t.media, this._cleanTracks()
  62622. }, t.onMediaDetaching = function() {
  62623. var e = this.captionsTracks;
  62624. Object.keys(e).forEach(function(t) {
  62625. Object(u.clearCurrentCues)(e[t]), delete e[t]
  62626. }), this.nonNativeCaptionsTracks = {}
  62627. }, t.onManifestLoading = function() {
  62628. this.lastSn = -1, this.lastPartIndex = -1, this.prevCC = -1, this.vttCCs = {
  62629. ccOffset: 0,
  62630. presentationOffset: 0,
  62631. 0: {
  62632. start: 0,
  62633. prevCC: -1,
  62634. new: !1
  62635. }
  62636. }, this._cleanTracks(), this.tracks = [], this.captionsTracks = {}, this
  62637. .nonNativeCaptionsTracks = {}, this.textTracks = [], this.unparsedVttFrags = this
  62638. .unparsedVttFrags || [], this.initPTS = [], this.timescale = [], this.cea608Parser1 && this
  62639. .cea608Parser2 && (this.cea608Parser1.reset(), this.cea608Parser2.reset())
  62640. }, t._cleanTracks = function() {
  62641. var e = this.media;
  62642. if (e) {
  62643. var t = e.textTracks;
  62644. if (t)
  62645. for (var i = 0; i < t.length; i++) Object(u.clearCurrentCues)(t[i])
  62646. }
  62647. }, t.onSubtitleTracksUpdated = function(e, t) {
  62648. var i = this;
  62649. this.textTracks = [];
  62650. var r = t.subtitleTracks || [],
  62651. a = r.some(function(e) {
  62652. return e.textCodec === l.IMSC1_CODEC
  62653. });
  62654. if (this.config.enableWebVTT || a && this.config.enableIMSC1) {
  62655. var s = this.tracks && r && this.tracks.length === r.length;
  62656. if (this.tracks = r || [], this.config.renderTextTracksNatively) {
  62657. var o = this.media ? this.media.textTracks : [];
  62658. this.tracks.forEach(function(e, t) {
  62659. var r;
  62660. if (t < o.length) {
  62661. for (var n = null, a = 0; a < o.length; a++)
  62662. if (f(o[a], e)) {
  62663. n = o[a];
  62664. break
  62665. } n && (r = n)
  62666. }
  62667. r ? Object(u.clearCurrentCues)(r) : (r = i.createTextTrack("subtitles", e.name, e
  62668. .lang)) && (r.mode = "disabled"), r && (r.groupId = e.groupId, i.textTracks.push(
  62669. r))
  62670. })
  62671. } else if (!s && this.tracks && this.tracks.length) {
  62672. var d = this.tracks.map(function(e) {
  62673. return {
  62674. label: e.name,
  62675. kind: e.type.toLowerCase(),
  62676. default: e.default,
  62677. subtitleTrack: e
  62678. }
  62679. });
  62680. this.hls.trigger(n.Events.NON_NATIVE_TEXT_TRACKS_FOUND, {
  62681. tracks: d
  62682. })
  62683. }
  62684. }
  62685. }, t.onManifestLoaded = function(e, t) {
  62686. var i = this;
  62687. this.config.enableCEA708Captions && t.captions && t.captions.forEach(function(e) {
  62688. var t = /(?:CC|SERVICE)([1-4])/.exec(e.instreamId);
  62689. if (t) {
  62690. var r = "textTrack" + t[1],
  62691. n = i.captionsProperties[r];
  62692. n && (n.label = e.name, e.lang && (n.languageCode = e.lang), n.media = e)
  62693. }
  62694. })
  62695. }, t.onFragLoading = function(e, t) {
  62696. var i = this.cea608Parser1,
  62697. r = this.cea608Parser2,
  62698. n = this.lastSn,
  62699. a = this.lastPartIndex;
  62700. if (this.enabled && i && r && t.frag.type === d.PlaylistLevelType.MAIN) {
  62701. var s, o, u = t.frag.sn,
  62702. l = null != (s = null === t || void 0 === t ? void 0 : null === (o = t.part) || void 0 ===
  62703. o ? void 0 : o.index) ? s : -1;
  62704. u === n + 1 || u === n && l === a + 1 || (i.reset(), r.reset()), this.lastSn = u, this
  62705. .lastPartIndex = l
  62706. }
  62707. }, t.onFragLoaded = function(e, t) {
  62708. var i = t.frag,
  62709. a = t.payload,
  62710. s = this.initPTS,
  62711. o = this.unparsedVttFrags;
  62712. if (i.type === d.PlaylistLevelType.SUBTITLE)
  62713. if (a.byteLength) {
  62714. if (!Object(r.isFiniteNumber)(s[i.cc])) return o.push(t), void(s.length && this.hls.trigger(
  62715. n.Events.SUBTITLE_FRAG_PROCESSED, {
  62716. success: !1,
  62717. frag: i,
  62718. error: new Error("Missing initial subtitle PTS")
  62719. }));
  62720. var u = i.decryptdata,
  62721. c = "stats" in t;
  62722. if (null == u || null == u.key || "AES-128" !== u.method || c) {
  62723. var h = this.tracks[i.level],
  62724. f = this.vttCCs;
  62725. f[i.cc] || (f[i.cc] = {
  62726. start: i.start,
  62727. prevCC: this.prevCC,
  62728. new: !0
  62729. }, this.prevCC = i.cc), h && h.textCodec === l.IMSC1_CODEC ? this._parseIMSC1(i, a) :
  62730. this._parseVTTs(i, a, f)
  62731. }
  62732. } else this.hls.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, {
  62733. success: !1,
  62734. frag: i,
  62735. error: new Error("Empty subtitle payload")
  62736. })
  62737. }, t._parseIMSC1 = function(e, t) {
  62738. var i = this,
  62739. r = this.hls;
  62740. Object(l.parseIMSC1)(t, this.initPTS[e.cc], this.timescale[e.cc], function(t) {
  62741. i._appendCues(t, e.level), r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, {
  62742. success: !0,
  62743. frag: e
  62744. })
  62745. }, function(t) {
  62746. c.logger.log("Failed to parse IMSC1: " + t), r.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, {
  62747. success: !1,
  62748. frag: e,
  62749. error: t
  62750. })
  62751. })
  62752. }, t._parseVTTs = function(e, t, i) {
  62753. var r = this,
  62754. a = this.hls;
  62755. Object(o.parseWebVTT)(t, this.initPTS[e.cc], this.timescale[e.cc], i, e.cc, e.start, function(
  62756. t) {
  62757. r._appendCues(t, e.level), a.trigger(n.Events.SUBTITLE_FRAG_PROCESSED, {
  62758. success: !0,
  62759. frag: e
  62760. })
  62761. }, function(i) {
  62762. r._fallbackToIMSC1(e, t), c.logger.log("Failed to parse VTT cue: " + i), a.trigger(n
  62763. .Events.SUBTITLE_FRAG_PROCESSED, {
  62764. success: !1,
  62765. frag: e,
  62766. error: i
  62767. })
  62768. })
  62769. }, t._fallbackToIMSC1 = function(e, t) {
  62770. var i = this,
  62771. r = this.tracks[e.level];
  62772. r.textCodec || Object(l.parseIMSC1)(t, this.initPTS[e.cc], this.timescale[e.cc], function() {
  62773. r.textCodec = l.IMSC1_CODEC, i._parseIMSC1(e, t)
  62774. }, function() {
  62775. r.textCodec = "wvtt"
  62776. })
  62777. }, t._appendCues = function(e, t) {
  62778. var i = this.hls;
  62779. if (this.config.renderTextTracksNatively) {
  62780. var r = this.textTracks[t];
  62781. if ("disabled" === r.mode) return;
  62782. e.forEach(function(e) {
  62783. return Object(u.addCueToTrack)(r, e)
  62784. })
  62785. } else {
  62786. var a = this.tracks[t].default ? "default" : "subtitles" + t;
  62787. i.trigger(n.Events.CUES_PARSED, {
  62788. type: "subtitles",
  62789. cues: e,
  62790. track: a
  62791. })
  62792. }
  62793. }, t.onFragDecrypted = function(e, t) {
  62794. var i = t.frag;
  62795. if (i.type === d.PlaylistLevelType.SUBTITLE) {
  62796. if (!Object(r.isFiniteNumber)(this.initPTS[i.cc])) return void this.unparsedVttFrags.push(t);
  62797. this.onFragLoaded(n.Events.FRAG_LOADED, t)
  62798. }
  62799. }, t.onSubtitleTracksCleared = function() {
  62800. this.tracks = [], this.captionsTracks = {}
  62801. }, t.onFragParsingUserdata = function(e, t) {
  62802. var i = this.cea608Parser1,
  62803. r = this.cea608Parser2;
  62804. if (this.enabled && i && r)
  62805. for (var n = 0; n < t.samples.length; n++) {
  62806. var a = t.samples[n].bytes;
  62807. if (a) {
  62808. var s = this.extractCea608Data(a);
  62809. i.addData(t.samples[n].pts, s[0]), r.addData(t.samples[n].pts, s[1])
  62810. }
  62811. }
  62812. }, t.onBufferFlushing = function(e, t) {
  62813. var i = t.startOffset,
  62814. r = t.endOffset,
  62815. n = t.endOffsetSubtitles,
  62816. a = t.type,
  62817. s = this.media;
  62818. if (s && !(s.currentTime < r)) {
  62819. if (!a || "video" === a) {
  62820. var o = this.captionsTracks;
  62821. Object.keys(o).forEach(function(e) {
  62822. return Object(u.removeCuesInRange)(o[e], i, r)
  62823. })
  62824. }
  62825. if (this.config.renderTextTracksNatively && 0 === i && void 0 !== n) {
  62826. var l = this.textTracks;
  62827. Object.keys(l).forEach(function(e) {
  62828. return Object(u.removeCuesInRange)(l[e], i, n)
  62829. })
  62830. }
  62831. }
  62832. }, t.extractCea608Data = function(e) {
  62833. for (var t = [
  62834. [],
  62835. []
  62836. ], i = 31 & e[0], r = 2, n = 0; n < i; n++) {
  62837. var a = e[r++],
  62838. s = 127 & e[r++],
  62839. o = 127 & e[r++];
  62840. if (0 !== s || 0 !== o)
  62841. if (0 != (4 & a)) {
  62842. var u = 3 & a;
  62843. 0 !== u && 1 !== u || (t[u].push(s), t[u].push(o))
  62844. }
  62845. }
  62846. return t
  62847. }, e
  62848. }();
  62849. function f(e, t) {
  62850. return e && e.label === t.name && !(e.textTrack1 || e.textTrack2)
  62851. }
  62852. },
  62853. "./src/crypt/aes-crypto.ts": function(e, t, i) {
  62854. "use strict";
  62855. i.r(t), i.d(t, "default", function() {
  62856. return r
  62857. });
  62858. var r = function() {
  62859. function e(e, t) {
  62860. this.subtle = void 0, this.aesIV = void 0, this.subtle = e, this.aesIV = t
  62861. }
  62862. return e.prototype.decrypt = function(e, t) {
  62863. return this.subtle.decrypt({
  62864. name: "AES-CBC",
  62865. iv: this.aesIV
  62866. }, t, e)
  62867. }, e
  62868. }()
  62869. },
  62870. "./src/crypt/aes-decryptor.ts": function(e, t, i) {
  62871. "use strict";
  62872. i.r(t), i.d(t, "removePadding", function() {
  62873. return n
  62874. }), i.d(t, "default", function() {
  62875. return a
  62876. });
  62877. var r = i("./src/utils/typed-array.ts");
  62878. function n(e) {
  62879. var t = e.byteLength,
  62880. i = t && new DataView(e.buffer).getUint8(t - 1);
  62881. return i ? Object(r.sliceUint8)(e, 0, t - i) : e
  62882. }
  62883. var a = function() {
  62884. function e() {
  62885. this.rcon = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], this.subMix = [new Uint32Array(256),
  62886. new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)
  62887. ], this.invSubMix = [new Uint32Array(256), new Uint32Array(256), new Uint32Array(256),
  62888. new Uint32Array(256)
  62889. ], this.sBox = new Uint32Array(256), this.invSBox = new Uint32Array(256), this.key =
  62890. new Uint32Array(0), this.ksRows = 0, this.keySize = 0, this.keySchedule = void 0, this
  62891. .invKeySchedule = void 0, this.initTable()
  62892. }
  62893. var t = e.prototype;
  62894. return t.uint8ArrayToUint32Array_ = function(e) {
  62895. for (var t = new DataView(e), i = new Uint32Array(4), r = 0; r < 4; r++) i[r] = t.getUint32(4 *
  62896. r);
  62897. return i
  62898. }, t.initTable = function() {
  62899. var e = this.sBox,
  62900. t = this.invSBox,
  62901. i = this.subMix,
  62902. r = i[0],
  62903. n = i[1],
  62904. a = i[2],
  62905. s = i[3],
  62906. o = this.invSubMix,
  62907. u = o[0],
  62908. l = o[1],
  62909. d = o[2],
  62910. c = o[3],
  62911. h = new Uint32Array(256),
  62912. f = 0,
  62913. p = 0,
  62914. m = 0;
  62915. for (m = 0; m < 256; m++) h[m] = m < 128 ? m << 1 : m << 1 ^ 283;
  62916. for (m = 0; m < 256; m++) {
  62917. var g = p ^ p << 1 ^ p << 2 ^ p << 3 ^ p << 4;
  62918. g = g >>> 8 ^ 255 & g ^ 99, e[f] = g, t[g] = f;
  62919. var v = h[f],
  62920. y = h[v],
  62921. _ = h[y],
  62922. b = 257 * h[g] ^ 16843008 * g;
  62923. r[f] = b << 24 | b >>> 8, n[f] = b << 16 | b >>> 16, a[f] = b << 8 | b >>> 24, s[f] = b, b =
  62924. 16843009 * _ ^ 65537 * y ^ 257 * v ^ 16843008 * f, u[g] = b << 24 | b >>> 8, l[g] = b <<
  62925. 16 | b >>> 16, d[g] = b << 8 | b >>> 24, c[g] = b, f ? (f = v ^ h[h[h[_ ^ v]]], p ^= h[h[
  62926. p]]) : f = p = 1
  62927. }
  62928. }, t.expandKey = function(e) {
  62929. for (var t = this.uint8ArrayToUint32Array_(e), i = !0, r = 0; r < t.length && i;) i = t[r] ===
  62930. this.key[r], r++;
  62931. if (!i) {
  62932. this.key = t;
  62933. var n = this.keySize = t.length;
  62934. if (4 !== n && 6 !== n && 8 !== n) throw new Error("Invalid aes key size=" + n);
  62935. var a, s, o, u, l = this.ksRows = 4 * (n + 6 + 1),
  62936. d = this.keySchedule = new Uint32Array(l),
  62937. c = this.invKeySchedule = new Uint32Array(l),
  62938. h = this.sBox,
  62939. f = this.rcon,
  62940. p = this.invSubMix,
  62941. m = p[0],
  62942. g = p[1],
  62943. v = p[2],
  62944. y = p[3];
  62945. for (a = 0; a < l; a++) a < n ? o = d[a] = t[a] : (u = o, a % n == 0 ? (u = h[(u = u << 8 |
  62946. u >>> 24) >>> 24] << 24 | h[u >>> 16 & 255] << 16 | h[u >>> 8 & 255] << 8 | h[255 &
  62947. u], u ^= f[a / n | 0] << 24) : n > 6 && a % n == 4 && (u = h[u >>> 24] << 24 | h[u >>>
  62948. 16 & 255] << 16 | h[u >>> 8 & 255] << 8 | h[255 & u]), d[a] = o = (d[a - n] ^ u) >>> 0);
  62949. for (s = 0; s < l; s++) a = l - s, u = 3 & s ? d[a] : d[a - 4], c[s] = s < 4 || a <= 4 ? u :
  62950. m[h[u >>> 24]] ^ g[h[u >>> 16 & 255]] ^ v[h[u >>> 8 & 255]] ^ y[h[255 & u]], c[s] = c[s] >>>
  62951. 0
  62952. }
  62953. }, t.networkToHostOrderSwap = function(e) {
  62954. return e << 24 | (65280 & e) << 8 | (16711680 & e) >> 8 | e >>> 24
  62955. }, t.decrypt = function(e, t, i) {
  62956. for (var r, n, a, s, o, u, l, d, c, h, f, p, m, g, v = this.keySize + 6, y = this
  62957. .invKeySchedule, _ = this.invSBox, b = this.invSubMix, w = b[0], E = b[1], T = b[2], S = b[
  62958. 3], A = this.uint8ArrayToUint32Array_(i), k = A[0], R = A[1], M = A[2], O = A[3], C =
  62959. new Int32Array(e), D = new Int32Array(C.length), I = this.networkToHostOrderSwap; t < C
  62960. .length;) {
  62961. for (c = I(C[t]), h = I(C[t + 1]), f = I(C[t + 2]), p = I(C[t + 3]), o = c ^ y[0], u = p ^ y[
  62962. 1], l = f ^ y[2], d = h ^ y[3], m = 4, g = 1; g < v; g++) r = w[o >>> 24] ^ E[u >> 16 &
  62963. 255] ^ T[l >> 8 & 255] ^ S[255 & d] ^ y[m], n = w[u >>> 24] ^ E[l >> 16 & 255] ^ T[d >>
  62964. 8 & 255] ^ S[255 & o] ^ y[m + 1], a = w[l >>> 24] ^ E[d >> 16 & 255] ^ T[o >> 8 & 255] ^
  62965. S[255 & u] ^ y[m + 2], s = w[d >>> 24] ^ E[o >> 16 & 255] ^ T[u >> 8 & 255] ^ S[255 & l] ^
  62966. y[m + 3], o = r, u = n, l = a, d = s, m += 4;
  62967. r = _[o >>> 24] << 24 ^ _[u >> 16 & 255] << 16 ^ _[l >> 8 & 255] << 8 ^ _[255 & d] ^ y[m], n =
  62968. _[u >>> 24] << 24 ^ _[l >> 16 & 255] << 16 ^ _[d >> 8 & 255] << 8 ^ _[255 & o] ^ y[m + 1],
  62969. a = _[l >>> 24] << 24 ^ _[d >> 16 & 255] << 16 ^ _[o >> 8 & 255] << 8 ^ _[255 & u] ^ y[m +
  62970. 2], s = _[d >>> 24] << 24 ^ _[o >> 16 & 255] << 16 ^ _[u >> 8 & 255] << 8 ^ _[255 & l] ^
  62971. y[m + 3], D[t] = I(r ^ k), D[t + 1] = I(s ^ R), D[t + 2] = I(a ^ M), D[t + 3] = I(n ^ O),
  62972. k = c, R = h, M = f, O = p, t += 4
  62973. }
  62974. return D.buffer
  62975. }, e
  62976. }()
  62977. },
  62978. "./src/crypt/decrypter.ts": function(e, t, i) {
  62979. "use strict";
  62980. i.r(t), i.d(t, "default", function() {
  62981. return l
  62982. });
  62983. var r = i("./src/crypt/aes-crypto.ts"),
  62984. n = i("./src/crypt/fast-aes-key.ts"),
  62985. a = i("./src/crypt/aes-decryptor.ts"),
  62986. s = i("./src/utils/logger.ts"),
  62987. o = i("./src/utils/mp4-tools.ts"),
  62988. u = i("./src/utils/typed-array.ts"),
  62989. l = function() {
  62990. function e(e, t, i) {
  62991. var r = (void 0 === i ? {} : i).removePKCS7Padding,
  62992. n = void 0 === r || r;
  62993. if (this.logEnabled = !0, this.observer = void 0, this.config = void 0, this.removePKCS7Padding =
  62994. void 0, this.subtle = null, this.softwareDecrypter = null, this.key = null, this.fastAesKey =
  62995. null, this.remainderData = null, this.currentIV = null, this.currentResult = null, this
  62996. .observer = e, this.config = t, this.removePKCS7Padding = n, n) try {
  62997. var a = self.crypto;
  62998. a && (this.subtle = a.subtle || a.webkitSubtle)
  62999. } catch (e) {}
  63000. null === this.subtle && (this.config.enableSoftwareAES = !0)
  63001. }
  63002. var t = e.prototype;
  63003. return t.destroy = function() {
  63004. this.observer = null
  63005. }, t.isSync = function() {
  63006. return this.config.enableSoftwareAES
  63007. }, t.flush = function() {
  63008. var e = this.currentResult;
  63009. if (e) {
  63010. var t = new Uint8Array(e);
  63011. return this.reset(), this.removePKCS7Padding ? Object(a.removePadding)(t) : t
  63012. }
  63013. this.reset()
  63014. }, t.reset = function() {
  63015. this.currentResult = null, this.currentIV = null, this.remainderData = null, this
  63016. .softwareDecrypter && (this.softwareDecrypter = null)
  63017. }, t.decrypt = function(e, t, i, r) {
  63018. if (this.config.enableSoftwareAES) {
  63019. this.softwareDecrypt(new Uint8Array(e), t, i);
  63020. var n = this.flush();
  63021. n && r(n.buffer)
  63022. } else this.webCryptoDecrypt(new Uint8Array(e), t, i).then(r)
  63023. }, t.softwareDecrypt = function(e, t, i) {
  63024. var r = this.currentIV,
  63025. n = this.currentResult,
  63026. s = this.remainderData;
  63027. this.logOnce("JS AES decrypt"), s && (e = Object(o.appendUint8Array)(s, e), this.remainderData =
  63028. null);
  63029. var l = this.getValidChunk(e);
  63030. if (!l.length) return null;
  63031. r && (i = r);
  63032. var d = this.softwareDecrypter;
  63033. d || (d = this.softwareDecrypter = new a.default), d.expandKey(t);
  63034. var c = n;
  63035. return this.currentResult = d.decrypt(l.buffer, 0, i), this.currentIV = Object(u.sliceUint8)(l,
  63036. -16).buffer, c || null
  63037. }, t.webCryptoDecrypt = function(e, t, i) {
  63038. var a = this,
  63039. s = this.subtle;
  63040. return this.key === t && this.fastAesKey || (this.key = t, this.fastAesKey = new n.default(s,
  63041. t)), this.fastAesKey.expandKey().then(function(t) {
  63042. return s ? new r.default(s, i).decrypt(e.buffer, t) : Promise.reject(new Error(
  63043. "web crypto not initialized"))
  63044. }).catch(function(r) {
  63045. return a.onWebCryptoError(r, e, t, i)
  63046. })
  63047. }, t.onWebCryptoError = function(e, t, i, r) {
  63048. return s.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:", e), this.config
  63049. .enableSoftwareAES = !0, this.logEnabled = !0, this.softwareDecrypt(t, i, r)
  63050. }, t.getValidChunk = function(e) {
  63051. var t = e,
  63052. i = e.length - e.length % 16;
  63053. return i !== e.length && (t = Object(u.sliceUint8)(e, 0, i), this.remainderData = Object(u
  63054. .sliceUint8)(e, i)), t
  63055. }, t.logOnce = function(e) {
  63056. this.logEnabled && (s.logger.log("[decrypter.ts]: " + e), this.logEnabled = !1)
  63057. }, e
  63058. }()
  63059. },
  63060. "./src/crypt/fast-aes-key.ts": function(e, t, i) {
  63061. "use strict";
  63062. i.r(t), i.d(t, "default", function() {
  63063. return r
  63064. });
  63065. var r = function() {
  63066. function e(e, t) {
  63067. this.subtle = void 0, this.key = void 0, this.subtle = e, this.key = t
  63068. }
  63069. return e.prototype.expandKey = function() {
  63070. return this.subtle.importKey("raw", this.key, {
  63071. name: "AES-CBC"
  63072. }, !1, ["encrypt", "decrypt"])
  63073. }, e
  63074. }()
  63075. },
  63076. "./src/demux/aacdemuxer.ts": function(e, t, i) {
  63077. "use strict";
  63078. i.r(t);
  63079. var r = i("./src/demux/base-audio-demuxer.ts"),
  63080. n = i("./src/demux/adts.ts"),
  63081. a = i("./src/utils/logger.ts"),
  63082. s = i("./src/demux/id3.ts");
  63083. function o(e, t) {
  63084. return (o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  63085. return e.__proto__ = t, e
  63086. })(e, t)
  63087. }
  63088. var u = function(e) {
  63089. var t, i;
  63090. function r(t, i) {
  63091. var r;
  63092. return (r = e.call(this) || this).observer = void 0, r.config = void 0, r.observer = t, r.config =
  63093. i, r
  63094. }
  63095. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, o(t, i);
  63096. var u = r.prototype;
  63097. return u.resetInitSegment = function(t, i, r, n) {
  63098. e.prototype.resetInitSegment.call(this, t, i, r, n), this._audioTrack = {
  63099. container: "audio/adts",
  63100. type: "audio",
  63101. id: 2,
  63102. pid: -1,
  63103. sequenceNumber: 0,
  63104. segmentCodec: "aac",
  63105. samples: [],
  63106. manifestCodec: i,
  63107. duration: n,
  63108. inputTimeScale: 9e4,
  63109. dropped: 0
  63110. }
  63111. }, r.probe = function(e) {
  63112. if (!e) return !1;
  63113. for (var t = (s.getID3Data(e, 0) || []).length, i = e.length; t < i; t++)
  63114. if (n.probe(e, t)) return a.logger.log("ADTS sync word found !"), !0;
  63115. return !1
  63116. }, u.canParse = function(e, t) {
  63117. return n.canParse(e, t)
  63118. }, u.appendFrame = function(e, t, i) {
  63119. n.initTrackConfig(e, this.observer, t, i, e.manifestCodec);
  63120. var r = n.appendFrame(e, t, i, this.initPTS, this.frameIndex);
  63121. if (r && 0 === r.missing) return r
  63122. }, r
  63123. }(r.default);
  63124. u.minProbeByteLength = 9, t.default = u
  63125. },
  63126. "./src/demux/adts.ts": function(e, t, i) {
  63127. "use strict";
  63128. i.r(t), i.d(t, "getAudioConfig", function() {
  63129. return s
  63130. }), i.d(t, "isHeaderPattern", function() {
  63131. return o
  63132. }), i.d(t, "getHeaderLength", function() {
  63133. return u
  63134. }), i.d(t, "getFullFrameLength", function() {
  63135. return l
  63136. }), i.d(t, "canGetFrameLength", function() {
  63137. return d
  63138. }), i.d(t, "isHeader", function() {
  63139. return c
  63140. }), i.d(t, "canParse", function() {
  63141. return h
  63142. }), i.d(t, "probe", function() {
  63143. return f
  63144. }), i.d(t, "initTrackConfig", function() {
  63145. return p
  63146. }), i.d(t, "getFrameDuration", function() {
  63147. return m
  63148. }), i.d(t, "parseFrameHeader", function() {
  63149. return g
  63150. }), i.d(t, "appendFrame", function() {
  63151. return v
  63152. });
  63153. var r = i("./src/utils/logger.ts"),
  63154. n = i("./src/errors.ts"),
  63155. a = i("./src/events.ts");
  63156. function s(e, t, i, s) {
  63157. var o, u, l, d, c = navigator.userAgent.toLowerCase(),
  63158. h = s,
  63159. f = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  63160. o = 1 + ((192 & t[i + 2]) >>> 6);
  63161. var p = (60 & t[i + 2]) >>> 2;
  63162. if (!(p > f.length - 1)) return l = (1 & t[i + 2]) << 2, l |= (192 & t[i + 3]) >>> 6, r.logger.log(
  63163. "manifest codec:" + s + ", ADTS type:" + o + ", samplingIndex:" + p), /firefox/i.test(c) ? p >=
  63164. 6 ? (o = 5, d = new Array(4), u = p - 3) : (o = 2, d = new Array(2), u = p) : -1 !== c.indexOf(
  63165. "android") ? (o = 2, d = new Array(2), u = p) : (o = 5, d = new Array(4), s && (-1 !== s
  63166. .indexOf("mp4a.40.29") || -1 !== s.indexOf("mp4a.40.5")) || !s && p >= 6 ? u = p - 3 : ((s &&
  63167. -1 !== s.indexOf("mp4a.40.2") && (p >= 6 && 1 === l || /vivaldi/i.test(c)) || !s && 1 === l
  63168. ) && (o = 2, d = new Array(2)), u = p)), d[0] = o << 3, d[0] |= (14 & p) >> 1, d[1] |= (1 &
  63169. p) << 7, d[1] |= l << 3, 5 === o && (d[1] |= (14 & u) >> 1, d[2] = (1 & u) << 7, d[2] |= 8, d[3] =
  63170. 0), {
  63171. config: d,
  63172. samplerate: f[p],
  63173. channelCount: l,
  63174. codec: "mp4a.40." + o,
  63175. manifestCodec: h
  63176. };
  63177. e.trigger(a.Events.ERROR, {
  63178. type: n.ErrorTypes.MEDIA_ERROR,
  63179. details: n.ErrorDetails.FRAG_PARSING_ERROR,
  63180. fatal: !0,
  63181. reason: "invalid ADTS sampling index:" + p
  63182. })
  63183. }
  63184. function o(e, t) {
  63185. return 255 === e[t] && 240 == (246 & e[t + 1])
  63186. }
  63187. function u(e, t) {
  63188. return 1 & e[t + 1] ? 7 : 9
  63189. }
  63190. function l(e, t) {
  63191. return (3 & e[t + 3]) << 11 | e[t + 4] << 3 | (224 & e[t + 5]) >>> 5
  63192. }
  63193. function d(e, t) {
  63194. return t + 5 < e.length
  63195. }
  63196. function c(e, t) {
  63197. return t + 1 < e.length && o(e, t)
  63198. }
  63199. function h(e, t) {
  63200. return d(e, t) && o(e, t) && l(e, t) <= e.length - t
  63201. }
  63202. function f(e, t) {
  63203. if (c(e, t)) {
  63204. var i = u(e, t);
  63205. if (t + i >= e.length) return !1;
  63206. var r = l(e, t);
  63207. if (r <= i) return !1;
  63208. var n = t + r;
  63209. return n === e.length || c(e, n)
  63210. }
  63211. return !1
  63212. }
  63213. function p(e, t, i, n, a) {
  63214. if (!e.samplerate) {
  63215. var o = s(t, i, n, a);
  63216. if (!o) return;
  63217. e.config = o.config, e.samplerate = o.samplerate, e.channelCount = o.channelCount, e.codec = o
  63218. .codec, e.manifestCodec = o.manifestCodec, r.logger.log("parsed codec:" + e.codec + ", rate:" + o
  63219. .samplerate + ", channels:" + o.channelCount)
  63220. }
  63221. }
  63222. function m(e) {
  63223. return 9216e4 / e
  63224. }
  63225. function g(e, t, i, r, n) {
  63226. var a = u(e, t),
  63227. s = l(e, t);
  63228. if ((s -= a) > 0) return {
  63229. headerLength: a,
  63230. frameLength: s,
  63231. stamp: i + r * n
  63232. }
  63233. }
  63234. function v(e, t, i, r, n) {
  63235. var a = g(t, i, r, n, m(e.samplerate));
  63236. if (a) {
  63237. var s, o = a.frameLength,
  63238. u = a.headerLength,
  63239. l = a.stamp,
  63240. d = u + o,
  63241. c = Math.max(0, i + d - t.length);
  63242. c ? (s = new Uint8Array(d - u)).set(t.subarray(i + u, t.length), 0) : s = t.subarray(i + u, i + d);
  63243. var h = {
  63244. unit: s,
  63245. pts: l
  63246. };
  63247. return c || e.samples.push(h), {
  63248. sample: h,
  63249. length: d,
  63250. missing: c
  63251. }
  63252. }
  63253. }
  63254. },
  63255. "./src/demux/base-audio-demuxer.ts": function(e, t, i) {
  63256. "use strict";
  63257. i.r(t), i.d(t, "initPTSFn", function() {
  63258. return l
  63259. });
  63260. var r = i("./src/polyfills/number.ts"),
  63261. n = i("./src/demux/id3.ts"),
  63262. a = i("./src/demux/dummy-demuxed-track.ts"),
  63263. s = i("./src/utils/mp4-tools.ts"),
  63264. o = i("./src/utils/typed-array.ts"),
  63265. u = function() {
  63266. function e() {
  63267. this._audioTrack = void 0, this._id3Track = void 0, this.frameIndex = 0, this.cachedData = null,
  63268. this.initPTS = null
  63269. }
  63270. var t = e.prototype;
  63271. return t.resetInitSegment = function(e, t, i, r) {
  63272. this._id3Track = {
  63273. type: "id3",
  63274. id: 3,
  63275. pid: -1,
  63276. inputTimeScale: 9e4,
  63277. sequenceNumber: 0,
  63278. samples: [],
  63279. dropped: 0
  63280. }
  63281. }, t.resetTimeStamp = function() {}, t.resetContiguity = function() {}, t.canParse = function(e,
  63282. t) {
  63283. return !1
  63284. }, t.appendFrame = function(e, t, i) {}, t.demux = function(e, t) {
  63285. this.cachedData && (e = Object(s.appendUint8Array)(this.cachedData, e), this.cachedData = null);
  63286. var i, r, u = n.getID3Data(e, 0),
  63287. d = u ? u.length : 0,
  63288. c = this._audioTrack,
  63289. h = this._id3Track,
  63290. f = u ? n.getTimeStamp(u) : void 0,
  63291. p = e.length;
  63292. for (0 !== this.frameIndex && null !== this.initPTS || (this.initPTS = l(f, t)), u && u.length >
  63293. 0 && h.samples.push({
  63294. pts: this.initPTS,
  63295. dts: this.initPTS,
  63296. data: u
  63297. }), r = this.initPTS; d < p;) {
  63298. if (this.canParse(e, d)) {
  63299. var m = this.appendFrame(c, e, d);
  63300. m ? (this.frameIndex++, r = m.sample.pts, i = d += m.length) : d = p
  63301. } else n.canParse(e, d) ? (u = n.getID3Data(e, d), h.samples.push({
  63302. pts: r,
  63303. dts: r,
  63304. data: u
  63305. }), i = d += u.length) : d++;
  63306. if (d === p && i !== p) {
  63307. var g = Object(o.sliceUint8)(e, i);
  63308. this.cachedData ? this.cachedData = Object(s.appendUint8Array)(this.cachedData, g) : this
  63309. .cachedData = g
  63310. }
  63311. }
  63312. return {
  63313. audioTrack: c,
  63314. videoTrack: Object(a.dummyTrack)(),
  63315. id3Track: h,
  63316. textTrack: Object(a.dummyTrack)()
  63317. }
  63318. }, t.demuxSampleAes = function(e, t, i) {
  63319. return Promise.reject(new Error("[" + this +
  63320. "] This demuxer does not support Sample-AES decryption"))
  63321. }, t.flush = function(e) {
  63322. var t = this.cachedData;
  63323. return t && (this.cachedData = null, this.demux(t, 0)), this.frameIndex = 0, {
  63324. audioTrack: this._audioTrack,
  63325. videoTrack: Object(a.dummyTrack)(),
  63326. id3Track: this._id3Track,
  63327. textTrack: Object(a.dummyTrack)()
  63328. }
  63329. }, t.destroy = function() {}, e
  63330. }(),
  63331. l = function(e, t) {
  63332. return Object(r.isFiniteNumber)(e) ? 90 * e : 9e4 * t
  63333. };
  63334. t.default = u
  63335. },
  63336. "./src/demux/chunk-cache.ts": function(e, t, i) {
  63337. "use strict";
  63338. i.r(t), i.d(t, "default", function() {
  63339. return r
  63340. });
  63341. var r = function() {
  63342. function e() {
  63343. this.chunks = [], this.dataLength = 0
  63344. }
  63345. var t = e.prototype;
  63346. return t.push = function(e) {
  63347. this.chunks.push(e), this.dataLength += e.length
  63348. }, t.flush = function() {
  63349. var e, t = this.chunks,
  63350. i = this.dataLength;
  63351. return t.length ? (e = 1 === t.length ? t[0] : function(e, t) {
  63352. for (var i = new Uint8Array(t), r = 0, n = 0; n < e.length; n++) {
  63353. var a = e[n];
  63354. i.set(a, r), r += a.length
  63355. }
  63356. return i
  63357. }(t, i), this.reset(), e) : new Uint8Array(0)
  63358. }, t.reset = function() {
  63359. this.chunks.length = 0, this.dataLength = 0
  63360. }, e
  63361. }()
  63362. },
  63363. "./src/demux/dummy-demuxed-track.ts": function(e, t, i) {
  63364. "use strict";
  63365. function r(e, t) {
  63366. return void 0 === e && (e = ""), void 0 === t && (t = 9e4), {
  63367. type: e,
  63368. id: -1,
  63369. pid: -1,
  63370. inputTimeScale: t,
  63371. sequenceNumber: -1,
  63372. samples: [],
  63373. dropped: 0
  63374. }
  63375. }
  63376. i.r(t), i.d(t, "dummyTrack", function() {
  63377. return r
  63378. })
  63379. },
  63380. "./src/demux/exp-golomb.ts": function(e, t, i) {
  63381. "use strict";
  63382. i.r(t);
  63383. var r = i("./src/utils/logger.ts"),
  63384. n = function() {
  63385. function e(e) {
  63386. this.data = void 0, this.bytesAvailable = void 0, this.word = void 0, this.bitsAvailable = void 0,
  63387. this.data = e, this.bytesAvailable = e.byteLength, this.word = 0, this.bitsAvailable = 0
  63388. }
  63389. var t = e.prototype;
  63390. return t.loadWord = function() {
  63391. var e = this.data,
  63392. t = this.bytesAvailable,
  63393. i = e.byteLength - t,
  63394. r = new Uint8Array(4),
  63395. n = Math.min(4, t);
  63396. if (0 === n) throw new Error("no bytes available");
  63397. r.set(e.subarray(i, i + n)), this.word = new DataView(r.buffer).getUint32(0), this
  63398. .bitsAvailable = 8 * n, this.bytesAvailable -= n
  63399. }, t.skipBits = function(e) {
  63400. var t;
  63401. this.bitsAvailable > e ? (this.word <<= e, this.bitsAvailable -= e) : (e -= this.bitsAvailable,
  63402. e -= (t = e >> 3) >> 3, this.bytesAvailable -= t, this.loadWord(), this.word <<= e, this
  63403. .bitsAvailable -= e)
  63404. }, t.readBits = function(e) {
  63405. var t = Math.min(this.bitsAvailable, e),
  63406. i = this.word >>> 32 - t;
  63407. return e > 32 && r.logger.error("Cannot read more than 32 bits at a time"), this
  63408. .bitsAvailable -= t, this.bitsAvailable > 0 ? this.word <<= t : this.bytesAvailable > 0 &&
  63409. this.loadWord(), (t = e - t) > 0 && this.bitsAvailable ? i << t | this.readBits(t) : i
  63410. }, t.skipLZ = function() {
  63411. var e;
  63412. for (e = 0; e < this.bitsAvailable; ++e)
  63413. if (0 != (this.word & 2147483648 >>> e)) return this.word <<= e, this.bitsAvailable -= e, e;
  63414. return this.loadWord(), e + this.skipLZ()
  63415. }, t.skipUEG = function() {
  63416. this.skipBits(1 + this.skipLZ())
  63417. }, t.skipEG = function() {
  63418. this.skipBits(1 + this.skipLZ())
  63419. }, t.readUEG = function() {
  63420. var e = this.skipLZ();
  63421. return this.readBits(e + 1) - 1
  63422. }, t.readEG = function() {
  63423. var e = this.readUEG();
  63424. return 1 & e ? 1 + e >>> 1 : -1 * (e >>> 1)
  63425. }, t.readBoolean = function() {
  63426. return 1 === this.readBits(1)
  63427. }, t.readUByte = function() {
  63428. return this.readBits(8)
  63429. }, t.readUShort = function() {
  63430. return this.readBits(16)
  63431. }, t.readUInt = function() {
  63432. return this.readBits(32)
  63433. }, t.skipScalingList = function(e) {
  63434. for (var t = 8, i = 8, r = 0; r < e; r++) 0 !== i && (i = (t + this.readEG() + 256) % 256), t =
  63435. 0 === i ? t : i
  63436. }, t.readSPS = function() {
  63437. var e, t, i, r = 0,
  63438. n = 0,
  63439. a = 0,
  63440. s = 0,
  63441. o = this.readUByte.bind(this),
  63442. u = this.readBits.bind(this),
  63443. l = this.readUEG.bind(this),
  63444. d = this.readBoolean.bind(this),
  63445. c = this.skipBits.bind(this),
  63446. h = this.skipEG.bind(this),
  63447. f = this.skipUEG.bind(this),
  63448. p = this.skipScalingList.bind(this);
  63449. o();
  63450. var m = o();
  63451. if (u(5), c(3), o(), f(), 100 === m || 110 === m || 122 === m || 244 === m || 44 === m || 83 ===
  63452. m || 86 === m || 118 === m || 128 === m) {
  63453. var g = l();
  63454. if (3 === g && c(1), f(), f(), c(1), d())
  63455. for (t = 3 !== g ? 8 : 12, i = 0; i < t; i++) d() && p(i < 6 ? 16 : 64)
  63456. }
  63457. f();
  63458. var v = l();
  63459. if (0 === v) l();
  63460. else if (1 === v)
  63461. for (c(1), h(), h(), e = l(), i = 0; i < e; i++) h();
  63462. f(), c(1);
  63463. var y = l(),
  63464. _ = l(),
  63465. b = u(1);
  63466. 0 === b && c(1), c(1), d() && (r = l(), n = l(), a = l(), s = l());
  63467. var w = [1, 1];
  63468. if (d() && d()) switch (o()) {
  63469. case 1:
  63470. w = [1, 1];
  63471. break;
  63472. case 2:
  63473. w = [12, 11];
  63474. break;
  63475. case 3:
  63476. w = [10, 11];
  63477. break;
  63478. case 4:
  63479. w = [16, 11];
  63480. break;
  63481. case 5:
  63482. w = [40, 33];
  63483. break;
  63484. case 6:
  63485. w = [24, 11];
  63486. break;
  63487. case 7:
  63488. w = [20, 11];
  63489. break;
  63490. case 8:
  63491. w = [32, 11];
  63492. break;
  63493. case 9:
  63494. w = [80, 33];
  63495. break;
  63496. case 10:
  63497. w = [18, 11];
  63498. break;
  63499. case 11:
  63500. w = [15, 11];
  63501. break;
  63502. case 12:
  63503. w = [64, 33];
  63504. break;
  63505. case 13:
  63506. w = [160, 99];
  63507. break;
  63508. case 14:
  63509. w = [4, 3];
  63510. break;
  63511. case 15:
  63512. w = [3, 2];
  63513. break;
  63514. case 16:
  63515. w = [2, 1];
  63516. break;
  63517. case 255:
  63518. w = [o() << 8 | o(), o() << 8 | o()]
  63519. }
  63520. return {
  63521. width: Math.ceil(16 * (y + 1) - 2 * r - 2 * n),
  63522. height: (2 - b) * (_ + 1) * 16 - (b ? 2 : 4) * (a + s),
  63523. pixelRatio: w
  63524. }
  63525. }, t.readSliceType = function() {
  63526. return this.readUByte(), this.readUEG(), this.readUEG()
  63527. }, e
  63528. }();
  63529. t.default = n
  63530. },
  63531. "./src/demux/id3.ts": function(e, t, i) {
  63532. "use strict";
  63533. i.r(t), i.d(t, "isHeader", function() {
  63534. return n
  63535. }), i.d(t, "isFooter", function() {
  63536. return a
  63537. }), i.d(t, "getID3Data", function() {
  63538. return s
  63539. }), i.d(t, "canParse", function() {
  63540. return u
  63541. }), i.d(t, "getTimeStamp", function() {
  63542. return l
  63543. }), i.d(t, "isTimeStampFrame", function() {
  63544. return d
  63545. }), i.d(t, "getID3Frames", function() {
  63546. return h
  63547. }), i.d(t, "decodeFrame", function() {
  63548. return f
  63549. }), i.d(t, "utf8ArrayToStr", function() {
  63550. return y
  63551. }), i.d(t, "testables", function() {
  63552. return _
  63553. });
  63554. var r, n = function(e, t) {
  63555. return t + 10 <= e.length && 73 === e[t] && 68 === e[t + 1] && 51 === e[t + 2] && e[t + 3] < 255 &&
  63556. e[t + 4] < 255 && e[t + 6] < 128 && e[t + 7] < 128 && e[t + 8] < 128 && e[t + 9] < 128
  63557. },
  63558. a = function(e, t) {
  63559. return t + 10 <= e.length && 51 === e[t] && 68 === e[t + 1] && 73 === e[t + 2] && e[t + 3] < 255 &&
  63560. e[t + 4] < 255 && e[t + 6] < 128 && e[t + 7] < 128 && e[t + 8] < 128 && e[t + 9] < 128
  63561. },
  63562. s = function(e, t) {
  63563. for (var i = t, r = 0; n(e, t);) {
  63564. r += 10, r += o(e, t + 6), a(e, t + 10) && (r += 10), t += r
  63565. }
  63566. if (r > 0) return e.subarray(i, i + r)
  63567. },
  63568. o = function(e, t) {
  63569. var i = 0;
  63570. return i = (127 & e[t]) << 21, i |= (127 & e[t + 1]) << 14, i |= (127 & e[t + 2]) << 7, i |= 127 &
  63571. e[t + 3]
  63572. },
  63573. u = function(e, t) {
  63574. return n(e, t) && o(e, t + 6) + 10 <= e.length - t
  63575. },
  63576. l = function(e) {
  63577. for (var t = h(e), i = 0; i < t.length; i++) {
  63578. var r = t[i];
  63579. if (d(r)) return v(r)
  63580. }
  63581. },
  63582. d = function(e) {
  63583. return e && "PRIV" === e.key && "com.apple.streaming.transportStreamTimestamp" === e.info
  63584. },
  63585. c = function(e) {
  63586. var t = String.fromCharCode(e[0], e[1], e[2], e[3]),
  63587. i = o(e, 4);
  63588. return {
  63589. type: t,
  63590. size: i,
  63591. data: e.subarray(10, 10 + i)
  63592. }
  63593. },
  63594. h = function(e) {
  63595. for (var t = 0, i = []; n(e, t);) {
  63596. for (var r = o(e, t + 6), s = (t += 10) + r; t + 8 < s;) {
  63597. var u = c(e.subarray(t)),
  63598. l = f(u);
  63599. l && i.push(l), t += u.size + 10
  63600. }
  63601. a(e, t) && (t += 10)
  63602. }
  63603. return i
  63604. },
  63605. f = function(e) {
  63606. return "PRIV" === e.type ? p(e) : "W" === e.type[0] ? g(e) : m(e)
  63607. },
  63608. p = function(e) {
  63609. if (!(e.size < 2)) {
  63610. var t = y(e.data, !0),
  63611. i = new Uint8Array(e.data.subarray(t.length + 1));
  63612. return {
  63613. key: e.type,
  63614. info: t,
  63615. data: i.buffer
  63616. }
  63617. }
  63618. },
  63619. m = function(e) {
  63620. if (!(e.size < 2)) {
  63621. if ("TXXX" === e.type) {
  63622. var t = 1,
  63623. i = y(e.data.subarray(t), !0);
  63624. t += i.length + 1;
  63625. var r = y(e.data.subarray(t));
  63626. return {
  63627. key: e.type,
  63628. info: i,
  63629. data: r
  63630. }
  63631. }
  63632. var n = y(e.data.subarray(1));
  63633. return {
  63634. key: e.type,
  63635. data: n
  63636. }
  63637. }
  63638. },
  63639. g = function(e) {
  63640. if ("WXXX" === e.type) {
  63641. if (e.size < 2) return;
  63642. var t = 1,
  63643. i = y(e.data.subarray(t), !0);
  63644. t += i.length + 1;
  63645. var r = y(e.data.subarray(t));
  63646. return {
  63647. key: e.type,
  63648. info: i,
  63649. data: r
  63650. }
  63651. }
  63652. var n = y(e.data);
  63653. return {
  63654. key: e.type,
  63655. data: n
  63656. }
  63657. },
  63658. v = function(e) {
  63659. if (8 === e.data.byteLength) {
  63660. var t = new Uint8Array(e.data),
  63661. i = 1 & t[3],
  63662. r = (t[4] << 23) + (t[5] << 15) + (t[6] << 7) + t[7];
  63663. return r /= 45, i && (r += 47721858.84), Math.round(r)
  63664. }
  63665. },
  63666. y = function(e, t) {
  63667. void 0 === t && (t = !1);
  63668. var i = b();
  63669. if (i) {
  63670. var r = i.decode(e);
  63671. if (t) {
  63672. var n = r.indexOf("\0");
  63673. return -1 !== n ? r.substring(0, n) : r
  63674. }
  63675. return r.replace(/\0/g, "")
  63676. }
  63677. for (var a, s, o, u = e.length, l = "", d = 0; d < u;) {
  63678. if (0 === (a = e[d++]) && t) return l;
  63679. if (0 !== a && 3 !== a) switch (a >> 4) {
  63680. case 0:
  63681. case 1:
  63682. case 2:
  63683. case 3:
  63684. case 4:
  63685. case 5:
  63686. case 6:
  63687. case 7:
  63688. l += String.fromCharCode(a);
  63689. break;
  63690. case 12:
  63691. case 13:
  63692. s = e[d++], l += String.fromCharCode((31 & a) << 6 | 63 & s);
  63693. break;
  63694. case 14:
  63695. s = e[d++], o = e[d++], l += String.fromCharCode((15 & a) << 12 | (63 & s) << 6 | (63 &
  63696. o) << 0)
  63697. }
  63698. }
  63699. return l
  63700. },
  63701. _ = {
  63702. decodeTextFrame: m
  63703. };
  63704. function b() {
  63705. return r || void 0 === self.TextDecoder || (r = new self.TextDecoder("utf-8")), r
  63706. }
  63707. },
  63708. "./src/demux/mp3demuxer.ts": function(e, t, i) {
  63709. "use strict";
  63710. i.r(t);
  63711. var r = i("./src/demux/base-audio-demuxer.ts"),
  63712. n = i("./src/demux/id3.ts"),
  63713. a = i("./src/utils/logger.ts"),
  63714. s = i("./src/demux/mpegaudio.ts");
  63715. function o(e, t) {
  63716. return (o = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  63717. return e.__proto__ = t, e
  63718. })(e, t)
  63719. }
  63720. var u = function(e) {
  63721. var t, i;
  63722. function r() {
  63723. return e.apply(this, arguments) || this
  63724. }
  63725. i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, o(t, i);
  63726. var u = r.prototype;
  63727. return u.resetInitSegment = function(t, i, r, n) {
  63728. e.prototype.resetInitSegment.call(this, t, i, r, n), this._audioTrack = {
  63729. container: "audio/mpeg",
  63730. type: "audio",
  63731. id: 2,
  63732. pid: -1,
  63733. sequenceNumber: 0,
  63734. segmentCodec: "mp3",
  63735. samples: [],
  63736. manifestCodec: i,
  63737. duration: n,
  63738. inputTimeScale: 9e4,
  63739. dropped: 0
  63740. }
  63741. }, r.probe = function(e) {
  63742. if (!e) return !1;
  63743. for (var t = (n.getID3Data(e, 0) || []).length, i = e.length; t < i; t++)
  63744. if (s.probe(e, t)) return a.logger.log("MPEG Audio sync word found !"), !0;
  63745. return !1
  63746. }, u.canParse = function(e, t) {
  63747. return s.canParse(e, t)
  63748. }, u.appendFrame = function(e, t, i) {
  63749. if (null !== this.initPTS) return s.appendFrame(e, t, i, this.initPTS, this.frameIndex)
  63750. }, r
  63751. }(r.default);
  63752. u.minProbeByteLength = 4, t.default = u
  63753. },
  63754. "./src/demux/mp4demuxer.ts": function(e, t, i) {
  63755. "use strict";
  63756. i.r(t);
  63757. var r = i("./src/polyfills/number.ts"),
  63758. n = i("./src/utils/mp4-tools.ts"),
  63759. a = i("./src/demux/dummy-demuxed-track.ts"),
  63760. s = /\/emsg[-/]ID3/i,
  63761. o = function() {
  63762. function e(e, t) {
  63763. this.remainderData = null, this.timeOffset = 0, this.config = void 0, this.videoTrack = void 0,
  63764. this.audioTrack = void 0, this.id3Track = void 0, this.txtTrack = void 0, this.config = t
  63765. }
  63766. var t = e.prototype;
  63767. return t.resetTimeStamp = function() {}, t.resetInitSegment = function(e, t, i, r) {
  63768. var s = Object(n.parseInitSegment)(e),
  63769. o = this.videoTrack = Object(a.dummyTrack)("video", 1),
  63770. u = this.audioTrack = Object(a.dummyTrack)("audio", 1),
  63771. l = this.txtTrack = Object(a.dummyTrack)("text", 1);
  63772. if (this.id3Track = Object(a.dummyTrack)("id3", 1), this.timeOffset = 0, s.video) {
  63773. var d = s.video,
  63774. c = d.id,
  63775. h = d.timescale,
  63776. f = d.codec;
  63777. o.id = c, o.timescale = l.timescale = h, o.codec = f
  63778. }
  63779. if (s.audio) {
  63780. var p = s.audio,
  63781. m = p.id,
  63782. g = p.timescale,
  63783. v = p.codec;
  63784. u.id = m, u.timescale = g, u.codec = v
  63785. }
  63786. l.id = n.RemuxerTrackIdConfig.text, o.sampleDuration = 0, o.duration = u.duration = r
  63787. }, t.resetContiguity = function() {}, e.probe = function(e) {
  63788. return e = e.length > 16384 ? e.subarray(0, 16384) : e, Object(n.findBox)(e, ["moof"]).length >
  63789. 0
  63790. }, t.demux = function(e, t) {
  63791. this.timeOffset = t;
  63792. var i = e,
  63793. r = this.videoTrack,
  63794. a = this.txtTrack;
  63795. if (this.config.progressive) {
  63796. this.remainderData && (i = Object(n.appendUint8Array)(this.remainderData, e));
  63797. var s = Object(n.segmentValidRange)(i);
  63798. this.remainderData = s.remainder, r.samples = s.valid || new Uint8Array
  63799. } else r.samples = i;
  63800. var o = this.extractID3Track(r, t);
  63801. return a.samples = Object(n.parseSamples)(t, r), {
  63802. videoTrack: r,
  63803. audioTrack: this.audioTrack,
  63804. id3Track: o,
  63805. textTrack: this.txtTrack
  63806. }
  63807. }, t.flush = function() {
  63808. var e = this.timeOffset,
  63809. t = this.videoTrack,
  63810. i = this.txtTrack;
  63811. t.samples = this.remainderData || new Uint8Array, this.remainderData = null;
  63812. var r = this.extractID3Track(t, this.timeOffset);
  63813. return i.samples = Object(n.parseSamples)(e, t), {
  63814. videoTrack: t,
  63815. audioTrack: Object(a.dummyTrack)(),
  63816. id3Track: r,
  63817. textTrack: Object(a.dummyTrack)()
  63818. }
  63819. }, t.extractID3Track = function(e, t) {
  63820. var i = this.id3Track;
  63821. if (e.samples.length) {
  63822. var a = Object(n.findBox)(e.samples, ["emsg"]);
  63823. a && a.forEach(function(e) {
  63824. var a = Object(n.parseEmsg)(e);
  63825. if (s.test(a.schemeIdUri)) {
  63826. var o = Object(r.isFiniteNumber)(a.presentationTime) ? a.presentationTime / a
  63827. .timeScale : t + a.presentationTimeDelta / a.timeScale,
  63828. u = a.payload;
  63829. i.samples.push({
  63830. data: u,
  63831. len: u.byteLength,
  63832. dts: o,
  63833. pts: o
  63834. })
  63835. }
  63836. })
  63837. }
  63838. return i
  63839. }, t.demuxSampleAes = function(e, t, i) {
  63840. return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))
  63841. }, t.destroy = function() {}, e
  63842. }();
  63843. o.minProbeByteLength = 1024, t.default = o
  63844. },
  63845. "./src/demux/mpegaudio.ts": function(e, t, i) {
  63846. "use strict";
  63847. i.r(t), i.d(t, "appendFrame", function() {
  63848. return u
  63849. }), i.d(t, "parseHeader", function() {
  63850. return l
  63851. }), i.d(t, "isHeaderPattern", function() {
  63852. return d
  63853. }), i.d(t, "isHeader", function() {
  63854. return c
  63855. }), i.d(t, "canParse", function() {
  63856. return h
  63857. }), i.d(t, "probe", function() {
  63858. return f
  63859. });
  63860. var r = null,
  63861. n = [32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 32, 48, 56, 64, 80, 96, 112,
  63862. 128, 160, 192, 224, 256, 320, 384, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320,
  63863. 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 8, 16, 24, 32, 40, 48, 56, 64, 80,
  63864. 96, 112, 128, 144, 160
  63865. ],
  63866. a = [44100, 48e3, 32e3, 22050, 24e3, 16e3, 11025, 12e3, 8e3],
  63867. s = [
  63868. [0, 72, 144, 12],
  63869. [0, 0, 0, 0],
  63870. [0, 72, 144, 12],
  63871. [0, 144, 144, 12]
  63872. ],
  63873. o = [0, 1, 1, 4];
  63874. function u(e, t, i, r, n) {
  63875. if (!(i + 24 > t.length)) {
  63876. var a = l(t, i);
  63877. if (a && i + a.frameLength <= t.length) {
  63878. var s = r + n * (9e4 * a.samplesPerFrame / a.sampleRate),
  63879. o = {
  63880. unit: t.subarray(i, i + a.frameLength),
  63881. pts: s,
  63882. dts: s
  63883. };
  63884. return e.config = [], e.channelCount = a.channelCount, e.samplerate = a.sampleRate, e.samples
  63885. .push(o), {
  63886. sample: o,
  63887. length: a.frameLength,
  63888. missing: 0
  63889. }
  63890. }
  63891. }
  63892. }
  63893. function l(e, t) {
  63894. var i = e[t + 1] >> 3 & 3,
  63895. u = e[t + 1] >> 1 & 3,
  63896. l = e[t + 2] >> 4 & 15,
  63897. d = e[t + 2] >> 2 & 3;
  63898. if (1 !== i && 0 !== l && 15 !== l && 3 !== d) {
  63899. var c = e[t + 2] >> 1 & 1,
  63900. h = e[t + 3] >> 6,
  63901. f = 1e3 * n[14 * (3 === i ? 3 - u : 3 === u ? 3 : 4) + l - 1],
  63902. p = a[3 * (3 === i ? 0 : 2 === i ? 1 : 2) + d],
  63903. m = 3 === h ? 1 : 2,
  63904. g = s[i][u],
  63905. v = o[u],
  63906. y = 8 * g * v,
  63907. _ = Math.floor(g * f / p + c) * v;
  63908. if (null === r) {
  63909. var b = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
  63910. r = b ? parseInt(b[1]) : 0
  63911. }
  63912. return !!r && r <= 87 && 2 === u && f >= 224e3 && 0 === h && (e[t + 3] = 128 | e[t + 3]), {
  63913. sampleRate: p,
  63914. channelCount: m,
  63915. frameLength: _,
  63916. samplesPerFrame: y
  63917. }
  63918. }
  63919. }
  63920. function d(e, t) {
  63921. return 255 === e[t] && 224 == (224 & e[t + 1]) && 0 != (6 & e[t + 1])
  63922. }
  63923. function c(e, t) {
  63924. return t + 1 < e.length && d(e, t)
  63925. }
  63926. function h(e, t) {
  63927. return d(e, t) && 4 <= e.length - t
  63928. }
  63929. function f(e, t) {
  63930. if (t + 1 < e.length && d(e, t)) {
  63931. var i = l(e, t),
  63932. r = 4;
  63933. null !== i && void 0 !== i && i.frameLength && (r = i.frameLength);
  63934. var n = t + r;
  63935. return n === e.length || c(e, n)
  63936. }
  63937. return !1
  63938. }
  63939. },
  63940. "./src/demux/sample-aes.ts": function(e, t, i) {
  63941. "use strict";
  63942. i.r(t);
  63943. var r = i("./src/crypt/decrypter.ts"),
  63944. n = i("./src/demux/tsdemuxer.ts"),
  63945. a = function() {
  63946. function e(e, t, i) {
  63947. this.keyData = void 0, this.decrypter = void 0, this.keyData = i, this.decrypter = new r.default(
  63948. e, t, {
  63949. removePKCS7Padding: !1
  63950. })
  63951. }
  63952. var t = e.prototype;
  63953. return t.decryptBuffer = function(e, t) {
  63954. this.decrypter.decrypt(e, this.keyData.key.buffer, this.keyData.iv.buffer, t)
  63955. }, t.decryptAacSample = function(e, t, i, r) {
  63956. var n = e[t].unit;
  63957. if (!(n.length <= 16)) {
  63958. var a = n.subarray(16, n.length - n.length % 16),
  63959. s = a.buffer.slice(a.byteOffset, a.byteOffset + a.length),
  63960. o = this;
  63961. this.decryptBuffer(s, function(a) {
  63962. var s = new Uint8Array(a);
  63963. n.set(s, 16), r || o.decryptAacSamples(e, t + 1, i)
  63964. })
  63965. }
  63966. }, t.decryptAacSamples = function(e, t, i) {
  63967. for (;; t++) {
  63968. if (t >= e.length) return void i();
  63969. if (!(e[t].unit.length < 32)) {
  63970. var r = this.decrypter.isSync();
  63971. if (this.decryptAacSample(e, t, i, r), !r) return
  63972. }
  63973. }
  63974. }, t.getAvcEncryptedData = function(e) {
  63975. for (var t = 16 * Math.floor((e.length - 48) / 160) + 16, i = new Int8Array(t), r = 0, n =
  63976. 32; n < e.length - 16; n += 160, r += 16) i.set(e.subarray(n, n + 16), r);
  63977. return i
  63978. }, t.getAvcDecryptedUnit = function(e, t) {
  63979. for (var i = new Uint8Array(t), r = 0, n = 32; n < e.length - 16; n += 160, r += 16) e.set(i
  63980. .subarray(r, r + 16), n);
  63981. return e
  63982. }, t.decryptAvcSample = function(e, t, i, r, a, s) {
  63983. var o = Object(n.discardEPB)(a.data),
  63984. u = this.getAvcEncryptedData(o),
  63985. l = this;
  63986. this.decryptBuffer(u.buffer, function(n) {
  63987. a.data = l.getAvcDecryptedUnit(o, n), s || l.decryptAvcSamples(e, t, i + 1, r)
  63988. })
  63989. }, t.decryptAvcSamples = function(e, t, i, r) {
  63990. if (e instanceof Uint8Array) throw new Error("Cannot decrypt samples of type Uint8Array");
  63991. for (;; t++, i = 0) {
  63992. if (t >= e.length) return void r();
  63993. for (var n = e[t].units; !(i >= n.length); i++) {
  63994. var a = n[i];
  63995. if (!(a.data.length <= 48 || 1 !== a.type && 5 !== a.type)) {
  63996. var s = this.decrypter.isSync();
  63997. if (this.decryptAvcSample(e, t, i, r, a, s), !s) return
  63998. }
  63999. }
  64000. }
  64001. }, e
  64002. }();
  64003. t.default = a
  64004. },
  64005. "./src/demux/transmuxer-interface.ts": function(e, t, i) {
  64006. "use strict";
  64007. i.r(t), i.d(t, "default", function() {
  64008. return c
  64009. });
  64010. var r = i("./node_modules/webworkify-webpack/index.js"),
  64011. n = i("./src/events.ts"),
  64012. a = i("./src/demux/transmuxer.ts"),
  64013. s = i("./src/utils/logger.ts"),
  64014. o = i("./src/errors.ts"),
  64015. u = i("./src/utils/mediasource-helper.ts"),
  64016. l = i("./node_modules/eventemitter3/index.js"),
  64017. d = Object(u.getMediaSource)() || {
  64018. isTypeSupported: function() {
  64019. return !1
  64020. }
  64021. },
  64022. c = function() {
  64023. function e(e, t, i, u) {
  64024. var c = this;
  64025. this.hls = void 0, this.id = void 0, this.observer = void 0, this.frag = null, this.part = null,
  64026. this.worker = void 0, this.onwmsg = void 0, this.transmuxer = null, this.onTransmuxComplete =
  64027. void 0, this.onFlush = void 0, this.hls = e, this.id = t, this.onTransmuxComplete = i, this
  64028. .onFlush = u;
  64029. var h = e.config,
  64030. f = function(t, i) {
  64031. (i = i || {}).frag = c.frag, i.id = c.id, e.trigger(t, i)
  64032. };
  64033. this.observer = new l.EventEmitter, this.observer.on(n.Events.FRAG_DECRYPTED, f), this.observer
  64034. .on(n.Events.ERROR, f);
  64035. var p = {
  64036. mp4: d.isTypeSupported("video/mp4"),
  64037. mpeg: d.isTypeSupported("audio/mpeg"),
  64038. mp3: d.isTypeSupported('audio/mp4; codecs="mp3"')
  64039. },
  64040. m = navigator.vendor;
  64041. if (h.enableWorker && "undefined" != typeof Worker) {
  64042. var g;
  64043. s.logger.log("demuxing in webworker");
  64044. try {
  64045. g = this.worker = r("./src/demux/transmuxer-worker.ts"), this.onwmsg = this.onWorkerMessage
  64046. .bind(this), g.addEventListener("message", this.onwmsg), g.onerror = function(t) {
  64047. e.trigger(n.Events.ERROR, {
  64048. type: o.ErrorTypes.OTHER_ERROR,
  64049. details: o.ErrorDetails.INTERNAL_EXCEPTION,
  64050. fatal: !0,
  64051. event: "demuxerWorker",
  64052. error: new Error(t.message + " (" + t.filename + ":" + t.lineno + ")")
  64053. })
  64054. }, g.postMessage({
  64055. cmd: "init",
  64056. typeSupported: p,
  64057. vendor: m,
  64058. id: t,
  64059. config: JSON.stringify(h)
  64060. })
  64061. } catch (e) {
  64062. s.logger.warn("Error in worker:", e), s.logger.error(
  64063. "Error while initializing DemuxerWorker, fallback to inline"), g && self.URL
  64064. .revokeObjectURL(g.objectURL), this.transmuxer = new a.default(this.observer, p, h, m, t),
  64065. this.worker = null
  64066. }
  64067. } else this.transmuxer = new a.default(this.observer, p, h, m, t)
  64068. }
  64069. var t = e.prototype;
  64070. return t.destroy = function() {
  64071. var e = this.worker;
  64072. if (e) e.removeEventListener("message", this.onwmsg), e.terminate(), this.worker = null;
  64073. else {
  64074. var t = this.transmuxer;
  64075. t && (t.destroy(), this.transmuxer = null)
  64076. }
  64077. var i = this.observer;
  64078. i && i.removeAllListeners(), this.observer = null
  64079. }, t.push = function(e, t, i, r, n, o, u, l, d, c) {
  64080. var h, f, p = this;
  64081. d.transmuxing.start = self.performance.now();
  64082. var m = this.transmuxer,
  64083. g = this.worker,
  64084. v = o ? o.start : n.start,
  64085. y = n.decryptdata,
  64086. _ = this.frag,
  64087. b = !(_ && n.cc === _.cc),
  64088. w = !(_ && d.level === _.level),
  64089. E = _ ? d.sn - _.sn : -1,
  64090. T = this.part ? d.part - this.part.index : 1,
  64091. S = !w && (1 === E || 0 === E && 1 === T),
  64092. A = self.performance.now();
  64093. (w || E || 0 === n.stats.parsing.start) && (n.stats.parsing.start = A), !o || !T && S || (o
  64094. .stats.parsing.start = A);
  64095. var k = !(_ && (null === (h = n.initSegment) || void 0 === h ? void 0 : h.url) === (null === (
  64096. f = _.initSegment) || void 0 === f ? void 0 : f.url)),
  64097. R = new a.TransmuxState(b, S, l, w, v, k);
  64098. if (!S || b || k) {
  64099. s.logger.log("[transmuxer-interface, " + n.type +
  64100. "]: Starting new transmux session for sn: " + d.sn + " p: " + d.part + " level: " + d
  64101. .level + " id: " + d.id + "\n discontinuity: " + b + "\n trackSwitch: " +
  64102. w + "\n contiguous: " + S + "\n accurateTimeOffset: " + l +
  64103. "\n timeOffset: " + v + "\n initSegmentChange: " + k);
  64104. var M = new a.TransmuxConfig(i, r, t, u, c);
  64105. this.configureTransmuxer(M)
  64106. }
  64107. if (this.frag = n, this.part = o, g) g.postMessage({
  64108. cmd: "demux",
  64109. data: e,
  64110. decryptdata: y,
  64111. chunkMeta: d,
  64112. state: R
  64113. }, e instanceof ArrayBuffer ? [e] : []);
  64114. else if (m) {
  64115. var O = m.push(e, y, d, R);
  64116. Object(a.isPromise)(O) ? O.then(function(e) {
  64117. p.handleTransmuxComplete(e)
  64118. }) : this.handleTransmuxComplete(O)
  64119. }
  64120. }, t.flush = function(e) {
  64121. var t = this;
  64122. e.transmuxing.start = self.performance.now();
  64123. var i = this.transmuxer,
  64124. r = this.worker;
  64125. if (r) r.postMessage({
  64126. cmd: "flush",
  64127. chunkMeta: e
  64128. });
  64129. else if (i) {
  64130. var n = i.flush(e);
  64131. Object(a.isPromise)(n) ? n.then(function(i) {
  64132. t.handleFlushResult(i, e)
  64133. }) : this.handleFlushResult(n, e)
  64134. }
  64135. }, t.handleFlushResult = function(e, t) {
  64136. var i = this;
  64137. e.forEach(function(e) {
  64138. i.handleTransmuxComplete(e)
  64139. }), this.onFlush(t)
  64140. }, t.onWorkerMessage = function(e) {
  64141. var t = e.data,
  64142. i = this.hls;
  64143. switch (t.event) {
  64144. case "init":
  64145. self.URL.revokeObjectURL(this.worker.objectURL);
  64146. break;
  64147. case "transmuxComplete":
  64148. this.handleTransmuxComplete(t.data);
  64149. break;
  64150. case "flush":
  64151. this.onFlush(t.data);
  64152. break;
  64153. default:
  64154. t.data = t.data || {}, t.data.frag = this.frag, t.data.id = this.id, i.trigger(t.event, t
  64155. .data)
  64156. }
  64157. }, t.configureTransmuxer = function(e) {
  64158. var t = this.worker,
  64159. i = this.transmuxer;
  64160. t ? t.postMessage({
  64161. cmd: "configure",
  64162. config: e
  64163. }) : i && i.configure(e)
  64164. }, t.handleTransmuxComplete = function(e) {
  64165. e.chunkMeta.transmuxing.end = self.performance.now(), this.onTransmuxComplete(e)
  64166. }, e
  64167. }()
  64168. },
  64169. "./src/demux/transmuxer-worker.ts": function(e, t, i) {
  64170. "use strict";
  64171. i.r(t), i.d(t, "default", function() {
  64172. return o
  64173. });
  64174. var r = i("./src/demux/transmuxer.ts"),
  64175. n = i("./src/events.ts"),
  64176. a = i("./src/utils/logger.ts"),
  64177. s = i("./node_modules/eventemitter3/index.js");
  64178. function o(e) {
  64179. var t = new s.EventEmitter,
  64180. i = function(t, i) {
  64181. e.postMessage({
  64182. event: t,
  64183. data: i
  64184. })
  64185. };
  64186. t.on(n.Events.FRAG_DECRYPTED, i), t.on(n.Events.ERROR, i), e.addEventListener("message", function(n) {
  64187. var s = n.data;
  64188. switch (s.cmd) {
  64189. case "init":
  64190. var o = JSON.parse(s.config);
  64191. e.transmuxer = new r.default(t, s.typeSupported, o, s.vendor, s.id), Object(a.enableLogs)(o
  64192. .debug), i("init", null);
  64193. break;
  64194. case "configure":
  64195. e.transmuxer.configure(s.config);
  64196. break;
  64197. case "demux":
  64198. var l = e.transmuxer.push(s.data, s.decryptdata, s.chunkMeta, s.state);
  64199. Object(r.isPromise)(l) ? l.then(function(t) {
  64200. u(e, t)
  64201. }) : u(e, l);
  64202. break;
  64203. case "flush":
  64204. var c = s.chunkMeta,
  64205. h = e.transmuxer.flush(c);
  64206. Object(r.isPromise)(h) ? h.then(function(t) {
  64207. d(e, t, c)
  64208. }) : d(e, h, c)
  64209. }
  64210. })
  64211. }
  64212. function u(e, t) {
  64213. if ((i = t.remuxResult).audio || i.video || i.text || i.id3 || i.initSegment) {
  64214. var i, r = [],
  64215. n = t.remuxResult,
  64216. a = n.audio,
  64217. s = n.video;
  64218. a && l(r, a), s && l(r, s), e.postMessage({
  64219. event: "transmuxComplete",
  64220. data: t
  64221. }, r)
  64222. }
  64223. }
  64224. function l(e, t) {
  64225. t.data1 && e.push(t.data1.buffer), t.data2 && e.push(t.data2.buffer)
  64226. }
  64227. function d(e, t, i) {
  64228. t.forEach(function(t) {
  64229. u(e, t)
  64230. }), e.postMessage({
  64231. event: "flush",
  64232. data: i
  64233. })
  64234. }
  64235. },
  64236. "./src/demux/transmuxer.ts": function(e, t, i) {
  64237. "use strict";
  64238. i.r(t), i.d(t, "default", function() {
  64239. return y
  64240. }), i.d(t, "isPromise", function() {
  64241. return b
  64242. }), i.d(t, "TransmuxConfig", function() {
  64243. return w
  64244. }), i.d(t, "TransmuxState", function() {
  64245. return E
  64246. });
  64247. var r, n = i("./src/events.ts"),
  64248. a = i("./src/errors.ts"),
  64249. s = i("./src/crypt/decrypter.ts"),
  64250. o = i("./src/demux/aacdemuxer.ts"),
  64251. u = i("./src/demux/mp4demuxer.ts"),
  64252. l = i("./src/demux/tsdemuxer.ts"),
  64253. d = i("./src/demux/mp3demuxer.ts"),
  64254. c = i("./src/remux/mp4-remuxer.ts"),
  64255. h = i("./src/remux/passthrough-remuxer.ts"),
  64256. f = i("./src/demux/chunk-cache.ts"),
  64257. p = i("./src/utils/mp4-tools.ts"),
  64258. m = i("./src/utils/logger.ts");
  64259. try {
  64260. r = self.performance.now.bind(self.performance)
  64261. } catch (e) {
  64262. m.logger.debug("Unable to use Performance API on this environment"), r = self.Date.now
  64263. }
  64264. var g = [{
  64265. demux: l.default,
  64266. remux: c.default
  64267. }, {
  64268. demux: u.default,
  64269. remux: h.default
  64270. }, {
  64271. demux: o.default,
  64272. remux: c.default
  64273. }, {
  64274. demux: d.default,
  64275. remux: c.default
  64276. }],
  64277. v = 1024;
  64278. g.forEach(function(e) {
  64279. var t = e.demux;
  64280. v = Math.max(v, t.minProbeByteLength)
  64281. });
  64282. var y = function() {
  64283. function e(e, t, i, r, n) {
  64284. this.observer = void 0, this.typeSupported = void 0, this.config = void 0, this.vendor = void 0,
  64285. this.id = void 0, this.demuxer = void 0, this.remuxer = void 0, this.decrypter = void 0, this
  64286. .probe = void 0, this.decryptionPromise = null, this.transmuxConfig = void 0, this
  64287. .currentTransmuxState = void 0, this.cache = new f.default, this.observer = e, this
  64288. .typeSupported = t, this.config = i, this.vendor = r, this.id = n
  64289. }
  64290. var t = e.prototype;
  64291. return t.configure = function(e) {
  64292. this.transmuxConfig = e, this.decrypter && this.decrypter.reset()
  64293. }, t.push = function(e, t, i, n) {
  64294. var a = this,
  64295. s = i.transmuxing;
  64296. s.executeStart = r();
  64297. var o = new Uint8Array(e),
  64298. u = this.cache,
  64299. l = this.config,
  64300. d = this.currentTransmuxState,
  64301. c = this.transmuxConfig;
  64302. n && (this.currentTransmuxState = n);
  64303. var h = function(e, t) {
  64304. var i = null;
  64305. e.byteLength > 0 && null != t && null != t.key && null !== t.iv && null != t.method && (i =
  64306. t);
  64307. return i
  64308. }(o, t);
  64309. if (h && "AES-128" === h.method) {
  64310. var f = this.getDecrypter();
  64311. if (!l.enableSoftwareAES) return this.decryptionPromise = f.webCryptoDecrypt(o, h.key.buffer,
  64312. h.iv.buffer).then(function(e) {
  64313. var t = a.push(e, null, i);
  64314. return a.decryptionPromise = null, t
  64315. }), this.decryptionPromise;
  64316. var m = f.softwareDecrypt(o, h.key.buffer, h.iv.buffer);
  64317. if (!m) return s.executeEnd = r(), _(i);
  64318. o = new Uint8Array(m)
  64319. }
  64320. var g = n || d,
  64321. v = g.contiguous,
  64322. y = g.discontinuity,
  64323. b = g.trackSwitch,
  64324. w = g.accurateTimeOffset,
  64325. E = g.timeOffset,
  64326. T = g.initSegmentChange,
  64327. S = c.audioCodec,
  64328. A = c.videoCodec,
  64329. k = c.defaultInitPts,
  64330. R = c.duration,
  64331. M = c.initSegmentData;
  64332. if ((y || b || T) && this.resetInitSegment(M, S, A, R), (y || T) && this.resetInitialTimestamp(
  64333. k), v || this.resetContiguity(), this.needsProbing(o, y, b)) {
  64334. if (u.dataLength) {
  64335. var O = u.flush();
  64336. o = Object(p.appendUint8Array)(O, o)
  64337. }
  64338. this.configureTransmuxer(o, c)
  64339. }
  64340. var C = this.transmux(o, h, E, w, i),
  64341. D = this.currentTransmuxState;
  64342. return D.contiguous = !0, D.discontinuity = !1, D.trackSwitch = !1, s.executeEnd = r(), C
  64343. }, t.flush = function(e) {
  64344. var t = this,
  64345. i = e.transmuxing;
  64346. i.executeStart = r();
  64347. var s = this.decrypter,
  64348. o = this.cache,
  64349. u = this.currentTransmuxState,
  64350. l = this.decryptionPromise;
  64351. if (l) return l.then(function() {
  64352. return t.flush(e)
  64353. });
  64354. var d = [],
  64355. c = u.timeOffset;
  64356. if (s) {
  64357. var h = s.flush();
  64358. h && d.push(this.push(h, null, e))
  64359. }
  64360. var f = o.dataLength;
  64361. o.reset();
  64362. var p = this.demuxer,
  64363. m = this.remuxer;
  64364. if (!p || !m) return f >= v && this.observer.emit(n.Events.ERROR, n.Events.ERROR, {
  64365. type: a.ErrorTypes.MEDIA_ERROR,
  64366. details: a.ErrorDetails.FRAG_PARSING_ERROR,
  64367. fatal: !0,
  64368. reason: "no demux matching with content found"
  64369. }), i.executeEnd = r(), [_(e)];
  64370. var g = p.flush(c);
  64371. return b(g) ? g.then(function(i) {
  64372. return t.flushRemux(d, i, e), d
  64373. }) : (this.flushRemux(d, g, e), d)
  64374. }, t.flushRemux = function(e, t, i) {
  64375. var n = t.audioTrack,
  64376. a = t.videoTrack,
  64377. s = t.id3Track,
  64378. o = t.textTrack,
  64379. u = this.currentTransmuxState,
  64380. l = u.accurateTimeOffset,
  64381. d = u.timeOffset;
  64382. m.logger.log("[transmuxer.ts]: Flushed fragment " + i.sn + (i.part > -1 ? " p: " + i.part :
  64383. "") + " of level " + i.level);
  64384. var c = this.remuxer.remux(n, a, s, o, d, l, !0, this.id);
  64385. e.push({
  64386. remuxResult: c,
  64387. chunkMeta: i
  64388. }), i.transmuxing.executeEnd = r()
  64389. }, t.resetInitialTimestamp = function(e) {
  64390. var t = this.demuxer,
  64391. i = this.remuxer;
  64392. t && i && (t.resetTimeStamp(e), i.resetTimeStamp(e))
  64393. }, t.resetContiguity = function() {
  64394. var e = this.demuxer,
  64395. t = this.remuxer;
  64396. e && t && (e.resetContiguity(), t.resetNextTimestamp())
  64397. }, t.resetInitSegment = function(e, t, i, r) {
  64398. var n = this.demuxer,
  64399. a = this.remuxer;
  64400. n && a && (n.resetInitSegment(e, t, i, r), a.resetInitSegment(e, t, i))
  64401. }, t.destroy = function() {
  64402. this.demuxer && (this.demuxer.destroy(), this.demuxer = void 0), this.remuxer && (this.remuxer
  64403. .destroy(), this.remuxer = void 0)
  64404. }, t.transmux = function(e, t, i, r, n) {
  64405. return t && "SAMPLE-AES" === t.method ? this.transmuxSampleAes(e, t, i, r, n) : this
  64406. .transmuxUnencrypted(e, i, r, n)
  64407. }, t.transmuxUnencrypted = function(e, t, i, r) {
  64408. var n = this.demuxer.demux(e, t, !1, !this.config.progressive),
  64409. a = n.audioTrack,
  64410. s = n.videoTrack,
  64411. o = n.id3Track,
  64412. u = n.textTrack;
  64413. return {
  64414. remuxResult: this.remuxer.remux(a, s, o, u, t, i, !1, this.id),
  64415. chunkMeta: r
  64416. }
  64417. }, t.transmuxSampleAes = function(e, t, i, r, n) {
  64418. var a = this;
  64419. return this.demuxer.demuxSampleAes(e, t, i).then(function(e) {
  64420. return {
  64421. remuxResult: a.remuxer.remux(e.audioTrack, e.videoTrack, e.id3Track, e.textTrack, i, r,
  64422. !1, a.id),
  64423. chunkMeta: n
  64424. }
  64425. })
  64426. }, t.configureTransmuxer = function(e, t) {
  64427. for (var i, r = this.config, n = this.observer, a = this.typeSupported, s = this.vendor, o = t
  64428. .audioCodec, l = t.defaultInitPts, d = t.duration, c = t.initSegmentData, f = t.videoCodec,
  64429. p = 0, v = g.length; p < v; p++)
  64430. if (g[p].demux.probe(e)) {
  64431. i = g[p];
  64432. break
  64433. } i || (m.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),
  64434. i = {
  64435. demux: u.default,
  64436. remux: h.default
  64437. });
  64438. var y = this.demuxer,
  64439. _ = this.remuxer,
  64440. b = i.remux,
  64441. w = i.demux;
  64442. _ && _ instanceof b || (this.remuxer = new b(n, r, a, s)), y && y instanceof w || (this
  64443. .demuxer = new w(n, r, a), this.probe = w.probe), this.resetInitSegment(c, o, f, d), this
  64444. .resetInitialTimestamp(l)
  64445. }, t.needsProbing = function(e, t, i) {
  64446. return !this.demuxer || !this.remuxer || t || i
  64447. }, t.getDecrypter = function() {
  64448. var e = this.decrypter;
  64449. return e || (e = this.decrypter = new s.default(this.observer, this.config)), e
  64450. }, e
  64451. }();
  64452. var _ = function(e) {
  64453. return {
  64454. remuxResult: {},
  64455. chunkMeta: e
  64456. }
  64457. };
  64458. function b(e) {
  64459. return "then" in e && e.then instanceof Function
  64460. }
  64461. var w = function(e, t, i, r, n) {
  64462. this.audioCodec = void 0, this.videoCodec = void 0, this.initSegmentData = void 0, this.duration =
  64463. void 0, this.defaultInitPts = void 0, this.audioCodec = e, this.videoCodec = t, this
  64464. .initSegmentData = i, this.duration = r, this.defaultInitPts = n
  64465. },
  64466. E = function(e, t, i, r, n, a) {
  64467. this.discontinuity = void 0, this.contiguous = void 0, this.accurateTimeOffset = void 0, this
  64468. .trackSwitch = void 0, this.timeOffset = void 0, this.initSegmentChange = void 0, this
  64469. .discontinuity = e, this.contiguous = t, this.accurateTimeOffset = i, this.trackSwitch = r, this
  64470. .timeOffset = n, this.initSegmentChange = a
  64471. }
  64472. },
  64473. "./src/demux/tsdemuxer.ts": function(e, t, i) {
  64474. "use strict";
  64475. i.r(t), i.d(t, "discardEPB", function() {
  64476. return v
  64477. });
  64478. var r = i("./src/demux/adts.ts"),
  64479. n = i("./src/demux/mpegaudio.ts"),
  64480. a = i("./src/demux/exp-golomb.ts"),
  64481. s = i("./src/demux/sample-aes.ts"),
  64482. o = i("./src/events.ts"),
  64483. u = i("./src/utils/mp4-tools.ts"),
  64484. l = i("./src/utils/logger.ts"),
  64485. d = i("./src/errors.ts"),
  64486. c = function() {
  64487. function e(e, t, i) {
  64488. this.observer = void 0, this.config = void 0, this.typeSupported = void 0, this.sampleAes = null,
  64489. this.pmtParsed = !1, this.audioCodec = void 0, this.videoCodec = void 0, this._duration = 0,
  64490. this._pmtId = -1, this._avcTrack = void 0, this._audioTrack = void 0, this._id3Track = void 0,
  64491. this._txtTrack = void 0, this.aacOverFlow = null, this.avcSample = null, this.remainderData =
  64492. null, this.observer = e, this.config = t, this.typeSupported = i
  64493. }
  64494. e.probe = function(t) {
  64495. var i = e.syncOffset(t);
  64496. return !(i < 0) && (i && l.logger.warn("MPEG2-TS detected but first sync word found @ offset " +
  64497. i + ", junk ahead ?"), !0)
  64498. }, e.syncOffset = function(e) {
  64499. for (var t = Math.min(1e3, e.length - 564), i = 0; i < t;) {
  64500. if (71 === e[i] && 71 === e[i + 188] && 71 === e[i + 376]) return i;
  64501. i++
  64502. }
  64503. return -1
  64504. }, e.createTrack = function(e, t) {
  64505. return {
  64506. container: "video" === e || "audio" === e ? "video/mp2t" : void 0,
  64507. type: e,
  64508. id: u.RemuxerTrackIdConfig[e],
  64509. pid: -1,
  64510. inputTimeScale: 9e4,
  64511. sequenceNumber: 0,
  64512. samples: [],
  64513. dropped: 0,
  64514. duration: "audio" === e ? t : void 0
  64515. }
  64516. };
  64517. var t = e.prototype;
  64518. return t.resetInitSegment = function(t, i, r, n) {
  64519. this.pmtParsed = !1, this._pmtId = -1, this._avcTrack = e.createTrack("video"), this
  64520. ._audioTrack = e.createTrack("audio", n), this._id3Track = e.createTrack("id3"), this
  64521. ._txtTrack = e.createTrack("text"), this._audioTrack.segmentCodec = "aac", this.aacOverFlow =
  64522. null, this.avcSample = null, this.audioCodec = i, this.videoCodec = r, this._duration = n
  64523. }, t.resetTimeStamp = function() {}, t.resetContiguity = function() {
  64524. var e = this._audioTrack,
  64525. t = this._avcTrack,
  64526. i = this._id3Track;
  64527. e && (e.pesData = null), t && (t.pesData = null), i && (i.pesData = null), this.aacOverFlow =
  64528. null
  64529. }, t.demux = function(t, i, r, n) {
  64530. var a;
  64531. void 0 === r && (r = !1), void 0 === n && (n = !1), r || (this.sampleAes = null);
  64532. var s = this._avcTrack,
  64533. c = this._audioTrack,
  64534. h = this._id3Track,
  64535. g = this._txtTrack,
  64536. v = s.pid,
  64537. y = s.pesData,
  64538. _ = c.pid,
  64539. b = h.pid,
  64540. w = c.pesData,
  64541. E = h.pesData,
  64542. T = !1,
  64543. S = this.pmtParsed,
  64544. A = this._pmtId,
  64545. k = t.length;
  64546. if (this.remainderData && (k = (t = Object(u.appendUint8Array)(this.remainderData, t)).length,
  64547. this.remainderData = null), k < 188 && !n) return this.remainderData = t, {
  64548. audioTrack: c,
  64549. videoTrack: s,
  64550. id3Track: h,
  64551. textTrack: g
  64552. };
  64553. var R = Math.max(0, e.syncOffset(t));
  64554. (k -= (k + R) % 188) < t.byteLength && !n && (this.remainderData = new Uint8Array(t.buffer, k, t
  64555. .buffer.byteLength - k));
  64556. for (var M = 0, O = R; O < k; O += 188)
  64557. if (71 === t[O]) {
  64558. var C = !!(64 & t[O + 1]),
  64559. D = ((31 & t[O + 1]) << 8) + t[O + 2],
  64560. I = void 0;
  64561. if ((48 & t[O + 3]) >> 4 > 1) {
  64562. if ((I = O + 5 + t[O + 4]) === O + 188) continue
  64563. } else I = O + 4;
  64564. switch (D) {
  64565. case v:
  64566. C && (y && (a = m(y)) && this.parseAVCPES(s, g, a, !1), y = {
  64567. data: [],
  64568. size: 0
  64569. }), y && (y.data.push(t.subarray(I, O + 188)), y.size += O + 188 - I);
  64570. break;
  64571. case _:
  64572. if (C) {
  64573. if (w && (a = m(w))) switch (c.segmentCodec) {
  64574. case "aac":
  64575. this.parseAACPES(c, a);
  64576. break;
  64577. case "mp3":
  64578. this.parseMPEGPES(c, a)
  64579. }
  64580. w = {
  64581. data: [],
  64582. size: 0
  64583. }
  64584. }
  64585. w && (w.data.push(t.subarray(I, O + 188)), w.size += O + 188 - I);
  64586. break;
  64587. case b:
  64588. C && (E && (a = m(E)) && this.parseID3PES(h, a), E = {
  64589. data: [],
  64590. size: 0
  64591. }), E && (E.data.push(t.subarray(I, O + 188)), E.size += O + 188 - I);
  64592. break;
  64593. case 0:
  64594. C && (I += t[I] + 1), A = this._pmtId = f(t, I);
  64595. break;
  64596. case A:
  64597. C && (I += t[I] + 1);
  64598. var L = p(t, I, this.typeSupported, r, this.observer);
  64599. (v = L.avc) > 0 && (s.pid = v), (_ = L.audio) > 0 && (c.pid = _, c.segmentCodec = L
  64600. .segmentCodec), (b = L.id3) > 0 && (h.pid = b), T && !S && (l.logger.log(
  64601. "reparse from beginning"), T = !1, O = R - 188), S = this.pmtParsed = !0;
  64602. break;
  64603. case 17:
  64604. case 8191:
  64605. break;
  64606. default:
  64607. T = !0
  64608. }
  64609. } else M++;
  64610. M > 0 && this.observer.emit(o.Events.ERROR, o.Events.ERROR, {
  64611. type: d.ErrorTypes.MEDIA_ERROR,
  64612. details: d.ErrorDetails.FRAG_PARSING_ERROR,
  64613. fatal: !1,
  64614. reason: "Found " + M + " TS packet/s that do not start with 0x47"
  64615. }), s.pesData = y, c.pesData = w, h.pesData = E;
  64616. var x = {
  64617. audioTrack: c,
  64618. videoTrack: s,
  64619. id3Track: h,
  64620. textTrack: g
  64621. };
  64622. return n && this.extractRemainingSamples(x), x
  64623. }, t.flush = function() {
  64624. var e, t = this.remainderData;
  64625. return this.remainderData = null, e = t ? this.demux(t, -1, !1, !0) : {
  64626. videoTrack: this._avcTrack,
  64627. audioTrack: this._audioTrack,
  64628. id3Track: this._id3Track,
  64629. textTrack: this._txtTrack
  64630. }, this.extractRemainingSamples(e), this.sampleAes ? this.decrypt(e, this.sampleAes) : e
  64631. }, t.extractRemainingSamples = function(e) {
  64632. var t, i = e.audioTrack,
  64633. r = e.videoTrack,
  64634. n = e.id3Track,
  64635. a = e.textTrack,
  64636. s = r.pesData,
  64637. o = i.pesData,
  64638. u = n.pesData;
  64639. if (s && (t = m(s)) ? (this.parseAVCPES(r, a, t, !0), r.pesData = null) : r.pesData = s, o && (
  64640. t = m(o))) {
  64641. switch (i.segmentCodec) {
  64642. case "aac":
  64643. this.parseAACPES(i, t);
  64644. break;
  64645. case "mp3":
  64646. this.parseMPEGPES(i, t)
  64647. }
  64648. i.pesData = null
  64649. } else null !== o && void 0 !== o && o.size && l.logger.log(
  64650. "last AAC PES packet truncated,might overlap between fragments"), i.pesData = o;
  64651. u && (t = m(u)) ? (this.parseID3PES(n, t), n.pesData = null) : n.pesData = u
  64652. }, t.demuxSampleAes = function(e, t, i) {
  64653. var r = this.demux(e, i, !0, !this.config.progressive),
  64654. n = this.sampleAes = new s.default(this.observer, this.config, t);
  64655. return this.decrypt(r, n)
  64656. }, t.decrypt = function(e, t) {
  64657. return new Promise(function(i) {
  64658. var r = e.audioTrack,
  64659. n = e.videoTrack;
  64660. r.samples && "aac" === r.segmentCodec ? t.decryptAacSamples(r.samples, 0, function() {
  64661. n.samples ? t.decryptAvcSamples(n.samples, 0, 0, function() {
  64662. i(e)
  64663. }) : i(e)
  64664. }) : n.samples && t.decryptAvcSamples(n.samples, 0, 0, function() {
  64665. i(e)
  64666. })
  64667. })
  64668. }, t.destroy = function() {
  64669. this._duration = 0
  64670. }, t.parseAVCPES = function(e, t, i, r) {
  64671. var n, s = this,
  64672. o = this.parseAVCNALu(e, i.data),
  64673. l = this.avcSample,
  64674. d = !1;
  64675. i.data = null, l && o.length && !e.audFound && (g(l, e), l = this.avcSample = h(!1, i.pts, i
  64676. .dts, "")), o.forEach(function(r) {
  64677. switch (r.type) {
  64678. case 1:
  64679. n = !0, l || (l = s.avcSample = h(!0, i.pts, i.dts, "")), l.frame = !0;
  64680. var o = r.data;
  64681. if (d && o.length > 4) {
  64682. var c = new a.default(o).readSliceType();
  64683. 2 !== c && 4 !== c && 7 !== c && 9 !== c || (l.key = !0)
  64684. }
  64685. break;
  64686. case 5:
  64687. n = !0, l || (l = s.avcSample = h(!0, i.pts, i.dts, "")), l.key = !0, l.frame = !0;
  64688. break;
  64689. case 6:
  64690. n = !0, Object(u.parseSEIMessageFromNALu)(v(r.data), i.pts, t.samples);
  64691. break;
  64692. case 7:
  64693. if (n = !0, d = !0, !e.sps) {
  64694. var f = new a.default(r.data).readSPS();
  64695. e.width = f.width, e.height = f.height, e.pixelRatio = f.pixelRatio, e.sps = [r
  64696. .data], e.duration = s._duration;
  64697. for (var p = r.data.subarray(1, 4), m = "avc1.", y = 0; y < 3; y++) {
  64698. var _ = p[y].toString(16);
  64699. _.length < 2 && (_ = "0" + _), m += _
  64700. }
  64701. e.codec = m
  64702. }
  64703. break;
  64704. case 8:
  64705. n = !0, e.pps || (e.pps = [r.data]);
  64706. break;
  64707. case 9:
  64708. n = !1, e.audFound = !0, l && g(l, e), l = s.avcSample = h(!1, i.pts, i.dts, "");
  64709. break;
  64710. case 12:
  64711. n = !1;
  64712. break;
  64713. default:
  64714. n = !1, l && (l.debug += "unknown NAL " + r.type + " ")
  64715. }
  64716. l && n && l.units.push(r)
  64717. }), r && l && (g(l, e), this.avcSample = null)
  64718. }, t.getLastNalUnit = function(e) {
  64719. var t, i, r = this.avcSample;
  64720. if (r && 0 !== r.units.length || (r = e[e.length - 1]), null !== (t = r) && void 0 !== t && t
  64721. .units) {
  64722. var n = r.units;
  64723. i = n[n.length - 1]
  64724. }
  64725. return i
  64726. }, t.parseAVCNALu = function(e, t) {
  64727. var i, r, n = t.byteLength,
  64728. a = e.naluState || 0,
  64729. s = a,
  64730. o = [],
  64731. u = 0,
  64732. l = -1,
  64733. d = 0;
  64734. for (-1 === a && (l = 0, d = 31 & t[0], a = 0, u = 1); u < n;)
  64735. if (i = t[u++], a)
  64736. if (1 !== a)
  64737. if (i)
  64738. if (1 === i) {
  64739. if (l >= 0) {
  64740. var c = {
  64741. data: t.subarray(l, u - a - 1),
  64742. type: d
  64743. };
  64744. o.push(c)
  64745. } else {
  64746. var h = this.getLastNalUnit(e.samples);
  64747. if (h && (s && u <= 4 - s && h.state && (h.data = h.data.subarray(0, h.data
  64748. .byteLength - s)), (r = u - a - 1) > 0)) {
  64749. var f = new Uint8Array(h.data.byteLength + r);
  64750. f.set(h.data, 0), f.set(t.subarray(0, r), h.data.byteLength), h.data = f, h
  64751. .state = 0
  64752. }
  64753. }
  64754. u < n ? (l = u, d = 31 & t[u], a = 0) : a = -1
  64755. } else a = 0;
  64756. else a = 3;
  64757. else a = i ? 0 : 2;
  64758. else a = i ? 0 : 1;
  64759. if (l >= 0 && a >= 0) {
  64760. var p = {
  64761. data: t.subarray(l, n),
  64762. type: d,
  64763. state: a
  64764. };
  64765. o.push(p)
  64766. }
  64767. if (0 === o.length) {
  64768. var m = this.getLastNalUnit(e.samples);
  64769. if (m) {
  64770. var g = new Uint8Array(m.data.byteLength + t.byteLength);
  64771. g.set(m.data, 0), g.set(t, m.data.byteLength), m.data = g
  64772. }
  64773. }
  64774. return e.naluState = a, o
  64775. }, t.parseAACPES = function(e, t) {
  64776. var i, n, a, s, u, c = 0,
  64777. h = this.aacOverFlow,
  64778. f = t.data;
  64779. if (h) {
  64780. this.aacOverFlow = null;
  64781. var p = h.sample.unit.byteLength,
  64782. m = Math.min(h.missing, p),
  64783. g = p - m;
  64784. h.sample.unit.set(f.subarray(0, m), g), e.samples.push(h.sample), c = h.missing
  64785. }
  64786. for (i = c, n = f.length; i < n - 1 && !r.isHeader(f, i); i++);
  64787. if (i !== c && (i < n - 1 ? (a = "AAC PES did not start with ADTS header,offset:" + i, s = !1) :
  64788. (a = "no ADTS header found in AAC PES", s = !0), l.logger.warn("parsing error:" + a), this
  64789. .observer.emit(o.Events.ERROR, o.Events.ERROR, {
  64790. type: d.ErrorTypes.MEDIA_ERROR,
  64791. details: d.ErrorDetails.FRAG_PARSING_ERROR,
  64792. fatal: s,
  64793. reason: a
  64794. }), s)) return;
  64795. if (r.initTrackConfig(e, this.observer, f, i, this.audioCodec), void 0 !== t.pts) u = t.pts;
  64796. else {
  64797. if (!h) return void l.logger.warn("[tsdemuxer]: AAC PES unknown PTS");
  64798. var v = r.getFrameDuration(e.samplerate);
  64799. u = h.sample.pts + v
  64800. }
  64801. for (var y = 0; i < n;) {
  64802. if (r.isHeader(f, i)) {
  64803. if (i + 5 < n) {
  64804. var _ = r.appendFrame(e, f, i, u, y);
  64805. if (_) {
  64806. if (!_.missing) {
  64807. i += _.length, y++;
  64808. continue
  64809. }
  64810. this.aacOverFlow = _
  64811. }
  64812. }
  64813. break
  64814. }
  64815. i++
  64816. }
  64817. }, t.parseMPEGPES = function(e, t) {
  64818. var i = t.data,
  64819. r = i.length,
  64820. a = 0,
  64821. s = 0,
  64822. o = t.pts;
  64823. if (void 0 !== o)
  64824. for (; s < r;)
  64825. if (n.isHeader(i, s)) {
  64826. var u = n.appendFrame(e, i, s, o, a);
  64827. if (!u) break;
  64828. s += u.length, a++
  64829. } else s++;
  64830. else l.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")
  64831. }, t.parseID3PES = function(e, t) {
  64832. void 0 !== t.pts ? e.samples.push(t) : l.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")
  64833. }, e
  64834. }();
  64835. function h(e, t, i, r) {
  64836. return {
  64837. key: e,
  64838. frame: !1,
  64839. pts: t,
  64840. dts: i,
  64841. units: [],
  64842. debug: r,
  64843. length: 0
  64844. }
  64845. }
  64846. function f(e, t) {
  64847. return (31 & e[t + 10]) << 8 | e[t + 11]
  64848. }
  64849. function p(e, t, i, r, n) {
  64850. var a = {
  64851. audio: -1,
  64852. avc: -1,
  64853. id3: -1,
  64854. segmentCodec: "aac"
  64855. },
  64856. s = t + 3 + ((15 & e[t + 1]) << 8 | e[t + 2]) - 4;
  64857. for (t += 12 + ((15 & e[t + 10]) << 8 | e[t + 11]); t < s;) {
  64858. var u = (31 & e[t + 1]) << 8 | e[t + 2];
  64859. switch (e[t]) {
  64860. case 207:
  64861. if (!r) {
  64862. l.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");
  64863. break
  64864. }
  64865. case 15:
  64866. -1 === a.audio && (a.audio = u);
  64867. break;
  64868. case 21:
  64869. -1 === a.id3 && (a.id3 = u);
  64870. break;
  64871. case 219:
  64872. if (!r) {
  64873. l.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");
  64874. break
  64875. }
  64876. case 27:
  64877. -1 === a.avc && (a.avc = u);
  64878. break;
  64879. case 3:
  64880. case 4:
  64881. !0 !== i.mpeg && !0 !== i.mp3 ? l.logger.log(
  64882. "MPEG audio found, not supported in this browser") : -1 === a.audio && (a.audio = u, a
  64883. .segmentCodec = "mp3");
  64884. break;
  64885. case 36:
  64886. n.emit(o.Events.ERROR, o.Events.ERROR, {
  64887. type: d.ErrorTypes.MEDIA_ERROR,
  64888. details: d.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,
  64889. fatal: !1,
  64890. reason: "Unsupported HEVC stream type found 0x24"
  64891. }), l.logger.warn("Unsupported HEVC stream type found")
  64892. }
  64893. t += 5 + ((15 & e[t + 3]) << 8 | e[t + 4])
  64894. }
  64895. return a
  64896. }
  64897. function m(e) {
  64898. var t, i, r, n, a, s = 0,
  64899. o = e.data;
  64900. if (!e || 0 === e.size) return null;
  64901. for (; o[0].length < 19 && o.length > 1;) {
  64902. var u = new Uint8Array(o[0].length + o[1].length);
  64903. u.set(o[0]), u.set(o[1], o[0].length), o[0] = u, o.splice(1, 1)
  64904. }
  64905. if (1 === ((t = o[0])[0] << 16) + (t[1] << 8) + t[2]) {
  64906. if ((i = (t[4] << 8) + t[5]) && i > e.size - 6) return null;
  64907. var d = t[7];
  64908. 192 & d && (n = 536870912 * (14 & t[9]) + 4194304 * (255 & t[10]) + 16384 * (254 & t[11]) + 128 * (
  64909. 255 & t[12]) + (254 & t[13]) / 2, 64 & d ? n - (a = 536870912 * (14 & t[14]) + 4194304 * (
  64910. 255 & t[15]) + 16384 * (254 & t[16]) + 128 * (255 & t[17]) + (254 & t[18]) / 2) > 54e5 && (l
  64911. .logger.warn(Math.round((n - a) / 9e4) + "s delta between PTS and DTS, align them"), n = a) :
  64912. a = n);
  64913. var c = (r = t[8]) + 9;
  64914. if (e.size <= c) return null;
  64915. e.size -= c;
  64916. for (var h = new Uint8Array(e.size), f = 0, p = o.length; f < p; f++) {
  64917. var m = (t = o[f]).byteLength;
  64918. if (c) {
  64919. if (c > m) {
  64920. c -= m;
  64921. continue
  64922. }
  64923. t = t.subarray(c), m -= c, c = 0
  64924. }
  64925. h.set(t, s), s += m
  64926. }
  64927. return i && (i -= r + 3), {
  64928. data: h,
  64929. pts: n,
  64930. dts: a,
  64931. len: i
  64932. }
  64933. }
  64934. return null
  64935. }
  64936. function g(e, t) {
  64937. if (e.units.length && e.frame) {
  64938. if (void 0 === e.pts) {
  64939. var i = t.samples,
  64940. r = i.length;
  64941. if (!r) return void t.dropped++;
  64942. var n = i[r - 1];
  64943. e.pts = n.pts, e.dts = n.dts
  64944. }
  64945. t.samples.push(e)
  64946. }
  64947. e.debug.length && l.logger.log(e.pts + "/" + e.dts + ":" + e.debug)
  64948. }
  64949. function v(e) {
  64950. for (var t = e.byteLength, i = [], r = 1; r < t - 2;) 0 === e[r] && 0 === e[r + 1] && 3 === e[r + 2] ?
  64951. (i.push(r + 2), r += 2) : r++;
  64952. if (0 === i.length) return e;
  64953. var n = t - i.length,
  64954. a = new Uint8Array(n),
  64955. s = 0;
  64956. for (r = 0; r < n; s++, r++) s === i[0] && (s++, i.shift()), a[r] = e[s];
  64957. return a
  64958. }
  64959. c.minProbeByteLength = 188, t.default = c
  64960. },
  64961. "./src/errors.ts": function(e, t, i) {
  64962. "use strict";
  64963. var r, n;
  64964. i.r(t), i.d(t, "ErrorTypes", function() {
  64965. return r
  64966. }), i.d(t, "ErrorDetails", function() {
  64967. return n
  64968. }),
  64969. function(e) {
  64970. e.NETWORK_ERROR = "networkError", e.MEDIA_ERROR = "mediaError", e.KEY_SYSTEM_ERROR =
  64971. "keySystemError", e.MUX_ERROR = "muxError", e.OTHER_ERROR = "otherError"
  64972. }(r || (r = {})),
  64973. function(e) {
  64974. e.KEY_SYSTEM_NO_KEYS = "keySystemNoKeys", e.KEY_SYSTEM_NO_ACCESS = "keySystemNoAccess", e
  64975. .KEY_SYSTEM_NO_SESSION = "keySystemNoSession", e.KEY_SYSTEM_LICENSE_REQUEST_FAILED =
  64976. "keySystemLicenseRequestFailed", e.KEY_SYSTEM_NO_INIT_DATA = "keySystemNoInitData", e
  64977. .MANIFEST_LOAD_ERROR = "manifestLoadError", e.MANIFEST_LOAD_TIMEOUT = "manifestLoadTimeOut", e
  64978. .MANIFEST_PARSING_ERROR = "manifestParsingError", e.MANIFEST_INCOMPATIBLE_CODECS_ERROR =
  64979. "manifestIncompatibleCodecsError", e.LEVEL_EMPTY_ERROR = "levelEmptyError", e.LEVEL_LOAD_ERROR =
  64980. "levelLoadError", e.LEVEL_LOAD_TIMEOUT = "levelLoadTimeOut", e.LEVEL_SWITCH_ERROR =
  64981. "levelSwitchError", e.AUDIO_TRACK_LOAD_ERROR = "audioTrackLoadError", e.AUDIO_TRACK_LOAD_TIMEOUT =
  64982. "audioTrackLoadTimeOut", e.SUBTITLE_LOAD_ERROR = "subtitleTrackLoadError", e
  64983. .SUBTITLE_TRACK_LOAD_TIMEOUT = "subtitleTrackLoadTimeOut", e.FRAG_LOAD_ERROR = "fragLoadError", e
  64984. .FRAG_LOAD_TIMEOUT = "fragLoadTimeOut", e.FRAG_DECRYPT_ERROR = "fragDecryptError", e
  64985. .FRAG_PARSING_ERROR = "fragParsingError", e.REMUX_ALLOC_ERROR = "remuxAllocError", e
  64986. .KEY_LOAD_ERROR = "keyLoadError", e.KEY_LOAD_TIMEOUT = "keyLoadTimeOut", e
  64987. .BUFFER_ADD_CODEC_ERROR = "bufferAddCodecError", e.BUFFER_INCOMPATIBLE_CODECS_ERROR =
  64988. "bufferIncompatibleCodecsError", e.BUFFER_APPEND_ERROR = "bufferAppendError", e
  64989. .BUFFER_APPENDING_ERROR = "bufferAppendingError", e.BUFFER_STALLED_ERROR = "bufferStalledError", e
  64990. .BUFFER_FULL_ERROR = "bufferFullError", e.BUFFER_SEEK_OVER_HOLE = "bufferSeekOverHole", e
  64991. .BUFFER_NUDGE_ON_STALL = "bufferNudgeOnStall", e.INTERNAL_EXCEPTION = "internalException", e
  64992. .INTERNAL_ABORTED = "aborted", e.UNKNOWN = "unknown"
  64993. }(n || (n = {}))
  64994. },
  64995. "./src/events.ts": function(e, t, i) {
  64996. "use strict";
  64997. var r;
  64998. i.r(t), i.d(t, "Events", function() {
  64999. return r
  65000. }),
  65001. function(e) {
  65002. e.MEDIA_ATTACHING = "hlsMediaAttaching", e.MEDIA_ATTACHED = "hlsMediaAttached", e.MEDIA_DETACHING =
  65003. "hlsMediaDetaching", e.MEDIA_DETACHED = "hlsMediaDetached", e.BUFFER_RESET = "hlsBufferReset", e
  65004. .BUFFER_CODECS = "hlsBufferCodecs", e.BUFFER_CREATED = "hlsBufferCreated", e.BUFFER_APPENDING =
  65005. "hlsBufferAppending", e.BUFFER_APPENDED = "hlsBufferAppended", e.BUFFER_EOS = "hlsBufferEos", e
  65006. .BUFFER_FLUSHING = "hlsBufferFlushing", e.BUFFER_FLUSHED = "hlsBufferFlushed", e
  65007. .MANIFEST_LOADING = "hlsManifestLoading", e.MANIFEST_LOADED = "hlsManifestLoaded", e
  65008. .MANIFEST_PARSED = "hlsManifestParsed", e.LEVEL_SWITCHING = "hlsLevelSwitching", e
  65009. .LEVEL_SWITCHED = "hlsLevelSwitched", e.LEVEL_LOADING = "hlsLevelLoading", e.LEVEL_LOADED =
  65010. "hlsLevelLoaded", e.LEVEL_UPDATED = "hlsLevelUpdated", e.LEVEL_PTS_UPDATED = "hlsLevelPtsUpdated",
  65011. e.LEVELS_UPDATED = "hlsLevelsUpdated", e.AUDIO_TRACKS_UPDATED = "hlsAudioTracksUpdated", e
  65012. .AUDIO_TRACK_SWITCHING = "hlsAudioTrackSwitching", e.AUDIO_TRACK_SWITCHED =
  65013. "hlsAudioTrackSwitched", e.AUDIO_TRACK_LOADING = "hlsAudioTrackLoading", e.AUDIO_TRACK_LOADED =
  65014. "hlsAudioTrackLoaded", e.SUBTITLE_TRACKS_UPDATED = "hlsSubtitleTracksUpdated", e
  65015. .SUBTITLE_TRACKS_CLEARED = "hlsSubtitleTracksCleared", e.SUBTITLE_TRACK_SWITCH =
  65016. "hlsSubtitleTrackSwitch", e.SUBTITLE_TRACK_LOADING = "hlsSubtitleTrackLoading", e
  65017. .SUBTITLE_TRACK_LOADED = "hlsSubtitleTrackLoaded", e.SUBTITLE_FRAG_PROCESSED =
  65018. "hlsSubtitleFragProcessed", e.CUES_PARSED = "hlsCuesParsed", e.NON_NATIVE_TEXT_TRACKS_FOUND =
  65019. "hlsNonNativeTextTracksFound", e.INIT_PTS_FOUND = "hlsInitPtsFound", e.FRAG_LOADING =
  65020. "hlsFragLoading", e.FRAG_LOAD_EMERGENCY_ABORTED = "hlsFragLoadEmergencyAborted", e.FRAG_LOADED =
  65021. "hlsFragLoaded", e.FRAG_DECRYPTED = "hlsFragDecrypted", e.FRAG_PARSING_INIT_SEGMENT =
  65022. "hlsFragParsingInitSegment", e.FRAG_PARSING_USERDATA = "hlsFragParsingUserdata", e
  65023. .FRAG_PARSING_METADATA = "hlsFragParsingMetadata", e.FRAG_PARSED = "hlsFragParsed", e
  65024. .FRAG_BUFFERED = "hlsFragBuffered", e.FRAG_CHANGED = "hlsFragChanged", e.FPS_DROP = "hlsFpsDrop",
  65025. e.FPS_DROP_LEVEL_CAPPING = "hlsFpsDropLevelCapping", e.ERROR = "hlsError", e.DESTROYING =
  65026. "hlsDestroying", e.KEY_LOADING = "hlsKeyLoading", e.KEY_LOADED = "hlsKeyLoaded", e
  65027. .LIVE_BACK_BUFFER_REACHED = "hlsLiveBackBufferReached", e.BACK_BUFFER_REACHED =
  65028. "hlsBackBufferReached", e.RECORDING = "recording"
  65029. }(r || (r = {}))
  65030. },
  65031. "./src/hls.ts": function(e, t, i) {
  65032. "use strict";
  65033. i.r(t), i.d(t, "default", function() {
  65034. return y
  65035. });
  65036. var r = i("./node_modules/url-toolkit/src/url-toolkit.js"),
  65037. n = i("./src/loader/playlist-loader.ts"),
  65038. a = i("./src/loader/key-loader.ts"),
  65039. s = i("./src/controller/id3-track-controller.ts"),
  65040. o = i("./src/controller/latency-controller.ts"),
  65041. u = i("./src/controller/level-controller.ts"),
  65042. l = i("./src/controller/fragment-tracker.ts"),
  65043. d = i("./src/controller/stream-controller.ts"),
  65044. c = i("./src/is-supported.ts"),
  65045. h = i("./src/utils/logger.ts"),
  65046. f = i("./src/config.ts"),
  65047. p = i("./node_modules/eventemitter3/index.js"),
  65048. m = i("./src/events.ts"),
  65049. g = i("./src/errors.ts");
  65050. function v(e, t) {
  65051. for (var i = 0; i < t.length; i++) {
  65052. var r = t[i];
  65053. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  65054. .defineProperty(e, r.key, r)
  65055. }
  65056. }
  65057. var y = function() {
  65058. function e(t) {
  65059. void 0 === t && (t = {}), this.config = void 0, this.userConfig = void 0, this.coreComponents =
  65060. void 0, this.networkControllers = void 0, this._emitter = new p.EventEmitter, this
  65061. ._autoLevelCapping = void 0, this.abrController = void 0, this.bufferController = void 0, this
  65062. .capLevelController = void 0, this.latencyController = void 0, this.levelController = void 0,
  65063. this.streamController = void 0, this.audioTrackController = void 0, this
  65064. .subtitleTrackController = void 0, this.emeController = void 0, this.cmcdController = void 0,
  65065. this._media = null, this.url = null;
  65066. var i = this.config = Object(f.mergeConfig)(e.DefaultConfig, t);
  65067. this.userConfig = t, Object(h.enableLogs)(i.debug), this._autoLevelCapping = -1, i.progressive &&
  65068. Object(f.enableStreamingMode)(i);
  65069. var r = i.abrController,
  65070. c = i.bufferController,
  65071. m = i.capLevelController,
  65072. g = i.fpsController,
  65073. v = this.abrController = new r(this),
  65074. y = this.bufferController = new c(this),
  65075. _ = this.capLevelController = new m(this),
  65076. b = new g(this),
  65077. w = new n.default(this),
  65078. E = new a.default(this),
  65079. T = new s.default(this),
  65080. S = this.levelController = new u.default(this),
  65081. A = new l.FragmentTracker(this),
  65082. k = this.streamController = new d.default(this, A);
  65083. _.setStreamController(k), b.setStreamController(k);
  65084. var R = [S, k];
  65085. this.networkControllers = R;
  65086. var M = [w, E, v, y, _, b, T, A];
  65087. this.audioTrackController = this.createController(i.audioTrackController, null, R), this
  65088. .createController(i.audioStreamController, A, R), this.subtitleTrackController = this
  65089. .createController(i.subtitleTrackController, null, R), this.createController(i
  65090. .subtitleStreamController, A, R), this.createController(i.timelineController, null, M), this
  65091. .emeController = this.createController(i.emeController, null, M), this.cmcdController = this
  65092. .createController(i.cmcdController, null, M), this.latencyController = this.createController(o
  65093. .default, null, M), this.coreComponents = M
  65094. }
  65095. e.isSupported = function() {
  65096. return Object(c.isSupported)()
  65097. };
  65098. var t, i, y, _ = e.prototype;
  65099. return _.createController = function(e, t, i) {
  65100. if (e) {
  65101. var r = t ? new e(this, t) : new e(this);
  65102. return i && i.push(r), r
  65103. }
  65104. return null
  65105. }, _.on = function(e, t, i) {
  65106. void 0 === i && (i = this), this._emitter.on(e, t, i)
  65107. }, _.once = function(e, t, i) {
  65108. void 0 === i && (i = this), this._emitter.once(e, t, i)
  65109. }, _.removeAllListeners = function(e) {
  65110. this._emitter.removeAllListeners(e)
  65111. }, _.off = function(e, t, i, r) {
  65112. void 0 === i && (i = this), this._emitter.off(e, t, i, r)
  65113. }, _.listeners = function(e) {
  65114. return this._emitter.listeners(e)
  65115. }, _.emit = function(e, t, i) {
  65116. return this._emitter.emit(e, t, i)
  65117. }, _.trigger = function(e, t) {
  65118. if (this.config.debug) return this.emit(e, e, t);
  65119. try {
  65120. return this.emit(e, e, t)
  65121. } catch (t) {
  65122. h.logger.error("An internal error happened while handling event " + e + '. Error message: "' +
  65123. t.message + '". Here is a stacktrace:', t), this.trigger(m.Events.ERROR, {
  65124. type: g.ErrorTypes.OTHER_ERROR,
  65125. details: g.ErrorDetails.INTERNAL_EXCEPTION,
  65126. fatal: !1,
  65127. event: e,
  65128. error: t
  65129. })
  65130. }
  65131. return !1
  65132. }, _.listenerCount = function(e) {
  65133. return this._emitter.listenerCount(e)
  65134. }, _.destroy = function() {
  65135. h.logger.log("destroy"), this.trigger(m.Events.DESTROYING, void 0), this.detachMedia(), this
  65136. .removeAllListeners(), this._autoLevelCapping = -1, this.url = null, this.networkControllers
  65137. .forEach(function(e) {
  65138. return e.destroy()
  65139. }), this.networkControllers.length = 0, this.coreComponents.forEach(function(e) {
  65140. return e.destroy()
  65141. }), this.coreComponents.length = 0
  65142. }, _.attachMedia = function(e) {
  65143. h.logger.log("attachMedia"), this._media = e, this.trigger(m.Events.MEDIA_ATTACHING, {
  65144. media: e
  65145. })
  65146. }, _.detachMedia = function() {
  65147. h.logger.log("detachMedia"), this.trigger(m.Events.MEDIA_DETACHING, void 0), this._media = null
  65148. }, _.loadSource = function(e) {
  65149. this.stopLoad();
  65150. var t = this.media,
  65151. i = this.url,
  65152. n = this.url = r.buildAbsoluteURL(self.location.href, e, {
  65153. alwaysNormalize: !0
  65154. });
  65155. h.logger.log("loadSource:" + n), t && i && i !== n && this.bufferController.hasSourceTypes() &&
  65156. (this.detachMedia(), this.attachMedia(t)), this.trigger(m.Events.MANIFEST_LOADING, {
  65157. url: e
  65158. })
  65159. }, _.startLoad = function(e) {
  65160. void 0 === e && (e = -1), h.logger.log("startLoad(" + e + ")"), this.networkControllers.forEach(
  65161. function(t) {
  65162. t.startLoad(e)
  65163. })
  65164. }, _.stopLoad = function() {
  65165. h.logger.log("stopLoad"), this.networkControllers.forEach(function(e) {
  65166. e.stopLoad()
  65167. })
  65168. }, _.swapAudioCodec = function() {
  65169. h.logger.log("swapAudioCodec"), this.streamController.swapAudioCodec()
  65170. }, _.recoverMediaError = function() {
  65171. h.logger.log("recoverMediaError");
  65172. var e = this._media;
  65173. this.detachMedia(), e && this.attachMedia(e)
  65174. }, _.removeLevel = function(e, t) {
  65175. void 0 === t && (t = 0), this.levelController.removeLevel(e, t)
  65176. }, t = e, y = [{
  65177. key: "version",
  65178. get: function() {}
  65179. }, {
  65180. key: "Events",
  65181. get: function() {
  65182. return m.Events
  65183. }
  65184. }, {
  65185. key: "ErrorTypes",
  65186. get: function() {
  65187. return g.ErrorTypes
  65188. }
  65189. }, {
  65190. key: "ErrorDetails",
  65191. get: function() {
  65192. return g.ErrorDetails
  65193. }
  65194. }, {
  65195. key: "DefaultConfig",
  65196. get: function() {
  65197. return e.defaultConfig ? e.defaultConfig : f.hlsDefaultConfig
  65198. },
  65199. set: function(t) {
  65200. e.defaultConfig = t
  65201. }
  65202. }], (i = [{
  65203. key: "levels",
  65204. get: function() {
  65205. var e = this.levelController.levels;
  65206. return e || []
  65207. }
  65208. }, {
  65209. key: "currentLevel",
  65210. get: function() {
  65211. return this.streamController.currentLevel
  65212. },
  65213. set: function(e) {
  65214. h.logger.log("set currentLevel:" + e), this.loadLevel = e, this.abrController
  65215. .clearTimer(), this.streamController.immediateLevelSwitch()
  65216. }
  65217. }, {
  65218. key: "nextLevel",
  65219. get: function() {
  65220. return this.streamController.nextLevel
  65221. },
  65222. set: function(e) {
  65223. h.logger.log("set nextLevel:" + e), this.levelController.manualLevel = e, this
  65224. .streamController.nextLevelSwitch()
  65225. }
  65226. }, {
  65227. key: "loadLevel",
  65228. get: function() {
  65229. return this.levelController.level
  65230. },
  65231. set: function(e) {
  65232. h.logger.log("set loadLevel:" + e), this.levelController.manualLevel = e
  65233. }
  65234. }, {
  65235. key: "nextLoadLevel",
  65236. get: function() {
  65237. return this.levelController.nextLoadLevel
  65238. },
  65239. set: function(e) {
  65240. this.levelController.nextLoadLevel = e
  65241. }
  65242. }, {
  65243. key: "firstLevel",
  65244. get: function() {
  65245. return Math.max(this.levelController.firstLevel, this.minAutoLevel)
  65246. },
  65247. set: function(e) {
  65248. h.logger.log("set firstLevel:" + e), this.levelController.firstLevel = e
  65249. }
  65250. }, {
  65251. key: "startLevel",
  65252. get: function() {
  65253. return this.levelController.startLevel
  65254. },
  65255. set: function(e) {
  65256. h.logger.log("set startLevel:" + e), -1 !== e && (e = Math.max(e, this.minAutoLevel)),
  65257. this.levelController.startLevel = e
  65258. }
  65259. }, {
  65260. key: "capLevelToPlayerSize",
  65261. get: function() {
  65262. return this.config.capLevelToPlayerSize
  65263. },
  65264. set: function(e) {
  65265. var t = !!e;
  65266. t !== this.config.capLevelToPlayerSize && (t ? this.capLevelController.startCapping() :
  65267. (this.capLevelController.stopCapping(), this.autoLevelCapping = -1, this
  65268. .streamController.nextLevelSwitch()), this.config.capLevelToPlayerSize = t)
  65269. }
  65270. }, {
  65271. key: "autoLevelCapping",
  65272. get: function() {
  65273. return this._autoLevelCapping
  65274. },
  65275. set: function(e) {
  65276. this._autoLevelCapping !== e && (h.logger.log("set autoLevelCapping:" + e), this
  65277. ._autoLevelCapping = e)
  65278. }
  65279. }, {
  65280. key: "bandwidthEstimate",
  65281. get: function() {
  65282. var e = this.abrController.bwEstimator;
  65283. return e ? e.getEstimate() : NaN
  65284. }
  65285. }, {
  65286. key: "autoLevelEnabled",
  65287. get: function() {
  65288. return -1 === this.levelController.manualLevel
  65289. }
  65290. }, {
  65291. key: "manualLevel",
  65292. get: function() {
  65293. return this.levelController.manualLevel
  65294. }
  65295. }, {
  65296. key: "minAutoLevel",
  65297. get: function() {
  65298. var e = this.levels,
  65299. t = this.config.minAutoBitrate;
  65300. if (!e) return 0;
  65301. for (var i = e.length, r = 0; r < i; r++)
  65302. if (e[r].maxBitrate >= t) return r;
  65303. return 0
  65304. }
  65305. }, {
  65306. key: "maxAutoLevel",
  65307. get: function() {
  65308. var e = this.levels,
  65309. t = this.autoLevelCapping;
  65310. return -1 === t && e && e.length ? e.length - 1 : t
  65311. }
  65312. }, {
  65313. key: "nextAutoLevel",
  65314. get: function() {
  65315. return Math.min(Math.max(this.abrController.nextAutoLevel, this.minAutoLevel), this
  65316. .maxAutoLevel)
  65317. },
  65318. set: function(e) {
  65319. this.abrController.nextAutoLevel = Math.max(this.minAutoLevel, e)
  65320. }
  65321. }, {
  65322. key: "audioTracks",
  65323. get: function() {
  65324. var e = this.audioTrackController;
  65325. return e ? e.audioTracks : []
  65326. }
  65327. }, {
  65328. key: "audioTrack",
  65329. get: function() {
  65330. var e = this.audioTrackController;
  65331. return e ? e.audioTrack : -1
  65332. },
  65333. set: function(e) {
  65334. var t = this.audioTrackController;
  65335. t && (t.audioTrack = e)
  65336. }
  65337. }, {
  65338. key: "subtitleTracks",
  65339. get: function() {
  65340. var e = this.subtitleTrackController;
  65341. return e ? e.subtitleTracks : []
  65342. }
  65343. }, {
  65344. key: "subtitleTrack",
  65345. get: function() {
  65346. var e = this.subtitleTrackController;
  65347. return e ? e.subtitleTrack : -1
  65348. },
  65349. set: function(e) {
  65350. var t = this.subtitleTrackController;
  65351. t && (t.subtitleTrack = e)
  65352. }
  65353. }, {
  65354. key: "media",
  65355. get: function() {
  65356. return this._media
  65357. }
  65358. }, {
  65359. key: "subtitleDisplay",
  65360. get: function() {
  65361. var e = this.subtitleTrackController;
  65362. return !!e && e.subtitleDisplay
  65363. },
  65364. set: function(e) {
  65365. var t = this.subtitleTrackController;
  65366. t && (t.subtitleDisplay = e)
  65367. }
  65368. }, {
  65369. key: "lowLatencyMode",
  65370. get: function() {
  65371. return this.config.lowLatencyMode
  65372. },
  65373. set: function(e) {
  65374. this.config.lowLatencyMode = e
  65375. }
  65376. }, {
  65377. key: "liveSyncPosition",
  65378. get: function() {
  65379. return this.latencyController.liveSyncPosition
  65380. }
  65381. }, {
  65382. key: "latency",
  65383. get: function() {
  65384. return this.latencyController.latency
  65385. }
  65386. }, {
  65387. key: "maxLatency",
  65388. get: function() {
  65389. return this.latencyController.maxLatency
  65390. }
  65391. }, {
  65392. key: "targetLatency",
  65393. get: function() {
  65394. return this.latencyController.targetLatency
  65395. }
  65396. }, {
  65397. key: "drift",
  65398. get: function() {
  65399. return this.latencyController.drift
  65400. }
  65401. }, {
  65402. key: "forceStartLoad",
  65403. get: function() {
  65404. return this.streamController.forceStartLoad
  65405. }
  65406. }]) && v(t.prototype, i), y && v(t, y), Object.defineProperty(t, "prototype", {
  65407. writable: !1
  65408. }), e
  65409. }();
  65410. y.defaultConfig = void 0
  65411. },
  65412. "./src/is-supported.ts": function(e, t, i) {
  65413. "use strict";
  65414. i.r(t), i.d(t, "isSupported", function() {
  65415. return a
  65416. }), i.d(t, "changeTypeSupported", function() {
  65417. return s
  65418. });
  65419. var r = i("./src/utils/mediasource-helper.ts");
  65420. function n() {
  65421. return self.SourceBuffer || self.WebKitSourceBuffer
  65422. }
  65423. function a() {
  65424. var e = Object(r.getMediaSource)();
  65425. if (!e) return !1;
  65426. var t = n(),
  65427. i = e && "function" == typeof e.isTypeSupported && e.isTypeSupported(
  65428. 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),
  65429. a = !t || t.prototype && "function" == typeof t.prototype.appendBuffer && "function" == typeof t
  65430. .prototype.remove;
  65431. return !!i && !!a
  65432. }
  65433. function s() {
  65434. var e, t = n();
  65435. return "function" == typeof(null === t || void 0 === t ? void 0 : null === (e = t.prototype) ||
  65436. void 0 === e ? void 0 : e.changeType)
  65437. }
  65438. },
  65439. "./src/loader/fragment-loader.ts": function(e, t, i) {
  65440. "use strict";
  65441. i.r(t), i.d(t, "default", function() {
  65442. return c
  65443. }), i.d(t, "LoadError", function() {
  65444. return f
  65445. });
  65446. var r = i("./src/polyfills/number.ts"),
  65447. n = i("./src/errors.ts"),
  65448. a = i("./src/events.ts");
  65449. function s(e) {
  65450. var t = "function" == typeof Map ? new Map : void 0;
  65451. return (s = function(e) {
  65452. if (null === e || (i = e, -1 === Function.toString.call(i).indexOf("[native code]"))) return e;
  65453. var i;
  65454. if ("function" != typeof e) throw new TypeError(
  65455. "Super expression must either be null or a function");
  65456. if (void 0 !== t) {
  65457. if (t.has(e)) return t.get(e);
  65458. t.set(e, r)
  65459. }
  65460. function r() {
  65461. return o(e, arguments, l(this).constructor)
  65462. }
  65463. return r.prototype = Object.create(e.prototype, {
  65464. constructor: {
  65465. value: r,
  65466. enumerable: !1,
  65467. writable: !0,
  65468. configurable: !0
  65469. }
  65470. }), u(r, e)
  65471. })(e)
  65472. }
  65473. function o(e, t, i) {
  65474. return (o = function() {
  65475. if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  65476. if (Reflect.construct.sham) return !1;
  65477. if ("function" == typeof Proxy) return !0;
  65478. try {
  65479. return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0
  65480. } catch (e) {
  65481. return !1
  65482. }
  65483. }() ? Reflect.construct.bind() : function(e, t, i) {
  65484. var r = [null];
  65485. r.push.apply(r, t);
  65486. var n = new(Function.bind.apply(e, r));
  65487. return i && u(n, i.prototype), n
  65488. }).apply(null, arguments)
  65489. }
  65490. function u(e, t) {
  65491. return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  65492. return e.__proto__ = t, e
  65493. })(e, t)
  65494. }
  65495. function l(e) {
  65496. return (l = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
  65497. return e.__proto__ || Object.getPrototypeOf(e)
  65498. })(e)
  65499. }
  65500. var d = Math.pow(2, 17),
  65501. c = function() {
  65502. function e(e, t) {
  65503. this.config = void 0, this.loader = null, this.partLoadTimeout = -1, this.magic = void 0, this
  65504. .index = void 0, this.hls = void 0, this.hls = t, this.config = e, this.magic = [], this.index =
  65505. 0
  65506. }
  65507. var t = e.prototype;
  65508. return t.destroy = function() {
  65509. this.loader && (this.loader.destroy(), this.loader = null)
  65510. }, t.abort = function() {
  65511. this.loader && this.loader.abort()
  65512. }, t.load = function(e, t) {
  65513. var i = this,
  65514. r = e.url;
  65515. if (!r) return Promise.reject(new f({
  65516. type: n.ErrorTypes.NETWORK_ERROR,
  65517. details: n.ErrorDetails.FRAG_LOAD_ERROR,
  65518. fatal: !1,
  65519. frag: e,
  65520. networkDetails: null
  65521. }, "Fragment does not have a " + (r ? "part list" : "url")));
  65522. this.abort();
  65523. var s = this.config,
  65524. o = s.fLoader,
  65525. u = s.loader;
  65526. return new Promise(function(r, l) {
  65527. i.loader && i.loader.destroy();
  65528. var c = i.loader = e.loader = o ? new o(s) : new u(s),
  65529. p = h(e),
  65530. m = {
  65531. timeout: s.fragLoadingTimeOut,
  65532. maxRetry: 0,
  65533. retryDelay: 0,
  65534. maxRetryDelay: s.fragLoadingMaxRetryTimeout,
  65535. highWaterMark: "initSegment" === e.sn ? 1 / 0 : d
  65536. };
  65537. e.stats = c.stats, c.load(p, m, {
  65538. onSuccess: function(t, n, s, o) {
  65539. i.hls.trigger(a.Events.RECORDING, {
  65540. data: t.data
  65541. }), r({
  65542. frag: e,
  65543. part: null,
  65544. payload: t.data,
  65545. networkDetails: o
  65546. })
  65547. },
  65548. onError: function(t, r, a) {
  65549. i.resetLoader(e, c), l(new f({
  65550. type: n.ErrorTypes.NETWORK_ERROR,
  65551. details: n.ErrorDetails.FRAG_LOAD_ERROR,
  65552. fatal: !1,
  65553. frag: e,
  65554. response: t,
  65555. networkDetails: a
  65556. }))
  65557. },
  65558. onAbort: function(t, r, a) {
  65559. i.resetLoader(e, c), l(new f({
  65560. type: n.ErrorTypes.NETWORK_ERROR,
  65561. details: n.ErrorDetails.INTERNAL_ABORTED,
  65562. fatal: !1,
  65563. frag: e,
  65564. networkDetails: a
  65565. }))
  65566. },
  65567. onTimeout: function(t, r, a) {
  65568. i.resetLoader(e, c), l(new f({
  65569. type: n.ErrorTypes.NETWORK_ERROR,
  65570. details: n.ErrorDetails.FRAG_LOAD_TIMEOUT,
  65571. fatal: !1,
  65572. frag: e,
  65573. networkDetails: a
  65574. }))
  65575. },
  65576. onProgress: function(i, r, n, a) {
  65577. t && t({
  65578. frag: e,
  65579. part: null,
  65580. payload: n,
  65581. networkDetails: a
  65582. })
  65583. }
  65584. })
  65585. })
  65586. }, t.loadPart = function(e, t, i) {
  65587. var r = this;
  65588. this.abort();
  65589. var a = this.config,
  65590. s = a.fLoader,
  65591. o = a.loader;
  65592. return new Promise(function(u, l) {
  65593. r.loader && r.loader.destroy();
  65594. var c = r.loader = e.loader = s ? new s(a) : new o(a),
  65595. p = h(e, t),
  65596. m = {
  65597. timeout: a.fragLoadingTimeOut,
  65598. maxRetry: 0,
  65599. retryDelay: 0,
  65600. maxRetryDelay: a.fragLoadingMaxRetryTimeout,
  65601. highWaterMark: d
  65602. };
  65603. t.stats = c.stats, c.load(p, m, {
  65604. onSuccess: function(n, a, s, o) {
  65605. r.resetLoader(e, c), r.updateStatsFromPart(e, t);
  65606. var l = {
  65607. frag: e,
  65608. part: t,
  65609. payload: n.data,
  65610. networkDetails: o
  65611. };
  65612. i(l), u(l)
  65613. },
  65614. onError: function(i, a, s) {
  65615. r.resetLoader(e, c), l(new f({
  65616. type: n.ErrorTypes.NETWORK_ERROR,
  65617. details: n.ErrorDetails.FRAG_LOAD_ERROR,
  65618. fatal: !1,
  65619. frag: e,
  65620. part: t,
  65621. response: i,
  65622. networkDetails: s
  65623. }))
  65624. },
  65625. onAbort: function(i, a, s) {
  65626. e.stats.aborted = t.stats.aborted, r.resetLoader(e, c), l(new f({
  65627. type: n.ErrorTypes.NETWORK_ERROR,
  65628. details: n.ErrorDetails.INTERNAL_ABORTED,
  65629. fatal: !1,
  65630. frag: e,
  65631. part: t,
  65632. networkDetails: s
  65633. }))
  65634. },
  65635. onTimeout: function(i, a, s) {
  65636. r.resetLoader(e, c), l(new f({
  65637. type: n.ErrorTypes.NETWORK_ERROR,
  65638. details: n.ErrorDetails.FRAG_LOAD_TIMEOUT,
  65639. fatal: !1,
  65640. frag: e,
  65641. part: t,
  65642. networkDetails: s
  65643. }))
  65644. }
  65645. })
  65646. })
  65647. }, t.updateStatsFromPart = function(e, t) {
  65648. var i = e.stats,
  65649. r = t.stats,
  65650. n = r.total;
  65651. if (i.loaded += r.loaded, n) {
  65652. var a = Math.round(e.duration / t.duration),
  65653. s = Math.min(Math.round(i.loaded / n), a),
  65654. o = (a - s) * Math.round(i.loaded / s);
  65655. i.total = i.loaded + o
  65656. } else i.total = Math.max(i.loaded, i.total);
  65657. var u = i.loading,
  65658. l = r.loading;
  65659. u.start ? u.first += l.first - l.start : (u.start = l.start, u.first = l.first), u.end = l.end
  65660. }, t.resetLoader = function(e, t) {
  65661. e.loader = null, this.loader === t && (self.clearTimeout(this.partLoadTimeout), this.loader =
  65662. null), t.destroy()
  65663. }, e
  65664. }();
  65665. function h(e, t) {
  65666. void 0 === t && (t = null);
  65667. var i = t || e,
  65668. n = {
  65669. frag: e,
  65670. part: t,
  65671. responseType: "arraybuffer",
  65672. url: i.url,
  65673. headers: {},
  65674. rangeStart: 0,
  65675. rangeEnd: 0
  65676. },
  65677. a = i.byteRangeStartOffset,
  65678. s = i.byteRangeEndOffset;
  65679. return Object(r.isFiniteNumber)(a) && Object(r.isFiniteNumber)(s) && (n.rangeStart = a, n.rangeEnd =
  65680. s), n
  65681. }
  65682. var f = function(e) {
  65683. var t, i;
  65684. function r(t) {
  65685. for (var i, r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++) n[a - 1] =
  65686. arguments[a];
  65687. return (i = e.call.apply(e, [this].concat(n)) || this).data = void 0, i.data = t, i
  65688. }
  65689. return i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i),
  65690. r
  65691. }(s(Error))
  65692. },
  65693. "./src/loader/fragment.ts": function(e, t, i) {
  65694. "use strict";
  65695. i.r(t), i.d(t, "ElementaryStreamTypes", function() {
  65696. return r
  65697. }), i.d(t, "BaseSegment", function() {
  65698. return f
  65699. }), i.d(t, "Fragment", function() {
  65700. return p
  65701. }), i.d(t, "Part", function() {
  65702. return m
  65703. });
  65704. var r, n = i("./src/polyfills/number.ts"),
  65705. a = i("./node_modules/url-toolkit/src/url-toolkit.js"),
  65706. s = i("./src/utils/logger.ts"),
  65707. o = i("./src/loader/level-key.ts"),
  65708. u = i("./src/loader/load-stats.ts");
  65709. function l(e, t) {
  65710. e.prototype = Object.create(t.prototype), e.prototype.constructor = e, d(e, t)
  65711. }
  65712. function d(e, t) {
  65713. return (d = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  65714. return e.__proto__ = t, e
  65715. })(e, t)
  65716. }
  65717. function c(e, t) {
  65718. for (var i = 0; i < t.length; i++) {
  65719. var r = t[i];
  65720. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  65721. .defineProperty(e, r.key, r)
  65722. }
  65723. }
  65724. function h(e, t, i) {
  65725. return t && c(e.prototype, t), i && c(e, i), Object.defineProperty(e, "prototype", {
  65726. writable: !1
  65727. }), e
  65728. }! function(e) {
  65729. e.AUDIO = "audio", e.VIDEO = "video", e.AUDIOVIDEO = "audiovideo"
  65730. }(r || (r = {}));
  65731. var f = function() {
  65732. function e(e) {
  65733. var t;
  65734. this._byteRange = null, this._url = null, this.baseurl = void 0, this.relurl = void 0, this
  65735. .elementaryStreams = ((t = {})[r.AUDIO] = null, t[r.VIDEO] = null, t[r.AUDIOVIDEO] = null, t),
  65736. this.baseurl = e
  65737. }
  65738. return e.prototype.setByteRange = function(e, t) {
  65739. var i = e.split("@", 2),
  65740. r = [];
  65741. 1 === i.length ? r[0] = t ? t.byteRangeEndOffset : 0 : r[0] = parseInt(i[1]), r[1] = parseInt(i[
  65742. 0]) + r[0], this._byteRange = r
  65743. }, h(e, [{
  65744. key: "byteRange",
  65745. get: function() {
  65746. return this._byteRange ? this._byteRange : []
  65747. }
  65748. }, {
  65749. key: "byteRangeStartOffset",
  65750. get: function() {
  65751. return this.byteRange[0]
  65752. }
  65753. }, {
  65754. key: "byteRangeEndOffset",
  65755. get: function() {
  65756. return this.byteRange[1]
  65757. }
  65758. }, {
  65759. key: "url",
  65760. get: function() {
  65761. return !this._url && this.baseurl && this.relurl && (this._url = Object(a
  65762. .buildAbsoluteURL)(this.baseurl, this.relurl, {
  65763. alwaysNormalize: !0
  65764. })), this._url || ""
  65765. },
  65766. set: function(e) {
  65767. this._url = e
  65768. }
  65769. }]), e
  65770. }(),
  65771. p = function(e) {
  65772. function t(t, i) {
  65773. var r;
  65774. return (r = e.call(this, i) || this)._decryptdata = null, r.rawProgramDateTime = null, r
  65775. .programDateTime = null, r.tagList = [], r.duration = 0, r.sn = 0, r.levelkey = void 0, r.type =
  65776. void 0, r.loader = null, r.level = -1, r.cc = 0, r.startPTS = void 0, r.endPTS = void 0, r
  65777. .appendedPTS = void 0, r.startDTS = void 0, r.endDTS = void 0, r.start = 0, r.deltaPTS = void 0,
  65778. r.maxStartPTS = void 0, r.minEndPTS = void 0, r.stats = new u.LoadStats, r.urlId = 0, r.data =
  65779. void 0, r.bitrateTest = !1, r.title = null, r.initSegment = null, r.type = t, r
  65780. }
  65781. l(t, e);
  65782. var i = t.prototype;
  65783. return i.createInitializationVector = function(e) {
  65784. for (var t = new Uint8Array(16), i = 12; i < 16; i++) t[i] = e >> 8 * (15 - i) & 255;
  65785. return t
  65786. }, i.setDecryptDataFromLevelKey = function(e, t) {
  65787. var i = e;
  65788. return "AES-128" === (null === e || void 0 === e ? void 0 : e.method) && e.uri && !e.iv && ((i =
  65789. o.LevelKey.fromURI(e.uri)).method = e.method, i.iv = this.createInitializationVector(t), i
  65790. .keyFormat = "identity"), i
  65791. }, i.setElementaryStreamInfo = function(e, t, i, r, n, a) {
  65792. void 0 === a && (a = !1);
  65793. var s = this.elementaryStreams,
  65794. o = s[e];
  65795. o ? (o.startPTS = Math.min(o.startPTS, t), o.endPTS = Math.max(o.endPTS, i), o.startDTS = Math
  65796. .min(o.startDTS, r), o.endDTS = Math.max(o.endDTS, n)) : s[e] = {
  65797. startPTS: t,
  65798. endPTS: i,
  65799. startDTS: r,
  65800. endDTS: n,
  65801. partial: a
  65802. }
  65803. }, i.clearElementaryStreamInfo = function() {
  65804. var e = this.elementaryStreams;
  65805. e[r.AUDIO] = null, e[r.VIDEO] = null, e[r.AUDIOVIDEO] = null
  65806. }, h(t, [{
  65807. key: "decryptdata",
  65808. get: function() {
  65809. if (!this.levelkey && !this._decryptdata) return null;
  65810. if (!this._decryptdata && this.levelkey) {
  65811. var e = this.sn;
  65812. "number" != typeof e && (this.levelkey && "AES-128" === this.levelkey.method && !this
  65813. .levelkey.iv && s.logger.warn(
  65814. 'missing IV for initialization segment with method="' + this.levelkey.method +
  65815. '" - compliance issue'), e = 0), this._decryptdata = this
  65816. .setDecryptDataFromLevelKey(this.levelkey, e)
  65817. }
  65818. return this._decryptdata
  65819. }
  65820. }, {
  65821. key: "end",
  65822. get: function() {
  65823. return this.start + this.duration
  65824. }
  65825. }, {
  65826. key: "endProgramDateTime",
  65827. get: function() {
  65828. if (null === this.programDateTime) return null;
  65829. if (!Object(n.isFiniteNumber)(this.programDateTime)) return null;
  65830. var e = Object(n.isFiniteNumber)(this.duration) ? this.duration : 0;
  65831. return this.programDateTime + 1e3 * e
  65832. }
  65833. }, {
  65834. key: "encrypted",
  65835. get: function() {
  65836. var e;
  65837. return !(null === (e = this.decryptdata) || void 0 === e || !e.keyFormat || !this
  65838. .decryptdata.uri)
  65839. }
  65840. }]), t
  65841. }(f),
  65842. m = function(e) {
  65843. function t(t, i, r, n, a) {
  65844. var s;
  65845. (s = e.call(this, r) || this).fragOffset = 0, s.duration = 0, s.gap = !1, s.independent = !1, s
  65846. .relurl = void 0, s.fragment = void 0, s.index = void 0, s.stats = new u.LoadStats, s.duration =
  65847. t.decimalFloatingPoint("DURATION"), s.gap = t.bool("GAP"), s.independent = t.bool(
  65848. "INDEPENDENT"), s.relurl = t.enumeratedString("URI"), s.fragment = i, s.index = n;
  65849. var o = t.enumeratedString("BYTERANGE");
  65850. return o && s.setByteRange(o, a), a && (s.fragOffset = a.fragOffset + a.duration), s
  65851. }
  65852. return l(t, e), h(t, [{
  65853. key: "start",
  65854. get: function() {
  65855. return this.fragment.start + this.fragOffset
  65856. }
  65857. }, {
  65858. key: "end",
  65859. get: function() {
  65860. return this.start + this.duration
  65861. }
  65862. }, {
  65863. key: "loaded",
  65864. get: function() {
  65865. var e = this.elementaryStreams;
  65866. return !!(e.audio || e.video || e.audiovideo)
  65867. }
  65868. }]), t
  65869. }(f)
  65870. },
  65871. "./src/loader/key-loader.ts": function(e, t, i) {
  65872. "use strict";
  65873. i.r(t), i.d(t, "default", function() {
  65874. return s
  65875. });
  65876. var r = i("./src/events.ts"),
  65877. n = i("./src/errors.ts"),
  65878. a = i("./src/utils/logger.ts"),
  65879. s = function() {
  65880. function e(e) {
  65881. this.hls = void 0, this.loaders = {}, this.decryptkey = null, this.decrypturl = null, this.hls =
  65882. e, this._registerListeners()
  65883. }
  65884. var t = e.prototype;
  65885. return t._registerListeners = function() {
  65886. this.hls.on(r.Events.KEY_LOADING, this.onKeyLoading, this)
  65887. }, t._unregisterListeners = function() {
  65888. this.hls.off(r.Events.KEY_LOADING, this.onKeyLoading)
  65889. }, t.destroy = function() {
  65890. for (var e in this._unregisterListeners(), this.loaders) {
  65891. var t = this.loaders[e];
  65892. t && t.destroy()
  65893. }
  65894. this.loaders = {}
  65895. }, t.onKeyLoading = function(e, t) {
  65896. var i = t.frag,
  65897. n = i.type,
  65898. s = this.loaders[n];
  65899. if (i.decryptdata) {
  65900. var o = i.decryptdata.uri;
  65901. if (o !== this.decrypturl || null === this.decryptkey) {
  65902. var u = this.hls.config;
  65903. if (s && (a.logger.warn("abort previous key loader for type:" + n), s.abort()), !o)
  65904. return void a.logger.warn("key uri is falsy");
  65905. var l = u.loader,
  65906. d = i.loader = this.loaders[n] = new l(u);
  65907. this.decrypturl = o, this.decryptkey = null;
  65908. var c = {
  65909. url: o,
  65910. frag: i,
  65911. responseType: "arraybuffer"
  65912. },
  65913. h = {
  65914. timeout: u.fragLoadingTimeOut,
  65915. maxRetry: 0,
  65916. retryDelay: u.fragLoadingRetryDelay,
  65917. maxRetryDelay: u.fragLoadingMaxRetryTimeout,
  65918. highWaterMark: 0
  65919. },
  65920. f = {
  65921. onSuccess: this.loadsuccess.bind(this),
  65922. onError: this.loaderror.bind(this),
  65923. onTimeout: this.loadtimeout.bind(this)
  65924. };
  65925. d.load(c, h, f)
  65926. } else this.decryptkey && (i.decryptdata.key = this.decryptkey, this.hls.trigger(r.Events
  65927. .KEY_LOADED, {
  65928. frag: i
  65929. }))
  65930. } else a.logger.warn("Missing decryption data on fragment in onKeyLoading")
  65931. }, t.loadsuccess = function(e, t, i) {
  65932. var n = i.frag;
  65933. n.decryptdata ? (this.decryptkey = n.decryptdata.key = new Uint8Array(e.data), n.loader = null,
  65934. delete this.loaders[n.type], this.hls.trigger(r.Events.KEY_LOADED, {
  65935. frag: n
  65936. })) : a.logger.error("after key load, decryptdata unset")
  65937. }, t.loaderror = function(e, t) {
  65938. var i = t.frag,
  65939. a = i.loader;
  65940. a && a.abort(), delete this.loaders[i.type], this.hls.trigger(r.Events.ERROR, {
  65941. type: n.ErrorTypes.NETWORK_ERROR,
  65942. details: n.ErrorDetails.KEY_LOAD_ERROR,
  65943. fatal: !1,
  65944. frag: i,
  65945. response: e
  65946. })
  65947. }, t.loadtimeout = function(e, t) {
  65948. var i = t.frag,
  65949. a = i.loader;
  65950. a && a.abort(), delete this.loaders[i.type], this.hls.trigger(r.Events.ERROR, {
  65951. type: n.ErrorTypes.NETWORK_ERROR,
  65952. details: n.ErrorDetails.KEY_LOAD_TIMEOUT,
  65953. fatal: !1,
  65954. frag: i
  65955. })
  65956. }, e
  65957. }()
  65958. },
  65959. "./src/loader/level-details.ts": function(e, t, i) {
  65960. "use strict";
  65961. i.r(t), i.d(t, "LevelDetails", function() {
  65962. return a
  65963. });
  65964. var r = i("./src/polyfills/number.ts");
  65965. function n(e, t) {
  65966. for (var i = 0; i < t.length; i++) {
  65967. var r = t[i];
  65968. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  65969. .defineProperty(e, r.key, r)
  65970. }
  65971. }
  65972. var a = function() {
  65973. function e(e) {
  65974. this.PTSKnown = !1, this.alignedSliding = !1, this.averagetargetduration = void 0, this.endCC = 0,
  65975. this.endSN = 0, this.fragments = void 0, this.fragmentHint = void 0, this.partList = null, this
  65976. .live = !0, this.ageHeader = 0, this.advancedDateTime = void 0, this.updated = !0, this
  65977. .advanced = !0, this.availabilityDelay = void 0, this.misses = 0, this.needSidxRanges = !1, this
  65978. .startCC = 0, this.startSN = 0, this.startTimeOffset = null, this.targetduration = 0, this
  65979. .totalduration = 0, this.type = null, this.url = void 0, this.m3u8 = "", this.version = null,
  65980. this.canBlockReload = !1, this.canSkipUntil = 0, this.canSkipDateRanges = !1, this
  65981. .skippedSegments = 0, this.recentlyRemovedDateranges = void 0, this.partHoldBack = 0, this
  65982. .holdBack = 0, this.partTarget = 0, this.preloadHint = void 0, this.renditionReports = void 0,
  65983. this.tuneInGoal = 0, this.deltaUpdateFailed = void 0, this.driftStartTime = 0, this
  65984. .driftEndTime = 0, this.driftStart = 0, this.driftEnd = 0, this.fragments = [], this.url = e
  65985. }
  65986. var t, i, a;
  65987. return e.prototype.reloaded = function(e) {
  65988. if (!e) return this.advanced = !0, void(this.updated = !0);
  65989. var t = this.lastPartSn - e.lastPartSn,
  65990. i = this.lastPartIndex - e.lastPartIndex;
  65991. this.updated = this.endSN !== e.endSN || !!i || !!t, this.advanced = this.endSN > e.endSN || t >
  65992. 0 || 0 === t && i > 0, this.updated || this.advanced ? this.misses = Math.floor(.6 * e
  65993. .misses) : this.misses = e.misses + 1, this.availabilityDelay = e.availabilityDelay
  65994. }, t = e, (i = [{
  65995. key: "hasProgramDateTime",
  65996. get: function() {
  65997. return !!this.fragments.length && Object(r.isFiniteNumber)(this.fragments[this.fragments
  65998. .length - 1].programDateTime)
  65999. }
  66000. }, {
  66001. key: "levelTargetDuration",
  66002. get: function() {
  66003. return this.averagetargetduration || this.targetduration || 10
  66004. }
  66005. }, {
  66006. key: "drift",
  66007. get: function() {
  66008. var e = this.driftEndTime - this.driftStartTime;
  66009. return e > 0 ? 1e3 * (this.driftEnd - this.driftStart) / e : 1
  66010. }
  66011. }, {
  66012. key: "edge",
  66013. get: function() {
  66014. return this.partEnd || this.fragmentEnd
  66015. }
  66016. }, {
  66017. key: "partEnd",
  66018. get: function() {
  66019. var e;
  66020. return null !== (e = this.partList) && void 0 !== e && e.length ? this.partList[this
  66021. .partList.length - 1].end : this.fragmentEnd
  66022. }
  66023. }, {
  66024. key: "fragmentEnd",
  66025. get: function() {
  66026. var e;
  66027. return null !== (e = this.fragments) && void 0 !== e && e.length ? this.fragments[this
  66028. .fragments.length - 1].end : 0
  66029. }
  66030. }, {
  66031. key: "age",
  66032. get: function() {
  66033. return this.advancedDateTime ? Math.max(Date.now() - this.advancedDateTime, 0) / 1e3 : 0
  66034. }
  66035. }, {
  66036. key: "lastPartIndex",
  66037. get: function() {
  66038. var e;
  66039. return null !== (e = this.partList) && void 0 !== e && e.length ? this.partList[this
  66040. .partList.length - 1].index : -1
  66041. }
  66042. }, {
  66043. key: "lastPartSn",
  66044. get: function() {
  66045. var e;
  66046. return null !== (e = this.partList) && void 0 !== e && e.length ? this.partList[this
  66047. .partList.length - 1].fragment.sn : this.endSN
  66048. }
  66049. }]) && n(t.prototype, i), a && n(t, a), Object.defineProperty(t, "prototype", {
  66050. writable: !1
  66051. }), e
  66052. }()
  66053. },
  66054. "./src/loader/level-key.ts": function(e, t, i) {
  66055. "use strict";
  66056. i.r(t), i.d(t, "LevelKey", function() {
  66057. return a
  66058. });
  66059. var r = i("./node_modules/url-toolkit/src/url-toolkit.js");
  66060. function n(e, t) {
  66061. for (var i = 0; i < t.length; i++) {
  66062. var r = t[i];
  66063. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  66064. .defineProperty(e, r.key, r)
  66065. }
  66066. }
  66067. var a = function() {
  66068. function e(e, t) {
  66069. this._uri = null, this.method = null, this.keyFormat = null, this.keyFormatVersions = null, this
  66070. .keyID = null, this.key = null, this.iv = null, this._uri = t ? Object(r.buildAbsoluteURL)(e,
  66071. t, {
  66072. alwaysNormalize: !0
  66073. }) : e
  66074. }
  66075. var t, i, a;
  66076. return e.fromURL = function(t, i) {
  66077. return new e(t, i)
  66078. }, e.fromURI = function(t) {
  66079. return new e(t)
  66080. }, t = e, (i = [{
  66081. key: "uri",
  66082. get: function() {
  66083. return this._uri
  66084. }
  66085. }]) && n(t.prototype, i), a && n(t, a), Object.defineProperty(t, "prototype", {
  66086. writable: !1
  66087. }), e
  66088. }()
  66089. },
  66090. "./src/loader/load-stats.ts": function(e, t, i) {
  66091. "use strict";
  66092. i.r(t), i.d(t, "LoadStats", function() {
  66093. return r
  66094. });
  66095. var r = function() {
  66096. this.aborted = !1, this.loaded = 0, this.retry = 0, this.total = 0, this.chunkCount = 0, this
  66097. .bwEstimate = 0, this.loading = {
  66098. start: 0,
  66099. first: 0,
  66100. end: 0
  66101. }, this.parsing = {
  66102. start: 0,
  66103. end: 0
  66104. }, this.buffering = {
  66105. start: 0,
  66106. first: 0,
  66107. end: 0
  66108. }
  66109. }
  66110. },
  66111. "./src/loader/m3u8-parser.ts": function(e, t, i) {
  66112. "use strict";
  66113. i.r(t), i.d(t, "default", function() {
  66114. return g
  66115. });
  66116. var r = i("./src/polyfills/number.ts"),
  66117. n = i("./node_modules/url-toolkit/src/url-toolkit.js"),
  66118. a = i("./src/loader/fragment.ts"),
  66119. s = i("./src/loader/level-details.ts"),
  66120. o = i("./src/loader/level-key.ts"),
  66121. u = i("./src/utils/attr-list.ts"),
  66122. l = i("./src/utils/logger.ts"),
  66123. d = i("./src/utils/codecs.ts"),
  66124. c =
  66125. /#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,
  66126. h = /#EXT-X-MEDIA:(.*)/g,
  66127. f = new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source, /(?!#) *(\S[\S ]*)/.source,
  66128. /#EXT-X-BYTERANGE:*(.+)/.source, /#EXT-X-PROGRAM-DATE-TIME:(.+)/.source, /#.*/.source
  66129. ].join("|"), "g"),
  66130. p = new RegExp([/#(EXTM3U)/.source, /#EXT-X-(PLAYLIST-TYPE):(.+)/.source,
  66131. /#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source, /#EXT-X-(SKIP):(.+)/.source,
  66132. /#EXT-X-(TARGETDURATION): *(\d+)/.source, /#EXT-X-(KEY):(.+)/.source, /#EXT-X-(START):(.+)/
  66133. .source, /#EXT-X-(ENDLIST)/.source, /#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,
  66134. /#EXT-X-(DIS)CONTINUITY/.source, /#EXT-X-(VERSION):(\d+)/.source, /#EXT-X-(MAP):(.+)/.source,
  66135. /#EXT-X-(SERVER-CONTROL):(.+)/.source, /#EXT-X-(PART-INF):(.+)/.source, /#EXT-X-(GAP)/.source,
  66136. /#EXT-X-(BITRATE):\s*(\d+)/.source, /#EXT-X-(PART):(.+)/.source, /#EXT-X-(PRELOAD-HINT):(.+)/
  66137. .source, /#EXT-X-(RENDITION-REPORT):(.+)/.source, /(#)([^:]*):(.*)/.source, /(#)(.*)(?:.*)\r?\n?/
  66138. .source
  66139. ].join("|")),
  66140. m = /\.(mp4|m4s|m4v|m4a)$/i;
  66141. var g = function() {
  66142. function e() {}
  66143. return e.findGroup = function(e, t) {
  66144. for (var i = 0; i < e.length; i++) {
  66145. var r = e[i];
  66146. if (r.id === t) return r
  66147. }
  66148. }, e.convertAVC1ToAVCOTI = function(e) {
  66149. var t = e.split(".");
  66150. if (t.length > 2) {
  66151. var i = t.shift() + ".";
  66152. return i += parseInt(t.shift()).toString(16), i += ("000" + parseInt(t.shift()).toString(16))
  66153. .slice(-4)
  66154. }
  66155. return e
  66156. }, e.resolve = function(e, t) {
  66157. return n.buildAbsoluteURL(t, e, {
  66158. alwaysNormalize: !0
  66159. })
  66160. }, e.parseMasterPlaylist = function(t, i) {
  66161. var r, n = [],
  66162. a = {},
  66163. s = !1;
  66164. for (c.lastIndex = 0; null != (r = c.exec(t));)
  66165. if (r[1]) {
  66166. var o = new u.AttrList(r[1]),
  66167. l = {
  66168. attrs: o,
  66169. bitrate: o.decimalInteger("AVERAGE-BANDWIDTH") || o.decimalInteger("BANDWIDTH"),
  66170. name: o.NAME,
  66171. url: e.resolve(r[2], i)
  66172. },
  66173. d = o.decimalResolution("RESOLUTION");
  66174. d && (l.width = d.width, l.height = d.height), v((o.CODECS || "").split(/[ ,]+/).filter(
  66175. function(e) {
  66176. return e
  66177. }), l), l.videoCodec && -1 !== l.videoCodec.indexOf("avc1") && (l.videoCodec = e
  66178. .convertAVC1ToAVCOTI(l.videoCodec)), n.push(l)
  66179. } else if (r[3]) {
  66180. var h = new u.AttrList(r[3]);
  66181. h["DATA-ID"] && (s = !0, a[h["DATA-ID"]] = h)
  66182. }
  66183. return {
  66184. levels: n,
  66185. sessionData: s ? a : null
  66186. }
  66187. }, e.parseMasterPlaylistMedia = function(t, i, r, n) {
  66188. var a;
  66189. void 0 === n && (n = []);
  66190. var s = [],
  66191. o = 0;
  66192. for (h.lastIndex = 0; null !== (a = h.exec(t));) {
  66193. var l = new u.AttrList(a[1]);
  66194. if (l.TYPE === r) {
  66195. var d = {
  66196. attrs: l,
  66197. bitrate: 0,
  66198. id: o++,
  66199. groupId: l["GROUP-ID"],
  66200. instreamId: l["INSTREAM-ID"],
  66201. name: l.NAME || l.LANGUAGE || "",
  66202. type: r,
  66203. default: l.bool("DEFAULT"),
  66204. autoselect: l.bool("AUTOSELECT"),
  66205. forced: l.bool("FORCED"),
  66206. lang: l.LANGUAGE,
  66207. url: l.URI ? e.resolve(l.URI, i) : ""
  66208. };
  66209. if (n.length) {
  66210. var c = e.findGroup(n, d.groupId) || n[0];
  66211. y(d, c, "audioCodec"), y(d, c, "textCodec")
  66212. }
  66213. s.push(d)
  66214. }
  66215. }
  66216. return s
  66217. }, e.parseLevelPlaylist = function(e, t, i, d, c) {
  66218. var h, g, v, y = new s.LevelDetails(t),
  66219. b = y.fragments,
  66220. w = null,
  66221. E = 0,
  66222. T = 0,
  66223. S = 0,
  66224. A = 0,
  66225. k = null,
  66226. R = new a.Fragment(d, t),
  66227. M = -1,
  66228. O = !1;
  66229. for (f.lastIndex = 0, y.m3u8 = e; null !== (h = f.exec(e));) {
  66230. O && (O = !1, (R = new a.Fragment(d, t)).start = S, R.sn = E, R.cc = A, R.level = i, w && (R
  66231. .initSegment = w, R.rawProgramDateTime = w.rawProgramDateTime, w.rawProgramDateTime =
  66232. null));
  66233. var C = h[1];
  66234. if (C) {
  66235. R.duration = parseFloat(C);
  66236. var D = (" " + h[2]).slice(1);
  66237. R.title = D || null, R.tagList.push(D ? ["INF", C, D] : ["INF", C])
  66238. } else if (h[3]) Object(r.isFiniteNumber)(R.duration) && (R.start = S, v && (R.levelkey = v),
  66239. R.sn = E, R.level = i, R.cc = A, R.urlId = c, b.push(R), R.relurl = (" " + h[3]).slice(1),
  66240. _(R, k), k = R, S += R.duration, E++, T = 0, O = !0);
  66241. else if (h[4]) {
  66242. var I = (" " + h[4]).slice(1);
  66243. k ? R.setByteRange(I, k) : R.setByteRange(I)
  66244. } else if (h[5]) R.rawProgramDateTime = (" " + h[5]).slice(1), R.tagList.push([
  66245. "PROGRAM-DATE-TIME", R.rawProgramDateTime
  66246. ]), -1 === M && (M = b.length);
  66247. else {
  66248. if (!(h = h[0].match(p))) {
  66249. l.logger.warn("No matches on slow regex match for level playlist!");
  66250. continue
  66251. }
  66252. for (g = 1; g < h.length && void 0 === h[g]; g++);
  66253. var L = (" " + h[g]).slice(1),
  66254. x = (" " + h[g + 1]).slice(1),
  66255. P = h[g + 2] ? (" " + h[g + 2]).slice(1) : "";
  66256. switch (L) {
  66257. case "PLAYLIST-TYPE":
  66258. y.type = x.toUpperCase();
  66259. break;
  66260. case "MEDIA-SEQUENCE":
  66261. E = y.startSN = parseInt(x);
  66262. break;
  66263. case "SKIP":
  66264. var U = new u.AttrList(x),
  66265. N = U.decimalInteger("SKIPPED-SEGMENTS");
  66266. if (Object(r.isFiniteNumber)(N)) {
  66267. y.skippedSegments = N;
  66268. for (var B = N; B--;) b.unshift(null);
  66269. E += N
  66270. }
  66271. var F = U.enumeratedString("RECENTLY-REMOVED-DATERANGES");
  66272. F && (y.recentlyRemovedDateranges = F.split("\t"));
  66273. break;
  66274. case "TARGETDURATION":
  66275. y.targetduration = parseFloat(x);
  66276. break;
  66277. case "VERSION":
  66278. y.version = parseInt(x);
  66279. break;
  66280. case "EXTM3U":
  66281. break;
  66282. case "ENDLIST":
  66283. y.live = !1;
  66284. break;
  66285. case "#":
  66286. (x || P) && R.tagList.push(P ? [x, P] : [x]);
  66287. break;
  66288. case "DIS":
  66289. A++;
  66290. case "GAP":
  66291. R.tagList.push([L]);
  66292. break;
  66293. case "BITRATE":
  66294. R.tagList.push([L, x]);
  66295. break;
  66296. case "DISCONTINUITY-SEQ":
  66297. A = parseInt(x);
  66298. break;
  66299. case "KEY":
  66300. var j, H = new u.AttrList(x),
  66301. G = H.enumeratedString("METHOD"),
  66302. V = H.URI,
  66303. W = H.hexadecimalInteger("IV"),
  66304. q = H.enumeratedString("KEYFORMATVERSIONS"),
  66305. X = H.enumeratedString("KEYID"),
  66306. z = null != (j = H.enumeratedString("KEYFORMAT")) ? j : "identity";
  66307. if (["com.apple.streamingkeydelivery", "com.microsoft.playready",
  66308. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed", "com.widevine"
  66309. ].indexOf(z) > -1) {
  66310. l.logger.warn("Keyformat " + z + " is not supported from the manifest");
  66311. continue
  66312. }
  66313. if ("identity" !== z) continue;
  66314. G && (v = o.LevelKey.fromURL(t, V), V && ["AES-128", "SAMPLE-AES", "SAMPLE-AES-CENC"]
  66315. .indexOf(G) >= 0 && (v.method = G, v.keyFormat = z, X && (v.keyID = X), q && (v
  66316. .keyFormatVersions = q), v.iv = W));
  66317. break;
  66318. case "START":
  66319. var K = new u.AttrList(x).decimalFloatingPoint("TIME-OFFSET");
  66320. Object(r.isFiniteNumber)(K) && (y.startTimeOffset = K);
  66321. break;
  66322. case "MAP":
  66323. var Y = new u.AttrList(x);
  66324. R.relurl = Y.URI, Y.BYTERANGE && R.setByteRange(Y.BYTERANGE), R.level = i, R.sn =
  66325. "initSegment", v && (R.levelkey = v), R.initSegment = null, w = R, O = !0;
  66326. break;
  66327. case "SERVER-CONTROL":
  66328. var Q = new u.AttrList(x);
  66329. y.canBlockReload = Q.bool("CAN-BLOCK-RELOAD"), y.canSkipUntil = Q.optionalFloat(
  66330. "CAN-SKIP-UNTIL", 0), y.canSkipDateRanges = y.canSkipUntil > 0 && Q.bool(
  66331. "CAN-SKIP-DATERANGES"), y.partHoldBack = Q.optionalFloat("PART-HOLD-BACK", 0), y
  66332. .holdBack = Q.optionalFloat("HOLD-BACK", 0);
  66333. break;
  66334. case "PART-INF":
  66335. var J = new u.AttrList(x);
  66336. y.partTarget = J.decimalFloatingPoint("PART-TARGET");
  66337. break;
  66338. case "PART":
  66339. var Z = y.partList;
  66340. Z || (Z = y.partList = []);
  66341. var $ = T > 0 ? Z[Z.length - 1] : void 0,
  66342. ee = T++,
  66343. te = new a.Part(new u.AttrList(x), R, t, ee, $);
  66344. Z.push(te), R.duration += te.duration;
  66345. break;
  66346. case "PRELOAD-HINT":
  66347. var ie = new u.AttrList(x);
  66348. y.preloadHint = ie;
  66349. break;
  66350. case "RENDITION-REPORT":
  66351. var re = new u.AttrList(x);
  66352. y.renditionReports = y.renditionReports || [], y.renditionReports.push(re);
  66353. break;
  66354. default:
  66355. l.logger.warn("line parsed but not handled: " + h)
  66356. }
  66357. }
  66358. }
  66359. k && !k.relurl ? (b.pop(), S -= k.duration, y.partList && (y.fragmentHint = k)) : y.partList &&
  66360. (_(R, k), R.cc = A, y.fragmentHint = R);
  66361. var ne = b.length,
  66362. ae = b[0],
  66363. se = b[ne - 1];
  66364. if ((S += y.skippedSegments * y.targetduration) > 0 && ne && se) {
  66365. y.averagetargetduration = S / ne;
  66366. var oe = se.sn;
  66367. y.endSN = "initSegment" !== oe ? oe : 0, ae && (y.startCC = ae.cc, ae.initSegment || y
  66368. .fragments.every(function(e) {
  66369. return e.relurl && (t = e.relurl, m.test(null != (i = null === (r = n.parseURL(t)) ||
  66370. void 0 === r ? void 0 : r.path) ? i : ""));
  66371. var t, i, r
  66372. }) && (l.logger.warn(
  66373. "MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"
  66374. ), (R = new a.Fragment(d, t)).relurl = se.relurl, R.level = i, R.sn = "initSegment",
  66375. ae.initSegment = R, y.needSidxRanges = !0))
  66376. } else y.endSN = 0, y.startCC = 0;
  66377. return y.fragmentHint && (S += y.fragmentHint.duration), y.totalduration = S, y.endCC = A, M >
  66378. 0 && function(e, t) {
  66379. for (var i = e[t], r = t; r--;) {
  66380. var n = e[r];
  66381. if (!n) return;
  66382. n.programDateTime = i.programDateTime - 1e3 * n.duration, i = n
  66383. }
  66384. }(b, M), y
  66385. }, e
  66386. }();
  66387. function v(e, t) {
  66388. ["video", "audio", "text"].forEach(function(i) {
  66389. var r = e.filter(function(e) {
  66390. return Object(d.isCodecType)(e, i)
  66391. });
  66392. if (r.length) {
  66393. var n = r.filter(function(e) {
  66394. return 0 === e.lastIndexOf("avc1", 0) || 0 === e.lastIndexOf("mp4a", 0)
  66395. });
  66396. t[i + "Codec"] = n.length > 0 ? n[0] : r[0], e = e.filter(function(e) {
  66397. return -1 === r.indexOf(e)
  66398. })
  66399. }
  66400. }), t.unknownCodecs = e
  66401. }
  66402. function y(e, t, i) {
  66403. var r = t[i];
  66404. r && (e[i] = r)
  66405. }
  66406. function _(e, t) {
  66407. e.rawProgramDateTime ? e.programDateTime = Date.parse(e.rawProgramDateTime) : null !== t && void 0 !==
  66408. t && t.programDateTime && (e.programDateTime = t.endProgramDateTime), Object(r.isFiniteNumber)(e
  66409. .programDateTime) || (e.programDateTime = null, e.rawProgramDateTime = null)
  66410. }
  66411. },
  66412. "./src/loader/playlist-loader.ts": function(e, t, i) {
  66413. "use strict";
  66414. i.r(t);
  66415. var r = i("./src/polyfills/number.ts"),
  66416. n = i("./src/events.ts"),
  66417. a = i("./src/errors.ts"),
  66418. s = i("./src/utils/logger.ts"),
  66419. o = i("./src/utils/mp4-tools.ts"),
  66420. u = i("./src/loader/m3u8-parser.ts"),
  66421. l = i("./src/types/loader.ts"),
  66422. d = i("./src/utils/attr-list.ts");
  66423. function c(e, t) {
  66424. var i = e.url;
  66425. return void 0 !== i && 0 !== i.indexOf("data:") || (i = t.url), i
  66426. }
  66427. var h = function() {
  66428. function e(e) {
  66429. this.hls = void 0, this.loaders = Object.create(null), this.hls = e, this.registerListeners()
  66430. }
  66431. var t = e.prototype;
  66432. return t.registerListeners = function() {
  66433. var e = this.hls;
  66434. e.on(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.on(n.Events.LEVEL_LOADING, this
  66435. .onLevelLoading, this), e.on(n.Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading, this),
  66436. e.on(n.Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this)
  66437. }, t.unregisterListeners = function() {
  66438. var e = this.hls;
  66439. e.off(n.Events.MANIFEST_LOADING, this.onManifestLoading, this), e.off(n.Events.LEVEL_LOADING,
  66440. this.onLevelLoading, this), e.off(n.Events.AUDIO_TRACK_LOADING, this.onAudioTrackLoading,
  66441. this), e.off(n.Events.SUBTITLE_TRACK_LOADING, this.onSubtitleTrackLoading, this)
  66442. }, t.createInternalLoader = function(e) {
  66443. var t = this.hls.config,
  66444. i = t.pLoader,
  66445. r = t.loader,
  66446. n = new(i || r)(t);
  66447. return e.loader = n, this.loaders[e.type] = n, n
  66448. }, t.getInternalLoader = function(e) {
  66449. return this.loaders[e.type]
  66450. }, t.resetInternalLoader = function(e) {
  66451. this.loaders[e] && delete this.loaders[e]
  66452. }, t.destroyInternalLoaders = function() {
  66453. for (var e in this.loaders) {
  66454. var t = this.loaders[e];
  66455. t && t.destroy(), this.resetInternalLoader(e)
  66456. }
  66457. }, t.destroy = function() {
  66458. this.unregisterListeners(), this.destroyInternalLoaders()
  66459. }, t.onManifestLoading = function(e, t) {
  66460. var i = t.url;
  66461. this.load({
  66462. id: null,
  66463. groupId: null,
  66464. level: 0,
  66465. responseType: "text",
  66466. type: l.PlaylistContextType.MANIFEST,
  66467. url: i,
  66468. deliveryDirectives: null
  66469. })
  66470. }, t.onLevelLoading = function(e, t) {
  66471. var i = t.id,
  66472. r = t.level,
  66473. n = t.url,
  66474. a = t.deliveryDirectives;
  66475. this.load({
  66476. id: i,
  66477. groupId: null,
  66478. level: r,
  66479. responseType: "text",
  66480. type: l.PlaylistContextType.LEVEL,
  66481. url: n,
  66482. deliveryDirectives: a
  66483. })
  66484. }, t.onAudioTrackLoading = function(e, t) {
  66485. var i = t.id,
  66486. r = t.groupId,
  66487. n = t.url,
  66488. a = t.deliveryDirectives;
  66489. this.load({
  66490. id: i,
  66491. groupId: r,
  66492. level: null,
  66493. responseType: "text",
  66494. type: l.PlaylistContextType.AUDIO_TRACK,
  66495. url: n,
  66496. deliveryDirectives: a
  66497. })
  66498. }, t.onSubtitleTrackLoading = function(e, t) {
  66499. var i = t.id,
  66500. r = t.groupId,
  66501. n = t.url,
  66502. a = t.deliveryDirectives;
  66503. this.load({
  66504. id: i,
  66505. groupId: r,
  66506. level: null,
  66507. responseType: "text",
  66508. type: l.PlaylistContextType.SUBTITLE_TRACK,
  66509. url: n,
  66510. deliveryDirectives: a
  66511. })
  66512. }, t.load = function(e) {
  66513. var t, i, r, n, a, o, u = this.hls.config,
  66514. d = this.getInternalLoader(e);
  66515. if (d) {
  66516. var c = d.context;
  66517. if (c && c.url === e.url) return void s.logger.trace(
  66518. "[playlist-loader]: playlist request ongoing");
  66519. s.logger.log("[playlist-loader]: aborting previous loader for type: " + e.type), d.abort()
  66520. }
  66521. switch (e.type) {
  66522. case l.PlaylistContextType.MANIFEST:
  66523. i = u.manifestLoadingMaxRetry, r = u.manifestLoadingTimeOut, n = u
  66524. .manifestLoadingRetryDelay, a = u.manifestLoadingMaxRetryTimeout;
  66525. break;
  66526. case l.PlaylistContextType.LEVEL:
  66527. case l.PlaylistContextType.AUDIO_TRACK:
  66528. case l.PlaylistContextType.SUBTITLE_TRACK:
  66529. i = 0, r = u.levelLoadingTimeOut;
  66530. break;
  66531. default:
  66532. i = u.levelLoadingMaxRetry, r = u.levelLoadingTimeOut, n = u.levelLoadingRetryDelay, a = u
  66533. .levelLoadingMaxRetryTimeout
  66534. }
  66535. if ((d = this.createInternalLoader(e), null !== (t = e.deliveryDirectives) && void 0 !== t && t
  66536. .part) && (e.type === l.PlaylistContextType.LEVEL && null !== e.level ? o = this.hls.levels[
  66537. e.level].details : e.type === l.PlaylistContextType.AUDIO_TRACK && null !== e.id ? o =
  66538. this.hls.audioTracks[e.id].details : e.type === l.PlaylistContextType.SUBTITLE_TRACK &&
  66539. null !== e.id && (o = this.hls.subtitleTracks[e.id].details), o)) {
  66540. var h = o.partTarget,
  66541. f = o.targetduration;
  66542. h && f && (r = Math.min(1e3 * Math.max(3 * h, .8 * f), r))
  66543. }
  66544. var p = {
  66545. timeout: r,
  66546. maxRetry: i,
  66547. retryDelay: n,
  66548. maxRetryDelay: a,
  66549. highWaterMark: 0
  66550. },
  66551. m = {
  66552. onSuccess: this.loadsuccess.bind(this),
  66553. onError: this.loaderror.bind(this),
  66554. onTimeout: this.loadtimeout.bind(this)
  66555. };
  66556. d.load(e, p, m)
  66557. }, t.loadsuccess = function(e, t, i, r) {
  66558. if (void 0 === r && (r = null), i.isSidxRequest) return this.handleSidxRequest(e, i), void this
  66559. .handlePlaylistLoaded(e, t, i, r);
  66560. this.resetInternalLoader(i.type);
  66561. var n = e.data;
  66562. 0 === n.indexOf("#EXTM3U") ? (t.parsing.start = performance.now(), n.indexOf("#EXTINF:") > 0 ||
  66563. n.indexOf("#EXT-X-TARGETDURATION:") > 0 ? this.handleTrackOrLevelPlaylist(e, t, i, r) : this
  66564. .handleMasterPlaylist(e, t, i, r)) : this.handleManifestParsingError(e, i,
  66565. "no EXTM3U delimiter", r)
  66566. }, t.loaderror = function(e, t, i) {
  66567. void 0 === i && (i = null), this.handleNetworkError(t, i, !1, e)
  66568. }, t.loadtimeout = function(e, t, i) {
  66569. void 0 === i && (i = null), this.handleNetworkError(t, i, !0)
  66570. }, t.handleMasterPlaylist = function(e, t, i, r) {
  66571. var a = this.hls,
  66572. o = e.data,
  66573. l = c(e, i),
  66574. h = u.default.parseMasterPlaylist(o, l),
  66575. f = h.levels,
  66576. p = h.sessionData;
  66577. if (f.length) {
  66578. var m = f.map(function(e) {
  66579. return {
  66580. id: e.attrs.AUDIO,
  66581. audioCodec: e.audioCodec
  66582. }
  66583. }),
  66584. g = f.map(function(e) {
  66585. return {
  66586. id: e.attrs.SUBTITLES,
  66587. textCodec: e.textCodec
  66588. }
  66589. }),
  66590. v = u.default.parseMasterPlaylistMedia(o, l, "AUDIO", m),
  66591. y = u.default.parseMasterPlaylistMedia(o, l, "SUBTITLES", g),
  66592. _ = u.default.parseMasterPlaylistMedia(o, l, "CLOSED-CAPTIONS");
  66593. if (v.length) v.some(function(e) {
  66594. return !e.url
  66595. }) || !f[0].audioCodec || f[0].attrs.AUDIO || (s.logger.log(
  66596. "[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"
  66597. ), v.unshift({
  66598. type: "main",
  66599. name: "main",
  66600. default: !1,
  66601. autoselect: !1,
  66602. forced: !1,
  66603. id: -1,
  66604. attrs: new d.AttrList({}),
  66605. bitrate: 0,
  66606. url: ""
  66607. }));
  66608. a.trigger(n.Events.MANIFEST_LOADED, {
  66609. levels: f,
  66610. audioTracks: v,
  66611. subtitles: y,
  66612. captions: _,
  66613. url: l,
  66614. stats: t,
  66615. networkDetails: r,
  66616. sessionData: p
  66617. })
  66618. } else this.handleManifestParsingError(e, i, "no level found in manifest", r)
  66619. }, t.handleTrackOrLevelPlaylist = function(e, t, i, s) {
  66620. var o = this.hls,
  66621. h = i.id,
  66622. f = i.level,
  66623. p = i.type,
  66624. m = c(e, i),
  66625. g = Object(r.isFiniteNumber)(h) ? h : 0,
  66626. v = Object(r.isFiniteNumber)(f) ? f : g,
  66627. y = function(e) {
  66628. switch (e.type) {
  66629. case l.PlaylistContextType.AUDIO_TRACK:
  66630. return l.PlaylistLevelType.AUDIO;
  66631. case l.PlaylistContextType.SUBTITLE_TRACK:
  66632. return l.PlaylistLevelType.SUBTITLE;
  66633. default:
  66634. return l.PlaylistLevelType.MAIN
  66635. }
  66636. }(i),
  66637. _ = u.default.parseLevelPlaylist(e.data, m, v, y, g);
  66638. if (_.fragments.length) {
  66639. if (p === l.PlaylistContextType.MANIFEST) {
  66640. var b = {
  66641. attrs: new d.AttrList({}),
  66642. bitrate: 0,
  66643. details: _,
  66644. name: "",
  66645. url: m
  66646. };
  66647. o.trigger(n.Events.MANIFEST_LOADED, {
  66648. levels: [b],
  66649. audioTracks: [],
  66650. url: m,
  66651. stats: t,
  66652. networkDetails: s,
  66653. sessionData: null
  66654. })
  66655. }
  66656. if (t.parsing.end = performance.now(), _.needSidxRanges) {
  66657. var w, E = null === (w = _.fragments[0].initSegment) || void 0 === w ? void 0 : w.url;
  66658. this.load({
  66659. url: E,
  66660. isSidxRequest: !0,
  66661. type: p,
  66662. level: f,
  66663. levelDetails: _,
  66664. id: h,
  66665. groupId: null,
  66666. rangeStart: 0,
  66667. rangeEnd: 2048,
  66668. responseType: "arraybuffer",
  66669. deliveryDirectives: null
  66670. })
  66671. } else i.levelDetails = _, this.handlePlaylistLoaded(e, t, i, s)
  66672. } else o.trigger(n.Events.ERROR, {
  66673. type: a.ErrorTypes.NETWORK_ERROR,
  66674. details: a.ErrorDetails.LEVEL_EMPTY_ERROR,
  66675. fatal: !1,
  66676. url: m,
  66677. reason: "no fragments found in level",
  66678. level: "number" == typeof i.level ? i.level : void 0
  66679. })
  66680. }, t.handleSidxRequest = function(e, t) {
  66681. var i = Object(o.parseSegmentIndex)(new Uint8Array(e.data));
  66682. if (i) {
  66683. var r = i.references,
  66684. n = t.levelDetails;
  66685. r.forEach(function(e, t) {
  66686. var r = e.info,
  66687. a = n.fragments[t];
  66688. 0 === a.byteRange.length && a.setByteRange(String(1 + r.end - r.start) + "@" + String(r
  66689. .start)), a.initSegment && a.initSegment.setByteRange(String(i.moovEndOffset) +
  66690. "@0")
  66691. })
  66692. }
  66693. }, t.handleManifestParsingError = function(e, t, i, r) {
  66694. this.hls.trigger(n.Events.ERROR, {
  66695. type: a.ErrorTypes.NETWORK_ERROR,
  66696. details: a.ErrorDetails.MANIFEST_PARSING_ERROR,
  66697. fatal: t.type === l.PlaylistContextType.MANIFEST,
  66698. url: e.url,
  66699. reason: i,
  66700. response: e,
  66701. context: t,
  66702. networkDetails: r
  66703. })
  66704. }, t.handleNetworkError = function(e, t, i, r) {
  66705. void 0 === i && (i = !1), s.logger.warn("[playlist-loader]: A network " + (i ? "timeout" :
  66706. "error") + " occurred while loading " + e.type + " level: " + e.level + " id: " + e.id +
  66707. ' group-id: "' + e.groupId + '"');
  66708. var o = a.ErrorDetails.UNKNOWN,
  66709. u = !1,
  66710. d = this.getInternalLoader(e);
  66711. switch (e.type) {
  66712. case l.PlaylistContextType.MANIFEST:
  66713. o = i ? a.ErrorDetails.MANIFEST_LOAD_TIMEOUT : a.ErrorDetails.MANIFEST_LOAD_ERROR, u = !0;
  66714. break;
  66715. case l.PlaylistContextType.LEVEL:
  66716. o = i ? a.ErrorDetails.LEVEL_LOAD_TIMEOUT : a.ErrorDetails.LEVEL_LOAD_ERROR, u = !1;
  66717. break;
  66718. case l.PlaylistContextType.AUDIO_TRACK:
  66719. o = i ? a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT : a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,
  66720. u = !1;
  66721. break;
  66722. case l.PlaylistContextType.SUBTITLE_TRACK:
  66723. o = i ? a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT : a.ErrorDetails.SUBTITLE_LOAD_ERROR,
  66724. u = !1
  66725. }
  66726. d && this.resetInternalLoader(e.type);
  66727. var c = {
  66728. type: a.ErrorTypes.NETWORK_ERROR,
  66729. details: o,
  66730. fatal: u,
  66731. url: e.url,
  66732. loader: d,
  66733. context: e,
  66734. networkDetails: t
  66735. };
  66736. r && (c.response = r), this.hls.trigger(n.Events.ERROR, c)
  66737. }, t.handlePlaylistLoaded = function(e, t, i, r) {
  66738. var a = i.type,
  66739. s = i.level,
  66740. o = i.id,
  66741. u = i.groupId,
  66742. d = i.loader,
  66743. c = i.levelDetails,
  66744. h = i.deliveryDirectives;
  66745. if (null !== c && void 0 !== c && c.targetduration) {
  66746. if (d) switch (c.live && (d.getCacheAge && (c.ageHeader = d.getCacheAge() || 0), d
  66747. .getCacheAge && !isNaN(c.ageHeader) || (c.ageHeader = 0)), a) {
  66748. case l.PlaylistContextType.MANIFEST:
  66749. case l.PlaylistContextType.LEVEL:
  66750. this.hls.trigger(n.Events.LEVEL_LOADED, {
  66751. details: c,
  66752. level: s || 0,
  66753. id: o || 0,
  66754. stats: t,
  66755. networkDetails: r,
  66756. deliveryDirectives: h
  66757. });
  66758. break;
  66759. case l.PlaylistContextType.AUDIO_TRACK:
  66760. this.hls.trigger(n.Events.AUDIO_TRACK_LOADED, {
  66761. details: c,
  66762. id: o || 0,
  66763. groupId: u || "",
  66764. stats: t,
  66765. networkDetails: r,
  66766. deliveryDirectives: h
  66767. });
  66768. break;
  66769. case l.PlaylistContextType.SUBTITLE_TRACK:
  66770. this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED, {
  66771. details: c,
  66772. id: o || 0,
  66773. groupId: u || "",
  66774. stats: t,
  66775. networkDetails: r,
  66776. deliveryDirectives: h
  66777. })
  66778. }
  66779. } else this.handleManifestParsingError(e, i, "invalid target duration", r)
  66780. }, e
  66781. }();
  66782. t.default = h
  66783. },
  66784. "./src/polyfills/number.ts": function(e, t, i) {
  66785. "use strict";
  66786. i.r(t), i.d(t, "isFiniteNumber", function() {
  66787. return r
  66788. }), i.d(t, "MAX_SAFE_INTEGER", function() {
  66789. return n
  66790. });
  66791. var r = Number.isFinite || function(e) {
  66792. return "number" == typeof e && isFinite(e)
  66793. },
  66794. n = Number.MAX_SAFE_INTEGER || 9007199254740991
  66795. },
  66796. "./src/remux/aac-helper.ts": function(e, t, i) {
  66797. "use strict";
  66798. i.r(t);
  66799. var r = function() {
  66800. function e() {}
  66801. return e.getSilentFrame = function(e, t) {
  66802. switch (e) {
  66803. case "mp4a.40.2":
  66804. if (1 === t) return new Uint8Array([0, 200, 0, 128, 35, 128]);
  66805. if (2 === t) return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
  66806. if (3 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
  66807. if (4 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44,
  66808. 128, 8, 2, 56
  66809. ]);
  66810. if (5 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48,
  66811. 4, 153, 0, 33, 144, 2, 56
  66812. ]);
  66813. if (6 === t) return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48,
  66814. 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224
  66815. ]);
  66816. break;
  66817. default:
  66818. if (1 === t) return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28,
  66819. 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  66820. 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  66821. 90, 90, 94
  66822. ]);
  66823. if (2 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0,
  66824. 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  66825. 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  66826. 90, 90, 94
  66827. ]);
  66828. if (3 === t) return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0,
  66829. 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  66830. 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
  66831. 90, 90, 94
  66832. ])
  66833. }
  66834. }, e
  66835. }();
  66836. t.default = r
  66837. },
  66838. "./src/remux/mp4-generator.ts": function(e, t, i) {
  66839. "use strict";
  66840. i.r(t);
  66841. var r = Math.pow(2, 32) - 1,
  66842. n = function() {
  66843. function e() {}
  66844. return e.init = function() {
  66845. var t;
  66846. for (t in e.types = {
  66847. avc1: [],
  66848. avcC: [],
  66849. btrt: [],
  66850. dinf: [],
  66851. dref: [],
  66852. esds: [],
  66853. ftyp: [],
  66854. hdlr: [],
  66855. mdat: [],
  66856. mdhd: [],
  66857. mdia: [],
  66858. mfhd: [],
  66859. minf: [],
  66860. moof: [],
  66861. moov: [],
  66862. mp4a: [],
  66863. ".mp3": [],
  66864. mvex: [],
  66865. mvhd: [],
  66866. pasp: [],
  66867. sdtp: [],
  66868. stbl: [],
  66869. stco: [],
  66870. stsc: [],
  66871. stsd: [],
  66872. stsz: [],
  66873. stts: [],
  66874. tfdt: [],
  66875. tfhd: [],
  66876. traf: [],
  66877. trak: [],
  66878. trun: [],
  66879. trex: [],
  66880. tkhd: [],
  66881. vmhd: [],
  66882. smhd: []
  66883. }, e.types) e.types.hasOwnProperty(t) && (e.types[t] = [t.charCodeAt(0), t.charCodeAt(1), t
  66884. .charCodeAt(2), t.charCodeAt(3)
  66885. ]);
  66886. var i = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 118, 105, 100, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66887. 0, 0, 0, 86, 105, 100, 101, 111, 72, 97, 110, 100, 108, 101, 114, 0
  66888. ]),
  66889. r = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 115, 111, 117, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66890. 0, 0, 83, 111, 117, 110, 100, 72, 97, 110, 100, 108, 101, 114, 0
  66891. ]);
  66892. e.HDLR_TYPES = {
  66893. video: i,
  66894. audio: r
  66895. };
  66896. var n = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 12, 117, 114, 108, 32, 0, 0, 0, 1]),
  66897. a = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]);
  66898. e.STTS = e.STSC = e.STCO = a, e.STSZ = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), e
  66899. .VMHD = new Uint8Array([0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), e.SMHD = new Uint8Array([0, 0,
  66900. 0, 0, 0, 0, 0, 0
  66901. ]), e.STSD = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1]);
  66902. var s = new Uint8Array([105, 115, 111, 109]),
  66903. o = new Uint8Array([97, 118, 99, 49]),
  66904. u = new Uint8Array([0, 0, 0, 1]);
  66905. e.FTYP = e.box(e.types.ftyp, s, u, s, o), e.DINF = e.box(e.types.dinf, e.box(e.types.dref, n))
  66906. }, e.box = function(e) {
  66907. for (var t = 8, i = arguments.length, r = new Array(i > 1 ? i - 1 : 0), n = 1; n < i; n++) r[n -
  66908. 1] = arguments[n];
  66909. for (var a = r.length, s = a; a--;) t += r[a].byteLength;
  66910. var o = new Uint8Array(t);
  66911. for (o[0] = t >> 24 & 255, o[1] = t >> 16 & 255, o[2] = t >> 8 & 255, o[3] = 255 & t, o.set(e,
  66912. 4), a = 0, t = 8; a < s; a++) o.set(r[a], t), t += r[a].byteLength;
  66913. return o
  66914. }, e.hdlr = function(t) {
  66915. return e.box(e.types.hdlr, e.HDLR_TYPES[t])
  66916. }, e.mdat = function(t) {
  66917. return e.box(e.types.mdat, t)
  66918. }, e.mdhd = function(t, i) {
  66919. i *= t;
  66920. var n = Math.floor(i / (r + 1)),
  66921. a = Math.floor(i % (r + 1));
  66922. return e.box(e.types.mdhd, new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
  66923. 0, 3, t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t, n >> 24, n >> 16 & 255, n >>
  66924. 8 & 255, 255 & n, a >> 24, a >> 16 & 255, a >> 8 & 255, 255 & a, 85, 196, 0, 0
  66925. ]))
  66926. }, e.mdia = function(t) {
  66927. return e.box(e.types.mdia, e.mdhd(t.timescale, t.duration), e.hdlr(t.type), e.minf(t))
  66928. }, e.mfhd = function(t) {
  66929. return e.box(e.types.mfhd, new Uint8Array([0, 0, 0, 0, t >> 24, t >> 16 & 255, t >> 8 & 255,
  66930. 255 & t
  66931. ]))
  66932. }, e.minf = function(t) {
  66933. return "audio" === t.type ? e.box(e.types.minf, e.box(e.types.smhd, e.SMHD), e.DINF, e.stbl(
  66934. t)) : e.box(e.types.minf, e.box(e.types.vmhd, e.VMHD), e.DINF, e.stbl(t))
  66935. }, e.moof = function(t, i, r) {
  66936. return e.box(e.types.moof, e.mfhd(t), e.traf(r, i))
  66937. }, e.moov = function(t) {
  66938. for (var i = t.length, r = []; i--;) r[i] = e.trak(t[i]);
  66939. return e.box.apply(null, [e.types.moov, e.mvhd(t[0].timescale, t[0].duration)].concat(r).concat(
  66940. e.mvex(t)))
  66941. }, e.mvex = function(t) {
  66942. for (var i = t.length, r = []; i--;) r[i] = e.trex(t[i]);
  66943. return e.box.apply(null, [e.types.mvex].concat(r))
  66944. }, e.mvhd = function(t, i) {
  66945. i *= t;
  66946. var n = Math.floor(i / (r + 1)),
  66947. a = Math.floor(i % (r + 1)),
  66948. s = new Uint8Array([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, t >> 24 & 255,
  66949. t >> 16 & 255, t >> 8 & 255, 255 & t, n >> 24, n >> 16 & 255, n >> 8 & 255, 255 & n, a >>
  66950. 24, a >> 16 & 255, a >> 8 & 255, 255 & a, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66951. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66952. 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66953. 255, 255, 255, 255
  66954. ]);
  66955. return e.box(e.types.mvhd, s)
  66956. }, e.sdtp = function(t) {
  66957. var i, r, n = t.samples || [],
  66958. a = new Uint8Array(4 + n.length);
  66959. for (i = 0; i < n.length; i++) r = n[i].flags, a[i + 4] = r.dependsOn << 4 | r.isDependedOn <<
  66960. 2 | r.hasRedundancy;
  66961. return e.box(e.types.sdtp, a)
  66962. }, e.stbl = function(t) {
  66963. return e.box(e.types.stbl, e.stsd(t), e.box(e.types.stts, e.STTS), e.box(e.types.stsc, e.STSC),
  66964. e.box(e.types.stsz, e.STSZ), e.box(e.types.stco, e.STCO))
  66965. }, e.avc1 = function(t) {
  66966. var i, r, n, a = [],
  66967. s = [];
  66968. for (i = 0; i < t.sps.length; i++) n = (r = t.sps[i]).byteLength, a.push(n >>> 8 & 255), a.push(
  66969. 255 & n), a = a.concat(Array.prototype.slice.call(r));
  66970. for (i = 0; i < t.pps.length; i++) n = (r = t.pps[i]).byteLength, s.push(n >>> 8 & 255), s.push(
  66971. 255 & n), s = s.concat(Array.prototype.slice.call(r));
  66972. var o = e.box(e.types.avcC, new Uint8Array([1, a[3], a[4], a[5], 255, 224 | t.sps.length]
  66973. .concat(a).concat([t.pps.length]).concat(s))),
  66974. u = t.width,
  66975. l = t.height,
  66976. d = t.pixelRatio[0],
  66977. c = t.pixelRatio[1];
  66978. return e.box(e.types.avc1, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66979. 0, 0, 0, 0, 0, 0, u >> 8 & 255, 255 & u, l >> 8 & 255, 255 & l, 0, 72, 0, 0, 0, 72, 0,
  66980. 0, 0, 0, 0, 0, 0, 1, 18, 100, 97, 105, 108, 121, 109, 111, 116, 105, 111, 110, 47, 104,
  66981. 108, 115, 46, 106, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 17, 17
  66982. ]), o, e.box(e.types.btrt, new Uint8Array([0, 28, 156, 128, 0, 45, 198, 192, 0, 45, 198,
  66983. 192])), e.box(e.types.pasp, new Uint8Array([d >> 24, d >> 16 & 255, d >> 8 & 255, 255 & d,
  66984. c >> 24, c >> 16 & 255, c >> 8 & 255, 255 & c
  66985. ])))
  66986. }, e.esds = function(e) {
  66987. var t = e.config.length;
  66988. return new Uint8Array([0, 0, 0, 0, 3, 23 + t, 0, 1, 0, 4, 15 + t, 64, 21, 0, 0, 0, 0, 0, 0, 0,
  66989. 0, 0, 0, 0, 5
  66990. ].concat([t]).concat(e.config).concat([6, 1, 2]))
  66991. }, e.mp4a = function(t) {
  66992. var i = t.samplerate;
  66993. return e.box(e.types.mp4a, new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, t
  66994. .channelCount, 0, 16, 0, 0, 0, 0, i >> 8 & 255, 255 & i, 0, 0
  66995. ]), e.box(e.types.esds, e.esds(t)))
  66996. }, e.mp3 = function(t) {
  66997. var i = t.samplerate;
  66998. return e.box(e.types[".mp3"], new Uint8Array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  66999. t.channelCount, 0, 16, 0, 0, 0, 0, i >> 8 & 255, 255 & i, 0, 0
  67000. ]))
  67001. }, e.stsd = function(t) {
  67002. return "audio" === t.type ? "mp3" === t.segmentCodec && "mp3" === t.codec ? e.box(e.types.stsd,
  67003. e.STSD, e.mp3(t)) : e.box(e.types.stsd, e.STSD, e.mp4a(t)) : e.box(e.types.stsd, e.STSD, e
  67004. .avc1(t))
  67005. }, e.tkhd = function(t) {
  67006. var i = t.id,
  67007. n = t.duration * t.timescale,
  67008. a = t.width,
  67009. s = t.height,
  67010. o = Math.floor(n / (r + 1)),
  67011. u = Math.floor(n % (r + 1));
  67012. return e.box(e.types.tkhd, new Uint8Array([1, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
  67013. 0, 3, i >> 24 & 255, i >> 16 & 255, i >> 8 & 255, 255 & i, 0, 0, 0, 0, o >> 24, o >>
  67014. 16 & 255, o >> 8 & 255, 255 & o, u >> 24, u >> 16 & 255, u >> 8 & 255, 255 & u, 0, 0, 0,
  67015. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  67016. 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, a >> 8 & 255, 255 & a, 0,
  67017. 0, s >> 8 & 255, 255 & s, 0, 0
  67018. ]))
  67019. }, e.traf = function(t, i) {
  67020. var n = e.sdtp(t),
  67021. a = t.id,
  67022. s = Math.floor(i / (r + 1)),
  67023. o = Math.floor(i % (r + 1));
  67024. return e.box(e.types.traf, e.box(e.types.tfhd, new Uint8Array([0, 0, 0, 0, a >> 24, a >> 16 &
  67025. 255, a >> 8 & 255, 255 & a
  67026. ])), e.box(e.types.tfdt, new Uint8Array([1, 0, 0, 0, s >> 24, s >> 16 & 255, s >> 8 & 255,
  67027. 255 & s, o >> 24, o >> 16 & 255, o >> 8 & 255, 255 & o
  67028. ])), e.trun(t, n.length + 16 + 20 + 8 + 16 + 8 + 8), n)
  67029. }, e.trak = function(t) {
  67030. return t.duration = t.duration || 4294967295, e.box(e.types.trak, e.tkhd(t), e.mdia(t))
  67031. }, e.trex = function(t) {
  67032. var i = t.id;
  67033. return e.box(e.types.trex, new Uint8Array([0, 0, 0, 0, i >> 24, i >> 16 & 255, i >> 8 & 255,
  67034. 255 & i, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1
  67035. ]))
  67036. }, e.trun = function(t, i) {
  67037. var r, n, a, s, o, u, l = t.samples || [],
  67038. d = l.length,
  67039. c = 12 + 16 * d,
  67040. h = new Uint8Array(c);
  67041. for (i += 8 + c, h.set([0, 0, 15, 1, d >>> 24 & 255, d >>> 16 & 255, d >>> 8 & 255, 255 & d,
  67042. i >>> 24 & 255, i >>> 16 & 255, i >>> 8 & 255, 255 & i
  67043. ], 0), r = 0; r < d; r++) a = (n = l[r]).duration, s = n.size, o = n.flags, u = n.cts, h.set([
  67044. a >>> 24 & 255, a >>> 16 & 255, a >>> 8 & 255, 255 & a, s >>> 24 & 255, s >>> 16 & 255,
  67045. s >>> 8 & 255, 255 & s, o.isLeading << 2 | o.dependsOn, o.isDependedOn << 6 | o
  67046. .hasRedundancy << 4 | o.paddingValue << 1 | o.isNonSync, 61440 & o.degradPrio, 15 & o
  67047. .degradPrio, u >>> 24 & 255, u >>> 16 & 255, u >>> 8 & 255, 255 & u
  67048. ], 12 + 16 * r);
  67049. return e.box(e.types.trun, h)
  67050. }, e.initSegment = function(t) {
  67051. e.types || e.init();
  67052. var i = e.moov(t),
  67053. r = new Uint8Array(e.FTYP.byteLength + i.byteLength);
  67054. return r.set(e.FTYP), r.set(i, e.FTYP.byteLength), r
  67055. }, e
  67056. }();
  67057. n.types = void 0, n.HDLR_TYPES = void 0, n.STTS = void 0, n.STSC = void 0, n.STCO = void 0, n.STSZ =
  67058. void 0, n.VMHD = void 0, n.SMHD = void 0, n.STSD = void 0, n.FTYP = void 0, n.DINF = void 0, t
  67059. .default = n
  67060. },
  67061. "./src/remux/mp4-remuxer.ts": function(e, t, i) {
  67062. "use strict";
  67063. i.r(t), i.d(t, "default", function() {
  67064. return m
  67065. }), i.d(t, "normalizePts", function() {
  67066. return g
  67067. }), i.d(t, "flushTextTrackMetadataCueSamples", function() {
  67068. return v
  67069. }), i.d(t, "flushTextTrackUserdataCueSamples", function() {
  67070. return y
  67071. });
  67072. var r = i("./src/polyfills/number.ts"),
  67073. n = i("./src/remux/aac-helper.ts"),
  67074. a = i("./src/remux/mp4-generator.ts"),
  67075. s = i("./src/events.ts"),
  67076. o = i("./src/errors.ts"),
  67077. u = i("./src/utils/logger.ts"),
  67078. l = i("./src/types/loader.ts"),
  67079. d = i("./src/utils/timescale-conversion.ts");
  67080. function c() {
  67081. return (c = Object.assign ? Object.assign.bind() : function(e) {
  67082. for (var t = 1; t < arguments.length; t++) {
  67083. var i = arguments[t];
  67084. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  67085. }
  67086. return e
  67087. }).apply(this, arguments)
  67088. }
  67089. var h = null,
  67090. f = null,
  67091. p = !1,
  67092. m = function() {
  67093. function e(e, t, i, r) {
  67094. if (void 0 === r && (r = ""), this.observer = void 0, this.config = void 0, this.typeSupported =
  67095. void 0, this.ISGenerated = !1, this._initPTS = void 0, this._initDTS = void 0, this.nextAvcDts =
  67096. null, this.nextAudioPts = null, this.isAudioContiguous = !1, this.isVideoContiguous = !1, this
  67097. .observer = e, this.config = t, this.typeSupported = i, this.ISGenerated = !1, null === h) {
  67098. var n = (navigator.userAgent || "").match(/Chrome\/(\d+)/i);
  67099. h = n ? parseInt(n[1]) : 0
  67100. }
  67101. if (null === f) {
  67102. var a = navigator.userAgent.match(/Safari\/(\d+)/i);
  67103. f = a ? parseInt(a[1]) : 0
  67104. }
  67105. p = !!h && h < 75 || !!f && f < 600
  67106. }
  67107. var t = e.prototype;
  67108. return t.destroy = function() {}, t.resetTimeStamp = function(e) {
  67109. u.logger.log("[mp4-remuxer]: initPTS & initDTS reset"), this._initPTS = this._initDTS = e
  67110. }, t.resetNextTimestamp = function() {
  67111. u.logger.log("[mp4-remuxer]: reset next timestamp"), this.isVideoContiguous = !1, this
  67112. .isAudioContiguous = !1
  67113. }, t.resetInitSegment = function() {
  67114. u.logger.log("[mp4-remuxer]: ISGenerated flag reset"), this.ISGenerated = !1
  67115. }, t.getVideoStartPts = function(e) {
  67116. var t = !1,
  67117. i = e.reduce(function(e, i) {
  67118. var r = i.pts - e;
  67119. return r < -4294967296 ? (t = !0, g(e, i.pts)) : r > 0 ? e : i.pts
  67120. }, e[0].pts);
  67121. return t && u.logger.debug("PTS rollover detected"), i
  67122. }, t.remux = function(e, t, i, r, n, a, s, o) {
  67123. var d, c, h, f, p, m, _ = n,
  67124. b = n,
  67125. w = e.pid > -1,
  67126. E = t.pid > -1,
  67127. T = t.samples.length,
  67128. S = e.samples.length > 0,
  67129. A = T > 1;
  67130. if ((!w || S) && (!E || A) || this.ISGenerated || s) {
  67131. this.ISGenerated || (h = this.generateIS(e, t, n));
  67132. var k = this.isVideoContiguous,
  67133. R = -1;
  67134. if (A && (R = function(e) {
  67135. for (var t = 0; t < e.length; t++)
  67136. if (e[t].key) return t;
  67137. return -1
  67138. }(t.samples), !k && this.config.forceKeyFrameOnDiscontinuity))
  67139. if (m = !0, R > 0) {
  67140. u.logger.warn("[mp4-remuxer]: Dropped " + R + " out of " + T +
  67141. " video samples due to a missing keyframe");
  67142. var M = this.getVideoStartPts(t.samples);
  67143. t.samples = t.samples.slice(R), t.dropped += R, b += (t.samples[0].pts - M) / (t
  67144. .timescale || 9e4)
  67145. } else -1 === R && (u.logger.warn("[mp4-remuxer]: No keyframe found out of " + T +
  67146. " video samples"), m = !1);
  67147. if (this.ISGenerated) {
  67148. if (S && A) {
  67149. var O = this.getVideoStartPts(t.samples),
  67150. C = (g(e.samples[0].pts, O) - O) / t.inputTimeScale;
  67151. _ += Math.max(0, C), b += Math.max(0, -C)
  67152. }
  67153. if (S) {
  67154. if (e.samplerate || (u.logger.warn(
  67155. "[mp4-remuxer]: regenerate InitSegment as audio detected"), h = this.generateIS(e,
  67156. t, n)), c = this.remuxAudio(e, _, this.isAudioContiguous, a, E || A || o === l
  67157. .PlaylistLevelType.AUDIO ? b : void 0), A) {
  67158. var D = c ? c.endPTS - c.startPTS : 0;
  67159. t.inputTimeScale || (u.logger.warn(
  67160. "[mp4-remuxer]: regenerate InitSegment as video detected"), h = this.generateIS(e,
  67161. t, n)), d = this.remuxVideo(t, b, k, D)
  67162. }
  67163. } else A && (d = this.remuxVideo(t, b, k, 0));
  67164. d && (d.firstKeyFrame = R, d.independent = -1 !== R)
  67165. }
  67166. }
  67167. return this.ISGenerated && (i.samples.length && (p = v(i, n, this._initPTS, this._initDTS)), r
  67168. .samples.length && (f = y(r, n, this._initPTS))), {
  67169. audio: c,
  67170. video: d,
  67171. initSegment: h,
  67172. independent: m,
  67173. text: f,
  67174. id3: p
  67175. }
  67176. }, t.generateIS = function(e, t, i) {
  67177. var n, s, o, u = e.samples,
  67178. l = t.samples,
  67179. d = this.typeSupported,
  67180. c = {},
  67181. h = !Object(r.isFiniteNumber)(this._initPTS),
  67182. f = "audio/mp4";
  67183. if (h && (n = s = 1 / 0), e.config && u.length) {
  67184. switch (e.timescale = e.samplerate, e.segmentCodec) {
  67185. case "mp3":
  67186. d.mpeg ? (f = "audio/mpeg", e.codec = "") : d.mp3 && (e.codec = "mp3")
  67187. }
  67188. c.audio = {
  67189. id: "audio",
  67190. container: f,
  67191. codec: e.codec,
  67192. initSegment: "mp3" === e.segmentCodec && d.mpeg ? new Uint8Array(0) : a.default
  67193. .initSegment([e]),
  67194. metadata: {
  67195. channelCount: e.channelCount
  67196. }
  67197. }, h && (o = e.inputTimeScale, n = s = u[0].pts - Math.round(o * i))
  67198. }
  67199. if (t.sps && t.pps && l.length && (t.timescale = t.inputTimeScale, c.video = {
  67200. id: "main",
  67201. container: "video/mp4",
  67202. codec: t.codec,
  67203. initSegment: a.default.initSegment([t]),
  67204. metadata: {
  67205. width: t.width,
  67206. height: t.height
  67207. }
  67208. }, h)) {
  67209. o = t.inputTimeScale;
  67210. var p = this.getVideoStartPts(l),
  67211. m = Math.round(o * i);
  67212. s = Math.min(s, g(l[0].dts, p) - m), n = Math.min(n, p - m)
  67213. }
  67214. if (Object.keys(c).length) return this.ISGenerated = !0, h && (this._initPTS = n, this
  67215. ._initDTS = s), {
  67216. tracks: c,
  67217. initPTS: n,
  67218. timescale: o
  67219. }
  67220. }, t.remuxVideo = function(e, t, i, r) {
  67221. var n, l, f, m = e.inputTimeScale,
  67222. v = e.samples,
  67223. y = [],
  67224. b = v.length,
  67225. w = this._initPTS,
  67226. E = this.nextAvcDts,
  67227. T = 8,
  67228. S = Number.POSITIVE_INFINITY,
  67229. A = Number.NEGATIVE_INFINITY,
  67230. k = 0,
  67231. R = !1;
  67232. i && null !== E || (E = t * m - (v[0].pts - g(v[0].dts, v[0].pts)));
  67233. for (var M = 0; M < b; M++) {
  67234. var O = v[M];
  67235. if (O.pts = g(O.pts - w, E), O.dts = g(O.dts - w, E), O.dts > O.pts) {
  67236. k = Math.max(Math.min(k, O.pts - O.dts), -18e3)
  67237. }
  67238. O.dts < v[M > 0 ? M - 1 : M].dts && (R = !0)
  67239. }
  67240. R && v.sort(function(e, t) {
  67241. var i = e.dts - t.dts,
  67242. r = e.pts - t.pts;
  67243. return i || r
  67244. }), l = v[0].dts, f = v[v.length - 1].dts;
  67245. var C = Math.round((f - l) / (b - 1));
  67246. if (k < 0) {
  67247. if (k < -2 * C) {
  67248. u.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by " + Object(d
  67249. .toMsFromMpegTsClock)(-C, !0) + " ms");
  67250. for (var D = k, I = 0; I < b; I++) v[I].dts = D = Math.max(D, v[I].pts - C), v[I].pts = Math
  67251. .max(D, v[I].pts)
  67252. } else {
  67253. u.logger.warn("PTS < DTS detected in video samples, shifting DTS by " + Object(d
  67254. .toMsFromMpegTsClock)(k, !0) + " ms to overcome this issue");
  67255. for (var L = 0; L < b; L++) v[L].dts = v[L].dts + k
  67256. }
  67257. l = v[0].dts
  67258. }
  67259. if (i) {
  67260. var x = l - E,
  67261. P = x > C;
  67262. if (P || x < -1) {
  67263. P ? u.logger.warn("AVC: " + Object(d.toMsFromMpegTsClock)(x, !0) + " ms (" + x +
  67264. "dts) hole between fragments detected, filling it") : u.logger.warn("AVC: " + Object(d
  67265. .toMsFromMpegTsClock)(-x, !0) + " ms (" + x +
  67266. "dts) overlapping between fragments detected"), l = E;
  67267. var U = v[0].pts - x;
  67268. v[0].dts = l, v[0].pts = U, u.logger.log("Video: First PTS/DTS adjusted: " + Object(d
  67269. .toMsFromMpegTsClock)(U, !0) + "/" + Object(d.toMsFromMpegTsClock)(l, !0) +
  67270. ", delta: " + Object(d.toMsFromMpegTsClock)(x, !0) + " ms")
  67271. }
  67272. }
  67273. p && (l = Math.max(0, l));
  67274. for (var N = 0, B = 0, F = 0; F < b; F++) {
  67275. for (var j = v[F], H = j.units, G = H.length, V = 0, W = 0; W < G; W++) V += H[W].data.length;
  67276. B += V, N += G, j.length = V, j.dts = Math.max(j.dts, l), j.pts = Math.max(j.pts, j.dts, 0),
  67277. S = Math.min(j.pts, S), A = Math.max(j.pts, A)
  67278. }
  67279. f = v[b - 1].dts;
  67280. var q, X = B + 4 * N + 8;
  67281. try {
  67282. q = new Uint8Array(X)
  67283. } catch (e) {
  67284. return void this.observer.emit(s.Events.ERROR, s.Events.ERROR, {
  67285. type: o.ErrorTypes.MUX_ERROR,
  67286. details: o.ErrorDetails.REMUX_ALLOC_ERROR,
  67287. fatal: !1,
  67288. bytes: X,
  67289. reason: "fail allocating video mdat " + X
  67290. })
  67291. }
  67292. var z = new DataView(q.buffer);
  67293. z.setUint32(0, X), q.set(a.default.types.mdat, 4);
  67294. for (var K = 0; K < b; K++) {
  67295. for (var Y = v[K], Q = Y.units, J = 0, Z = 0, $ = Q.length; Z < $; Z++) {
  67296. var ee = Q[Z],
  67297. te = ee.data,
  67298. ie = ee.data.byteLength;
  67299. z.setUint32(T, ie), T += 4, q.set(te, T), T += ie, J += 4 + ie
  67300. }
  67301. if (K < b - 1) n = v[K + 1].dts - Y.dts;
  67302. else {
  67303. var re = this.config,
  67304. ne = Y.dts - v[K > 0 ? K - 1 : K].dts;
  67305. if (re.stretchShortVideoTrack && null !== this.nextAudioPts) {
  67306. var ae = Math.floor(re.maxBufferHole * m),
  67307. se = (r ? S + r * m : this.nextAudioPts) - Y.pts;
  67308. se > ae ? ((n = se - ne) < 0 && (n = ne), u.logger.log(
  67309. "[mp4-remuxer]: It is approximately " + se / 90 +
  67310. " ms to the next segment; using duration " + n / 90 +
  67311. " ms for the last video frame.")) : n = ne
  67312. } else n = ne
  67313. }
  67314. var oe = Math.round(Y.pts - Y.dts);
  67315. y.push(new _(Y.key, n, J, oe))
  67316. }
  67317. if (y.length && h && h < 70) {
  67318. var ue = y[0].flags;
  67319. ue.dependsOn = 2, ue.isNonSync = 0
  67320. }
  67321. console.assert(void 0 !== n, "mp4SampleDuration must be computed"), this.nextAvcDts = E = f + n,
  67322. this.isVideoContiguous = !0;
  67323. var le = {
  67324. data1: a.default.moof(e.sequenceNumber++, l, c({}, e, {
  67325. samples: y
  67326. })),
  67327. data2: q,
  67328. startPTS: S / m,
  67329. endPTS: (A + n) / m,
  67330. startDTS: l / m,
  67331. endDTS: E / m,
  67332. type: "video",
  67333. hasAudio: !1,
  67334. hasVideo: !0,
  67335. nb: y.length,
  67336. dropped: e.dropped
  67337. };
  67338. return e.samples = [], e.dropped = 0, console.assert(q.length, "MDAT length must not be zero"),
  67339. le
  67340. }, t.remuxAudio = function(e, t, i, r, l) {
  67341. var d = e.inputTimeScale,
  67342. h = d / (e.samplerate ? e.samplerate : d),
  67343. f = "aac" === e.segmentCodec ? 1024 : 1152,
  67344. p = f * h,
  67345. m = this._initPTS,
  67346. v = "mp3" === e.segmentCodec && this.typeSupported.mpeg,
  67347. y = [],
  67348. b = e.samples,
  67349. w = v ? 0 : 8,
  67350. E = this.nextAudioPts || -1,
  67351. T = t * d;
  67352. if (this.isAudioContiguous = i = i || b.length && E > 0 && (r && Math.abs(T - E) < 9e3 || Math
  67353. .abs(g(b[0].pts - m, T) - E) < 20 * p), b.forEach(function(e) {
  67354. e.pts = g(e.pts - m, T)
  67355. }), !i || E < 0) {
  67356. if (!(b = b.filter(function(e) {
  67357. return e.pts >= 0
  67358. })).length) return;
  67359. E = 0 === l ? 0 : r ? Math.max(0, T) : b[0].pts
  67360. }
  67361. if ("aac" === e.segmentCodec)
  67362. for (var S = void 0 !== l, A = this.config.maxAudioFramesDrift, k = 0, R = E; k < b
  67363. .length; k++) {
  67364. var M = b[k],
  67365. O = M.pts,
  67366. C = O - R,
  67367. D = Math.abs(1e3 * C / d);
  67368. if (C <= -A * p && S) 0 === k && (u.logger.warn("Audio frame @ " + (O / d).toFixed(3) +
  67369. "s overlaps nextAudioPts by " + Math.round(1e3 * C / d) + " ms."), this.nextAudioPts =
  67370. E = R = O);
  67371. else if (C >= A * p && D < 1e4 && S) {
  67372. var I = Math.round(C / p);
  67373. (R = O - I * p) < 0 && (I--, R += p), 0 === k && (this.nextAudioPts = E = R), u.logger
  67374. .warn("[mp4-remuxer]: Injecting " + I + " audio frame @ " + (R / d).toFixed(3) +
  67375. "s due to " + Math.round(1e3 * C / d) + " ms gap.");
  67376. for (var L = 0; L < I; L++) {
  67377. var x = Math.max(R, 0),
  67378. P = n.default.getSilentFrame(e.manifestCodec || e.codec, e.channelCount);
  67379. P || (u.logger.log(
  67380. "[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."
  67381. ), P = M.unit.subarray()), b.splice(k, 0, {
  67382. unit: P,
  67383. pts: x
  67384. }), R += p, k++
  67385. }
  67386. }
  67387. M.pts = R, R += p
  67388. }
  67389. for (var U, N = null, B = null, F = 0, j = b.length; j--;) F += b[j].unit.byteLength;
  67390. for (var H = 0, G = b.length; H < G; H++) {
  67391. var V = b[H],
  67392. W = V.unit,
  67393. q = V.pts;
  67394. if (null !== B) {
  67395. y[H - 1].duration = Math.round((q - B) / h)
  67396. } else {
  67397. if (i && "aac" === e.segmentCodec && (q = E), N = q, !(F > 0)) return;
  67398. F += w;
  67399. try {
  67400. U = new Uint8Array(F)
  67401. } catch (e) {
  67402. return void this.observer.emit(s.Events.ERROR, s.Events.ERROR, {
  67403. type: o.ErrorTypes.MUX_ERROR,
  67404. details: o.ErrorDetails.REMUX_ALLOC_ERROR,
  67405. fatal: !1,
  67406. bytes: F,
  67407. reason: "fail allocating audio mdat " + F
  67408. })
  67409. }
  67410. v || (new DataView(U.buffer).setUint32(0, F), U.set(a.default.types.mdat, 4))
  67411. }
  67412. U.set(W, w);
  67413. var X = W.byteLength;
  67414. w += X, y.push(new _(!0, f, X, 0)), B = q
  67415. }
  67416. var z = y.length;
  67417. if (z) {
  67418. var K = y[y.length - 1];
  67419. this.nextAudioPts = E = B + h * K.duration;
  67420. var Y = v ? new Uint8Array(0) : a.default.moof(e.sequenceNumber++, N / h, c({}, e, {
  67421. samples: y
  67422. }));
  67423. e.samples = [];
  67424. var Q = N / d,
  67425. J = E / d,
  67426. Z = {
  67427. data1: Y,
  67428. data2: U,
  67429. startPTS: Q,
  67430. endPTS: J,
  67431. startDTS: Q,
  67432. endDTS: J,
  67433. type: "audio",
  67434. hasAudio: !0,
  67435. hasVideo: !1,
  67436. nb: z
  67437. };
  67438. return this.isAudioContiguous = !0, console.assert(U.length, "MDAT length must not be zero"),
  67439. Z
  67440. }
  67441. }, t.remuxEmptyAudio = function(e, t, i, r) {
  67442. var a = e.inputTimeScale,
  67443. s = a / (e.samplerate ? e.samplerate : a),
  67444. o = this.nextAudioPts,
  67445. l = (null !== o ? o : r.startDTS * a) + this._initDTS,
  67446. d = r.endDTS * a + this._initDTS,
  67447. c = 1024 * s,
  67448. h = Math.ceil((d - l) / c),
  67449. f = n.default.getSilentFrame(e.manifestCodec || e.codec, e.channelCount);
  67450. if (u.logger.warn("[mp4-remuxer]: remux empty Audio"), f) {
  67451. for (var p = [], m = 0; m < h; m++) {
  67452. var g = l + m * c;
  67453. p.push({
  67454. unit: f,
  67455. pts: g,
  67456. dts: g
  67457. })
  67458. }
  67459. return e.samples = p, this.remuxAudio(e, t, i, !1)
  67460. }
  67461. u.logger.trace(
  67462. "[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec"
  67463. )
  67464. }, e
  67465. }();
  67466. function g(e, t) {
  67467. var i;
  67468. if (null === t) return e;
  67469. for (i = t < e ? -8589934592 : 8589934592; Math.abs(e - t) > 4294967296;) e += i;
  67470. return e
  67471. }
  67472. function v(e, t, i, r) {
  67473. var n = e.samples.length;
  67474. if (n) {
  67475. for (var a = e.inputTimeScale, s = 0; s < n; s++) {
  67476. var o = e.samples[s];
  67477. o.pts = g(o.pts - i, t * a) / a, o.dts = g(o.dts - r, t * a) / a
  67478. }
  67479. var u = e.samples;
  67480. return e.samples = [], {
  67481. samples: u
  67482. }
  67483. }
  67484. }
  67485. function y(e, t, i) {
  67486. var r = e.samples.length;
  67487. if (r) {
  67488. for (var n = e.inputTimeScale, a = 0; a < r; a++) {
  67489. var s = e.samples[a];
  67490. s.pts = g(s.pts - i, t * n) / n
  67491. }
  67492. e.samples.sort(function(e, t) {
  67493. return e.pts - t.pts
  67494. });
  67495. var o = e.samples;
  67496. return e.samples = [], {
  67497. samples: o
  67498. }
  67499. }
  67500. }
  67501. var _ = function(e, t, i, r) {
  67502. this.size = void 0, this.duration = void 0, this.cts = void 0, this.flags = void 0, this.duration =
  67503. t, this.size = i, this.cts = r, this.flags = new b(e)
  67504. },
  67505. b = function(e) {
  67506. this.isLeading = 0, this.isDependedOn = 0, this.hasRedundancy = 0, this.degradPrio = 0, this
  67507. .dependsOn = 1, this.isNonSync = 1, this.dependsOn = e ? 2 : 1, this.isNonSync = e ? 0 : 1
  67508. }
  67509. },
  67510. "./src/remux/passthrough-remuxer.ts": function(e, t, i) {
  67511. "use strict";
  67512. i.r(t);
  67513. var r = i("./src/polyfills/number.ts"),
  67514. n = i("./src/remux/mp4-remuxer.ts"),
  67515. a = i("./src/utils/mp4-tools.ts"),
  67516. s = i("./src/loader/fragment.ts"),
  67517. o = i("./src/utils/logger.ts"),
  67518. u = function() {
  67519. function e() {
  67520. this.emitInitSegment = !1, this.audioCodec = void 0, this.videoCodec = void 0, this.initData =
  67521. void 0, this.initPTS = void 0, this.initTracks = void 0, this.lastEndDTS = null
  67522. }
  67523. var t = e.prototype;
  67524. return t.destroy = function() {}, t.resetTimeStamp = function(e) {
  67525. this.initPTS = e, this.lastEndDTS = null
  67526. }, t.resetNextTimestamp = function() {
  67527. this.lastEndDTS = null
  67528. }, t.resetInitSegment = function(e, t, i) {
  67529. this.audioCodec = t, this.videoCodec = i, this.generateInitSegment(e), this.emitInitSegment = !0
  67530. }, t.generateInitSegment = function(e) {
  67531. var t = this.audioCodec,
  67532. i = this.videoCodec;
  67533. if (!e || !e.byteLength) return this.initTracks = void 0, void(this.initData = void 0);
  67534. var r = this.initData = Object(a.parseInitSegment)(e);
  67535. t || (t = d(r.audio, s.ElementaryStreamTypes.AUDIO)), i || (i = d(r.video, s
  67536. .ElementaryStreamTypes.VIDEO));
  67537. var n = {};
  67538. r.audio && r.video ? n.audiovideo = {
  67539. container: "video/mp4",
  67540. codec: t + "," + i,
  67541. initSegment: e,
  67542. id: "main"
  67543. } : r.audio ? n.audio = {
  67544. container: "audio/mp4",
  67545. codec: t,
  67546. initSegment: e,
  67547. id: "audio"
  67548. } : r.video ? n.video = {
  67549. container: "video/mp4",
  67550. codec: i,
  67551. initSegment: e,
  67552. id: "main"
  67553. } : o.logger.warn(
  67554. "[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."), this
  67555. .initTracks = n
  67556. }, t.remux = function(e, t, i, s, u) {
  67557. var d, c = this.initPTS,
  67558. h = this.lastEndDTS,
  67559. f = {
  67560. audio: void 0,
  67561. video: void 0,
  67562. text: s,
  67563. id3: i,
  67564. initSegment: void 0
  67565. };
  67566. Object(r.isFiniteNumber)(h) || (h = this.lastEndDTS = u || 0);
  67567. var p = t.samples;
  67568. if (!p || !p.length) return f;
  67569. var m = {
  67570. initPTS: void 0,
  67571. timescale: 1
  67572. },
  67573. g = this.initData;
  67574. if (g && g.length || (this.generateInitSegment(p), g = this.initData), !g || !g.length) return o
  67575. .logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."), f;
  67576. this.emitInitSegment && (m.tracks = this.initTracks, this.emitInitSegment = !1), Object(r
  67577. .isFiniteNumber)(c) || (this.initPTS = m.initPTS = c = l(g, p, h));
  67578. var v = Object(a.getDuration)(p, g),
  67579. y = h,
  67580. _ = v + y;
  67581. Object(a.offsetStartDTS)(g, p, c), v > 0 ? this.lastEndDTS = _ : (o.logger.warn(
  67582. "Duration parsed from mp4 should be greater than zero"), this.resetNextTimestamp());
  67583. var b = !!g.audio,
  67584. w = !!g.video,
  67585. E = "";
  67586. b && (E += "audio"), w && (E += "video");
  67587. var T = {
  67588. data1: p,
  67589. startPTS: y,
  67590. startDTS: y,
  67591. endPTS: _,
  67592. endDTS: _,
  67593. type: E,
  67594. hasAudio: b,
  67595. hasVideo: w,
  67596. nb: 1,
  67597. dropped: 0
  67598. };
  67599. f.audio = "audio" === T.type ? T : void 0, f.video = "audio" !== T.type ? T : void 0, f
  67600. .initSegment = m;
  67601. var S = null != (d = this.initPTS) ? d : 0;
  67602. return f.id3 = Object(n.flushTextTrackMetadataCueSamples)(i, u, S, S), s.samples.length && (f
  67603. .text = Object(n.flushTextTrackUserdataCueSamples)(s, u, S)), f
  67604. }, e
  67605. }(),
  67606. l = function(e, t, i) {
  67607. return Object(a.getStartDTS)(e, t) - i
  67608. };
  67609. function d(e, t) {
  67610. var i = null === e || void 0 === e ? void 0 : e.codec;
  67611. return i && i.length > 4 ? i : "hvc1" === i ? "hvc1.1.c.L120.90" : "av01" === i ? "av01.0.04M.08" :
  67612. "avc1" === i || t === s.ElementaryStreamTypes.VIDEO ? "avc1.42e01e" : "mp4a.40.5"
  67613. }
  67614. t.default = u
  67615. },
  67616. "./src/task-loop.ts": function(e, t, i) {
  67617. "use strict";
  67618. i.r(t), i.d(t, "default", function() {
  67619. return r
  67620. });
  67621. var r = function() {
  67622. function e() {
  67623. this._boundTick = void 0, this._tickTimer = null, this._tickInterval = null, this._tickCallCount =
  67624. 0, this._boundTick = this.tick.bind(this)
  67625. }
  67626. var t = e.prototype;
  67627. return t.destroy = function() {
  67628. this.onHandlerDestroying(), this.onHandlerDestroyed()
  67629. }, t.onHandlerDestroying = function() {
  67630. this.clearNextTick(), this.clearInterval()
  67631. }, t.onHandlerDestroyed = function() {}, t.hasInterval = function() {
  67632. return !!this._tickInterval
  67633. }, t.hasNextTick = function() {
  67634. return !!this._tickTimer
  67635. }, t.setInterval = function(e) {
  67636. return !this._tickInterval && (this._tickInterval = self.setInterval(this._boundTick, e), !0)
  67637. }, t.clearInterval = function() {
  67638. return !!this._tickInterval && (self.clearInterval(this._tickInterval), this._tickInterval =
  67639. null, !0)
  67640. }, t.clearNextTick = function() {
  67641. return !!this._tickTimer && (self.clearTimeout(this._tickTimer), this._tickTimer = null, !0)
  67642. }, t.tick = function() {
  67643. this._tickCallCount++, 1 === this._tickCallCount && (this.doTick(), this._tickCallCount > 1 &&
  67644. this.tickImmediate(), this._tickCallCount = 0)
  67645. }, t.tickImmediate = function() {
  67646. this.clearNextTick(), this._tickTimer = self.setTimeout(this._boundTick, 0)
  67647. }, t.doTick = function() {}, e
  67648. }()
  67649. },
  67650. "./src/types/cmcd.ts": function(e, t, i) {
  67651. "use strict";
  67652. i.r(t), i.d(t, "CMCDVersion", function() {
  67653. return s
  67654. }), i.d(t, "CMCDObjectType", function() {
  67655. return r
  67656. }), i.d(t, "CMCDStreamingFormat", function() {
  67657. return n
  67658. }), i.d(t, "CMCDStreamType", function() {
  67659. return a
  67660. });
  67661. var r, n, a, s = 1;
  67662. ! function(e) {
  67663. e.MANIFEST = "m", e.AUDIO = "a", e.VIDEO = "v", e.MUXED = "av", e.INIT = "i", e.CAPTION = "c", e
  67664. .TIMED_TEXT = "tt", e.KEY = "k", e.OTHER = "o"
  67665. }(r || (r = {})),
  67666. function(e) {
  67667. e.DASH = "d", e.HLS = "h", e.SMOOTH = "s", e.OTHER = "o"
  67668. }(n || (n = {})),
  67669. function(e) {
  67670. e.VOD = "v", e.LIVE = "l"
  67671. }(a || (a = {}))
  67672. },
  67673. "./src/types/level.ts": function(e, t, i) {
  67674. "use strict";
  67675. function r(e, t) {
  67676. for (var i = 0; i < t.length; i++) {
  67677. var r = t[i];
  67678. r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object
  67679. .defineProperty(e, r.key, r)
  67680. }
  67681. }
  67682. var n;
  67683. function a(e, t) {
  67684. var i = e.canSkipUntil,
  67685. r = e.canSkipDateRanges,
  67686. a = e.endSN;
  67687. return i && (void 0 !== t ? t - a : 0) < i ? r ? n.v2 : n.Yes : n.No
  67688. }
  67689. i.r(t), i.d(t, "HlsSkip", function() {
  67690. return n
  67691. }), i.d(t, "getSkipValue", function() {
  67692. return a
  67693. }), i.d(t, "HlsUrlParameters", function() {
  67694. return s
  67695. }), i.d(t, "Level", function() {
  67696. return o
  67697. }),
  67698. function(e) {
  67699. e.No = "", e.Yes = "YES", e.v2 = "v2"
  67700. }(n || (n = {}));
  67701. var s = function() {
  67702. function e(e, t, i) {
  67703. this.msn = void 0, this.part = void 0, this.skip = void 0, this.msn = e, this.part = t, this
  67704. .skip = i
  67705. }
  67706. return e.prototype.addDirectives = function(e) {
  67707. var t = new self.URL(e);
  67708. return void 0 !== this.msn && t.searchParams.set("_HLS_msn", this.msn.toString()), void 0 !==
  67709. this.part && t.searchParams.set("_HLS_part", this.part.toString()), this.skip && t
  67710. .searchParams.set("_HLS_skip", this.skip), t.toString()
  67711. }, e
  67712. }(),
  67713. o = function() {
  67714. function e(e) {
  67715. this.attrs = void 0, this.audioCodec = void 0, this.bitrate = void 0, this.codecSet = void 0, this
  67716. .height = void 0, this.id = void 0, this.name = void 0, this.videoCodec = void 0, this.width =
  67717. void 0, this.unknownCodecs = void 0, this.audioGroupIds = void 0, this.details = void 0, this
  67718. .fragmentError = 0, this.loadError = 0, this.loaded = void 0, this.realBitrate = 0, this
  67719. .textGroupIds = void 0, this.url = void 0, this._urlId = 0, this.url = [e.url], this.attrs = e
  67720. .attrs, this.bitrate = e.bitrate, e.details && (this.details = e.details), this.id = e.id || 0,
  67721. this.name = e.name, this.width = e.width || 0, this.height = e.height || 0, this.audioCodec = e
  67722. .audioCodec, this.videoCodec = e.videoCodec, this.unknownCodecs = e.unknownCodecs, this
  67723. .codecSet = [e.videoCodec, e.audioCodec].filter(function(e) {
  67724. return e
  67725. }).join(",").replace(/\.[^.,]+/g, "")
  67726. }
  67727. var t, i, n;
  67728. return t = e, (i = [{
  67729. key: "maxBitrate",
  67730. get: function() {
  67731. return Math.max(this.realBitrate, this.bitrate)
  67732. }
  67733. }, {
  67734. key: "uri",
  67735. get: function() {
  67736. return this.url[this._urlId] || ""
  67737. }
  67738. }, {
  67739. key: "urlId",
  67740. get: function() {
  67741. return this._urlId
  67742. },
  67743. set: function(e) {
  67744. var t = e % this.url.length;
  67745. this._urlId !== t && (this.details = void 0, this._urlId = t)
  67746. }
  67747. }]) && r(t.prototype, i), n && r(t, n), Object.defineProperty(t, "prototype", {
  67748. writable: !1
  67749. }), e
  67750. }()
  67751. },
  67752. "./src/types/loader.ts": function(e, t, i) {
  67753. "use strict";
  67754. var r, n;
  67755. i.r(t), i.d(t, "PlaylistContextType", function() {
  67756. return r
  67757. }), i.d(t, "PlaylistLevelType", function() {
  67758. return n
  67759. }),
  67760. function(e) {
  67761. e.MANIFEST = "manifest", e.LEVEL = "level", e.AUDIO_TRACK = "audioTrack", e.SUBTITLE_TRACK =
  67762. "subtitleTrack"
  67763. }(r || (r = {})),
  67764. function(e) {
  67765. e.MAIN = "main", e.AUDIO = "audio", e.SUBTITLE = "subtitle"
  67766. }(n || (n = {}))
  67767. },
  67768. "./src/types/transmuxer.ts": function(e, t, i) {
  67769. "use strict";
  67770. i.r(t), i.d(t, "ChunkMetadata", function() {
  67771. return r
  67772. });
  67773. var r = function(e, t, i, r, n, a) {
  67774. void 0 === r && (r = 0), void 0 === n && (n = -1), void 0 === a && (a = !1), this.level = void 0,
  67775. this.sn = void 0, this.part = void 0, this.id = void 0, this.size = void 0, this.partial = void 0,
  67776. this.transmuxing = {
  67777. start: 0,
  67778. executeStart: 0,
  67779. executeEnd: 0,
  67780. end: 0
  67781. }, this.buffering = {
  67782. audio: {
  67783. start: 0,
  67784. executeStart: 0,
  67785. executeEnd: 0,
  67786. end: 0
  67787. },
  67788. video: {
  67789. start: 0,
  67790. executeStart: 0,
  67791. executeEnd: 0,
  67792. end: 0
  67793. },
  67794. audiovideo: {
  67795. start: 0,
  67796. executeStart: 0,
  67797. executeEnd: 0,
  67798. end: 0
  67799. }
  67800. }, this.level = e, this.sn = t, this.id = i, this.size = r, this.part = n, this.partial = a
  67801. }
  67802. },
  67803. "./src/utils/attr-list.ts": function(e, t, i) {
  67804. "use strict";
  67805. i.r(t), i.d(t, "AttrList", function() {
  67806. return a
  67807. });
  67808. var r = /^(\d+)x(\d+)$/,
  67809. n = /\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,
  67810. a = function() {
  67811. function e(t) {
  67812. for (var i in "string" == typeof t && (t = e.parseAttrList(t)), t) t.hasOwnProperty(i) && (this[
  67813. i] = t[i])
  67814. }
  67815. var t = e.prototype;
  67816. return t.decimalInteger = function(e) {
  67817. var t = parseInt(this[e], 10);
  67818. return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t
  67819. }, t.hexadecimalInteger = function(e) {
  67820. if (this[e]) {
  67821. var t = (this[e] || "0x").slice(2);
  67822. t = (1 & t.length ? "0" : "") + t;
  67823. for (var i = new Uint8Array(t.length / 2), r = 0; r < t.length / 2; r++) i[r] = parseInt(t
  67824. .slice(2 * r, 2 * r + 2), 16);
  67825. return i
  67826. }
  67827. return null
  67828. }, t.hexadecimalIntegerAsNumber = function(e) {
  67829. var t = parseInt(this[e], 16);
  67830. return t > Number.MAX_SAFE_INTEGER ? 1 / 0 : t
  67831. }, t.decimalFloatingPoint = function(e) {
  67832. return parseFloat(this[e])
  67833. }, t.optionalFloat = function(e, t) {
  67834. var i = this[e];
  67835. return i ? parseFloat(i) : t
  67836. }, t.enumeratedString = function(e) {
  67837. return this[e]
  67838. }, t.bool = function(e) {
  67839. return "YES" === this[e]
  67840. }, t.decimalResolution = function(e) {
  67841. var t = r.exec(this[e]);
  67842. if (null !== t) return {
  67843. width: parseInt(t[1], 10),
  67844. height: parseInt(t[2], 10)
  67845. }
  67846. }, e.parseAttrList = function(e) {
  67847. var t, i = {};
  67848. for (n.lastIndex = 0; null !== (t = n.exec(e));) {
  67849. var r = t[2];
  67850. 0 === r.indexOf('"') && r.lastIndexOf('"') === r.length - 1 && (r = r.slice(1, -1)), i[t[1]] =
  67851. r
  67852. }
  67853. return i
  67854. }, e
  67855. }()
  67856. },
  67857. "./src/utils/binary-search.ts": function(e, t, i) {
  67858. "use strict";
  67859. i.r(t);
  67860. t.default = {
  67861. search: function(e, t) {
  67862. for (var i = 0, r = e.length - 1, n = null, a = null; i <= r;) {
  67863. var s = t(a = e[n = (i + r) / 2 | 0]);
  67864. if (s > 0) i = n + 1;
  67865. else {
  67866. if (!(s < 0)) return a;
  67867. r = n - 1
  67868. }
  67869. }
  67870. return null
  67871. }
  67872. }
  67873. },
  67874. "./src/utils/buffer-helper.ts": function(e, t, i) {
  67875. "use strict";
  67876. i.r(t), i.d(t, "BufferHelper", function() {
  67877. return a
  67878. });
  67879. var r = i("./src/utils/logger.ts"),
  67880. n = {
  67881. length: 0,
  67882. start: function() {
  67883. return 0
  67884. },
  67885. end: function() {
  67886. return 0
  67887. }
  67888. },
  67889. a = function() {
  67890. function e() {}
  67891. return e.isBuffered = function(t, i) {
  67892. try {
  67893. if (t)
  67894. for (var r = e.getBuffered(t), n = 0; n < r.length; n++)
  67895. if (i >= r.start(n) && i <= r.end(n)) return !0
  67896. } catch (e) {}
  67897. return !1
  67898. }, e.bufferInfo = function(t, i, r) {
  67899. try {
  67900. if (t) {
  67901. var n, a = e.getBuffered(t),
  67902. s = [];
  67903. for (n = 0; n < a.length; n++) s.push({
  67904. start: a.start(n),
  67905. end: a.end(n)
  67906. });
  67907. return this.bufferedInfo(s, i, r)
  67908. }
  67909. } catch (e) {}
  67910. return {
  67911. len: 0,
  67912. start: i,
  67913. end: i,
  67914. nextStart: void 0
  67915. }
  67916. }, e.bufferedInfo = function(e, t, i) {
  67917. t = Math.max(0, t), e.sort(function(e, t) {
  67918. var i = e.start - t.start;
  67919. return i || t.end - e.end
  67920. });
  67921. var r = [];
  67922. if (i)
  67923. for (var n = 0; n < e.length; n++) {
  67924. var a = r.length;
  67925. if (a) {
  67926. var s = r[a - 1].end;
  67927. e[n].start - s < i ? e[n].end > s && (r[a - 1].end = e[n].end) : r.push(e[n])
  67928. } else r.push(e[n])
  67929. } else r = e;
  67930. for (var o, u = 0, l = t, d = t, c = 0; c < r.length; c++) {
  67931. var h = r[c].start,
  67932. f = r[c].end;
  67933. if (t + i >= h && t < f) l = h, u = (d = f) - t;
  67934. else if (t + i < h) {
  67935. o = h;
  67936. break
  67937. }
  67938. }
  67939. return {
  67940. len: u,
  67941. start: l || 0,
  67942. end: d || 0,
  67943. nextStart: o
  67944. }
  67945. }, e.getBuffered = function(e) {
  67946. try {
  67947. return e.buffered
  67948. } catch (e) {
  67949. return r.logger.log("failed to get media.buffered", e), n
  67950. }
  67951. }, e
  67952. }()
  67953. },
  67954. "./src/utils/cea-608-parser.ts": function(e, t, i) {
  67955. "use strict";
  67956. i.r(t), i.d(t, "Row", function() {
  67957. return y
  67958. }), i.d(t, "CaptionScreen", function() {
  67959. return _
  67960. });
  67961. var r, n = i("./src/utils/logger.ts"),
  67962. a = {
  67963. 42: 225,
  67964. 92: 233,
  67965. 94: 237,
  67966. 95: 243,
  67967. 96: 250,
  67968. 123: 231,
  67969. 124: 247,
  67970. 125: 209,
  67971. 126: 241,
  67972. 127: 9608,
  67973. 128: 174,
  67974. 129: 176,
  67975. 130: 189,
  67976. 131: 191,
  67977. 132: 8482,
  67978. 133: 162,
  67979. 134: 163,
  67980. 135: 9834,
  67981. 136: 224,
  67982. 137: 32,
  67983. 138: 232,
  67984. 139: 226,
  67985. 140: 234,
  67986. 141: 238,
  67987. 142: 244,
  67988. 143: 251,
  67989. 144: 193,
  67990. 145: 201,
  67991. 146: 211,
  67992. 147: 218,
  67993. 148: 220,
  67994. 149: 252,
  67995. 150: 8216,
  67996. 151: 161,
  67997. 152: 42,
  67998. 153: 8217,
  67999. 154: 9473,
  68000. 155: 169,
  68001. 156: 8480,
  68002. 157: 8226,
  68003. 158: 8220,
  68004. 159: 8221,
  68005. 160: 192,
  68006. 161: 194,
  68007. 162: 199,
  68008. 163: 200,
  68009. 164: 202,
  68010. 165: 203,
  68011. 166: 235,
  68012. 167: 206,
  68013. 168: 207,
  68014. 169: 239,
  68015. 170: 212,
  68016. 171: 217,
  68017. 172: 249,
  68018. 173: 219,
  68019. 174: 171,
  68020. 175: 187,
  68021. 176: 195,
  68022. 177: 227,
  68023. 178: 205,
  68024. 179: 204,
  68025. 180: 236,
  68026. 181: 210,
  68027. 182: 242,
  68028. 183: 213,
  68029. 184: 245,
  68030. 185: 123,
  68031. 186: 125,
  68032. 187: 92,
  68033. 188: 94,
  68034. 189: 95,
  68035. 190: 124,
  68036. 191: 8764,
  68037. 192: 196,
  68038. 193: 228,
  68039. 194: 214,
  68040. 195: 246,
  68041. 196: 223,
  68042. 197: 165,
  68043. 198: 164,
  68044. 199: 9475,
  68045. 200: 197,
  68046. 201: 229,
  68047. 202: 216,
  68048. 203: 248,
  68049. 204: 9487,
  68050. 205: 9491,
  68051. 206: 9495,
  68052. 207: 9499
  68053. },
  68054. s = function(e) {
  68055. var t = e;
  68056. return a.hasOwnProperty(e) && (t = a[e]), String.fromCharCode(t)
  68057. },
  68058. o = 15,
  68059. u = 100,
  68060. l = {
  68061. 17: 1,
  68062. 18: 3,
  68063. 21: 5,
  68064. 22: 7,
  68065. 23: 9,
  68066. 16: 11,
  68067. 19: 12,
  68068. 20: 14
  68069. },
  68070. d = {
  68071. 17: 2,
  68072. 18: 4,
  68073. 21: 6,
  68074. 22: 8,
  68075. 23: 10,
  68076. 19: 13,
  68077. 20: 15
  68078. },
  68079. c = {
  68080. 25: 1,
  68081. 26: 3,
  68082. 29: 5,
  68083. 30: 7,
  68084. 31: 9,
  68085. 24: 11,
  68086. 27: 12,
  68087. 28: 14
  68088. },
  68089. h = {
  68090. 25: 2,
  68091. 26: 4,
  68092. 29: 6,
  68093. 30: 8,
  68094. 31: 10,
  68095. 27: 13,
  68096. 28: 15
  68097. },
  68098. f = ["white", "green", "blue", "cyan", "red", "yellow", "magenta", "black", "transparent"];
  68099. ! function(e) {
  68100. e[e.ERROR = 0] = "ERROR", e[e.TEXT = 1] = "TEXT", e[e.WARNING = 2] = "WARNING", e[e.INFO = 2] =
  68101. "INFO", e[e.DEBUG = 3] = "DEBUG", e[e.DATA = 3] = "DATA"
  68102. }(r || (r = {}));
  68103. var p = function() {
  68104. function e() {
  68105. this.time = null, this.verboseLevel = r.ERROR
  68106. }
  68107. return e.prototype.log = function(e, t) {
  68108. this.verboseLevel >= e && n.logger.log(this.time + " [" + e + "] " + t)
  68109. }, e
  68110. }(),
  68111. m = function(e) {
  68112. for (var t = [], i = 0; i < e.length; i++) t.push(e[i].toString(16));
  68113. return t
  68114. },
  68115. g = function() {
  68116. function e(e, t, i, r, n) {
  68117. this.foreground = void 0, this.underline = void 0, this.italics = void 0, this.background =
  68118. void 0, this.flash = void 0, this.foreground = e || "white", this.underline = t || !1, this
  68119. .italics = i || !1, this.background = r || "black", this.flash = n || !1
  68120. }
  68121. var t = e.prototype;
  68122. return t.reset = function() {
  68123. this.foreground = "white", this.underline = !1, this.italics = !1, this.background = "black",
  68124. this.flash = !1
  68125. }, t.setStyles = function(e) {
  68126. for (var t = ["foreground", "underline", "italics", "background", "flash"], i = 0; i < t
  68127. .length; i++) {
  68128. var r = t[i];
  68129. e.hasOwnProperty(r) && (this[r] = e[r])
  68130. }
  68131. }, t.isDefault = function() {
  68132. return "white" === this.foreground && !this.underline && !this.italics && "black" === this
  68133. .background && !this.flash
  68134. }, t.equals = function(e) {
  68135. return this.foreground === e.foreground && this.underline === e.underline && this.italics === e
  68136. .italics && this.background === e.background && this.flash === e.flash
  68137. }, t.copy = function(e) {
  68138. this.foreground = e.foreground, this.underline = e.underline, this.italics = e.italics, this
  68139. .background = e.background, this.flash = e.flash
  68140. }, t.toString = function() {
  68141. return "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this
  68142. .italics + ", background=" + this.background + ", flash=" + this.flash
  68143. }, e
  68144. }(),
  68145. v = function() {
  68146. function e(e, t, i, r, n, a) {
  68147. this.uchar = void 0, this.penState = void 0, this.uchar = e || " ", this.penState = new g(t, i, r,
  68148. n, a)
  68149. }
  68150. var t = e.prototype;
  68151. return t.reset = function() {
  68152. this.uchar = " ", this.penState.reset()
  68153. }, t.setChar = function(e, t) {
  68154. this.uchar = e, this.penState.copy(t)
  68155. }, t.setPenState = function(e) {
  68156. this.penState.copy(e)
  68157. }, t.equals = function(e) {
  68158. return this.uchar === e.uchar && this.penState.equals(e.penState)
  68159. }, t.copy = function(e) {
  68160. this.uchar = e.uchar, this.penState.copy(e.penState)
  68161. }, t.isEmpty = function() {
  68162. return " " === this.uchar && this.penState.isDefault()
  68163. }, e
  68164. }(),
  68165. y = function() {
  68166. function e(e) {
  68167. this.chars = void 0, this.pos = void 0, this.currPenState = void 0, this.cueStartTime = void 0,
  68168. this.logger = void 0, this.chars = [];
  68169. for (var t = 0; t < u; t++) this.chars.push(new v);
  68170. this.logger = e, this.pos = 0, this.currPenState = new g
  68171. }
  68172. var t = e.prototype;
  68173. return t.equals = function(e) {
  68174. for (var t = !0, i = 0; i < u; i++)
  68175. if (!this.chars[i].equals(e.chars[i])) {
  68176. t = !1;
  68177. break
  68178. } return t
  68179. }, t.copy = function(e) {
  68180. for (var t = 0; t < u; t++) this.chars[t].copy(e.chars[t])
  68181. }, t.isEmpty = function() {
  68182. for (var e = !0, t = 0; t < u; t++)
  68183. if (!this.chars[t].isEmpty()) {
  68184. e = !1;
  68185. break
  68186. } return e
  68187. }, t.setCursor = function(e) {
  68188. this.pos !== e && (this.pos = e), this.pos < 0 ? (this.logger.log(r.DEBUG,
  68189. "Negative cursor position " + this.pos), this.pos = 0) : this.pos > u && (this.logger.log(r
  68190. .DEBUG, "Too large cursor position " + this.pos), this.pos = u)
  68191. }, t.moveCursor = function(e) {
  68192. var t = this.pos + e;
  68193. if (e > 1)
  68194. for (var i = this.pos + 1; i < t + 1; i++) this.chars[i].setPenState(this.currPenState);
  68195. this.setCursor(t)
  68196. }, t.backSpace = function() {
  68197. this.moveCursor(-1), this.chars[this.pos].setChar(" ", this.currPenState)
  68198. }, t.insertChar = function(e) {
  68199. e >= 144 && this.backSpace();
  68200. var t = s(e);
  68201. this.pos >= u ? this.logger.log(r.ERROR, "Cannot insert " + e.toString(16) + " (" + t +
  68202. ") at position " + this.pos + ". Skipping it!") : (this.chars[this.pos].setChar(t, this
  68203. .currPenState), this.moveCursor(1))
  68204. }, t.clearFromPos = function(e) {
  68205. var t;
  68206. for (t = e; t < u; t++) this.chars[t].reset()
  68207. }, t.clear = function() {
  68208. this.clearFromPos(0), this.pos = 0, this.currPenState.reset()
  68209. }, t.clearToEndOfRow = function() {
  68210. this.clearFromPos(this.pos)
  68211. }, t.getTextString = function() {
  68212. for (var e = [], t = !0, i = 0; i < u; i++) {
  68213. var r = this.chars[i].uchar;
  68214. " " !== r && (t = !1), e.push(r)
  68215. }
  68216. return t ? "" : e.join("")
  68217. }, t.setPenStyles = function(e) {
  68218. this.currPenState.setStyles(e), this.chars[this.pos].setPenState(this.currPenState)
  68219. }, e
  68220. }(),
  68221. _ = function() {
  68222. function e(e) {
  68223. this.rows = void 0, this.currRow = void 0, this.nrRollUpRows = void 0, this.lastOutputScreen =
  68224. void 0, this.logger = void 0, this.rows = [];
  68225. for (var t = 0; t < o; t++) this.rows.push(new y(e));
  68226. this.logger = e, this.currRow = o - 1, this.nrRollUpRows = null, this.lastOutputScreen = null,
  68227. this.reset()
  68228. }
  68229. var t = e.prototype;
  68230. return t.reset = function() {
  68231. for (var e = 0; e < o; e++) this.rows[e].clear();
  68232. this.currRow = o - 1
  68233. }, t.equals = function(e) {
  68234. for (var t = !0, i = 0; i < o; i++)
  68235. if (!this.rows[i].equals(e.rows[i])) {
  68236. t = !1;
  68237. break
  68238. } return t
  68239. }, t.copy = function(e) {
  68240. for (var t = 0; t < o; t++) this.rows[t].copy(e.rows[t])
  68241. }, t.isEmpty = function() {
  68242. for (var e = !0, t = 0; t < o; t++)
  68243. if (!this.rows[t].isEmpty()) {
  68244. e = !1;
  68245. break
  68246. } return e
  68247. }, t.backSpace = function() {
  68248. this.rows[this.currRow].backSpace()
  68249. }, t.clearToEndOfRow = function() {
  68250. this.rows[this.currRow].clearToEndOfRow()
  68251. }, t.insertChar = function(e) {
  68252. this.rows[this.currRow].insertChar(e)
  68253. }, t.setPen = function(e) {
  68254. this.rows[this.currRow].setPenStyles(e)
  68255. }, t.moveCursor = function(e) {
  68256. this.rows[this.currRow].moveCursor(e)
  68257. }, t.setCursor = function(e) {
  68258. this.logger.log(r.INFO, "setCursor: " + e), this.rows[this.currRow].setCursor(e)
  68259. }, t.setPAC = function(e) {
  68260. this.logger.log(r.INFO, "pacData = " + JSON.stringify(e));
  68261. var t = e.row - 1;
  68262. if (this.nrRollUpRows && t < this.nrRollUpRows - 1 && (t = this.nrRollUpRows - 1), this
  68263. .nrRollUpRows && this.currRow !== t) {
  68264. for (var i = 0; i < o; i++) this.rows[i].clear();
  68265. var n = this.currRow + 1 - this.nrRollUpRows,
  68266. a = this.lastOutputScreen;
  68267. if (a) {
  68268. var s = a.rows[n].cueStartTime,
  68269. u = this.logger.time;
  68270. if (s && null !== u && s < u)
  68271. for (var l = 0; l < this.nrRollUpRows; l++) this.rows[t - this.nrRollUpRows + l + 1].copy(
  68272. a.rows[n + l])
  68273. }
  68274. }
  68275. this.currRow = t;
  68276. var d = this.rows[this.currRow];
  68277. if (null !== e.indent) {
  68278. var c = e.indent,
  68279. h = Math.max(c - 1, 0);
  68280. d.setCursor(e.indent), e.color = d.chars[h].penState.foreground
  68281. }
  68282. var f = {
  68283. foreground: e.color,
  68284. underline: e.underline,
  68285. italics: e.italics,
  68286. background: "black",
  68287. flash: !1
  68288. };
  68289. this.setPen(f)
  68290. }, t.setBkgData = function(e) {
  68291. this.logger.log(r.INFO, "bkgData = " + JSON.stringify(e)), this.backSpace(), this.setPen(e),
  68292. this.insertChar(32)
  68293. }, t.setRollUpRows = function(e) {
  68294. this.nrRollUpRows = e
  68295. }, t.rollUp = function() {
  68296. if (null !== this.nrRollUpRows) {
  68297. this.logger.log(r.TEXT, this.getDisplayText());
  68298. var e = this.currRow + 1 - this.nrRollUpRows,
  68299. t = this.rows.splice(e, 1)[0];
  68300. t.clear(), this.rows.splice(this.currRow, 0, t), this.logger.log(r.INFO, "Rolling up")
  68301. } else this.logger.log(r.DEBUG, "roll_up but nrRollUpRows not set yet")
  68302. }, t.getDisplayText = function(e) {
  68303. e = e || !1;
  68304. for (var t = [], i = "", r = -1, n = 0; n < o; n++) {
  68305. var a = this.rows[n].getTextString();
  68306. a && (r = n + 1, e ? t.push("Row " + r + ": '" + a + "'") : t.push(a.trim()))
  68307. }
  68308. return t.length > 0 && (i = e ? "[" + t.join(" | ") + "]" : t.join("\n")), i
  68309. }, t.getTextAndFormat = function() {
  68310. return this.rows
  68311. }, e
  68312. }(),
  68313. b = function() {
  68314. function e(e, t, i) {
  68315. this.chNr = void 0, this.outputFilter = void 0, this.mode = void 0, this.verbose = void 0, this
  68316. .displayedMemory = void 0, this.nonDisplayedMemory = void 0, this.lastOutputScreen = void 0,
  68317. this.currRollUpRow = void 0, this.writeScreen = void 0, this.cueStartTime = void 0, this
  68318. .logger = void 0, this.chNr = e, this.outputFilter = t, this.mode = null, this.verbose = 0, this
  68319. .displayedMemory = new _(i), this.nonDisplayedMemory = new _(i), this.lastOutputScreen = new _(
  68320. i), this.currRollUpRow = this.displayedMemory.rows[o - 1], this.writeScreen = this
  68321. .displayedMemory, this.mode = null, this.cueStartTime = null, this.logger = i
  68322. }
  68323. var t = e.prototype;
  68324. return t.reset = function() {
  68325. this.mode = null, this.displayedMemory.reset(), this.nonDisplayedMemory.reset(), this
  68326. .lastOutputScreen.reset(), this.outputFilter.reset(), this.currRollUpRow = this
  68327. .displayedMemory.rows[o - 1], this.writeScreen = this.displayedMemory, this.mode = null, this
  68328. .cueStartTime = null
  68329. }, t.getHandler = function() {
  68330. return this.outputFilter
  68331. }, t.setHandler = function(e) {
  68332. this.outputFilter = e
  68333. }, t.setPAC = function(e) {
  68334. this.writeScreen.setPAC(e)
  68335. }, t.setBkgData = function(e) {
  68336. this.writeScreen.setBkgData(e)
  68337. }, t.setMode = function(e) {
  68338. e !== this.mode && (this.mode = e, this.logger.log(r.INFO, "MODE=" + e), "MODE_POP-ON" === this
  68339. .mode ? this.writeScreen = this.nonDisplayedMemory : (this.writeScreen = this
  68340. .displayedMemory, this.writeScreen.reset()), "MODE_ROLL-UP" !== this.mode && (this
  68341. .displayedMemory.nrRollUpRows = null, this.nonDisplayedMemory.nrRollUpRows = null), this
  68342. .mode = e)
  68343. }, t.insertChars = function(e) {
  68344. for (var t = 0; t < e.length; t++) this.writeScreen.insertChar(e[t]);
  68345. var i = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP";
  68346. this.logger.log(r.INFO, i + ": " + this.writeScreen.getDisplayText(!0)), "MODE_PAINT-ON" !==
  68347. this.mode && "MODE_ROLL-UP" !== this.mode || (this.logger.log(r.TEXT, "DISPLAYED: " + this
  68348. .displayedMemory.getDisplayText(!0)), this.outputDataUpdate())
  68349. }, t.ccRCL = function() {
  68350. this.logger.log(r.INFO, "RCL - Resume Caption Loading"), this.setMode("MODE_POP-ON")
  68351. }, t.ccBS = function() {
  68352. this.logger.log(r.INFO, "BS - BackSpace"), "MODE_TEXT" !== this.mode && (this.writeScreen
  68353. .backSpace(), this.writeScreen === this.displayedMemory && this.outputDataUpdate())
  68354. }, t.ccAOF = function() {}, t.ccAON = function() {}, t.ccDER = function() {
  68355. this.logger.log(r.INFO, "DER- Delete to End of Row"), this.writeScreen.clearToEndOfRow(), this
  68356. .outputDataUpdate()
  68357. }, t.ccRU = function(e) {
  68358. this.logger.log(r.INFO, "RU(" + e + ") - Roll Up"), this.writeScreen = this.displayedMemory,
  68359. this.setMode("MODE_ROLL-UP"), this.writeScreen.setRollUpRows(e)
  68360. }, t.ccFON = function() {
  68361. this.logger.log(r.INFO, "FON - Flash On"), this.writeScreen.setPen({
  68362. flash: !0
  68363. })
  68364. }, t.ccRDC = function() {
  68365. this.logger.log(r.INFO, "RDC - Resume Direct Captioning"), this.setMode("MODE_PAINT-ON")
  68366. }, t.ccTR = function() {
  68367. this.logger.log(r.INFO, "TR"), this.setMode("MODE_TEXT")
  68368. }, t.ccRTD = function() {
  68369. this.logger.log(r.INFO, "RTD"), this.setMode("MODE_TEXT")
  68370. }, t.ccEDM = function() {
  68371. this.logger.log(r.INFO, "EDM - Erase Displayed Memory"), this.displayedMemory.reset(), this
  68372. .outputDataUpdate(!0)
  68373. }, t.ccCR = function() {
  68374. this.logger.log(r.INFO, "CR - Carriage Return"), this.writeScreen.rollUp(), this
  68375. .outputDataUpdate(!0)
  68376. }, t.ccENM = function() {
  68377. this.logger.log(r.INFO, "ENM - Erase Non-displayed Memory"), this.nonDisplayedMemory.reset()
  68378. }, t.ccEOC = function() {
  68379. if (this.logger.log(r.INFO, "EOC - End Of Caption"), "MODE_POP-ON" === this.mode) {
  68380. var e = this.displayedMemory;
  68381. this.displayedMemory = this.nonDisplayedMemory, this.nonDisplayedMemory = e, this
  68382. .writeScreen = this.nonDisplayedMemory, this.logger.log(r.TEXT, "DISP: " + this
  68383. .displayedMemory.getDisplayText())
  68384. }
  68385. this.outputDataUpdate(!0)
  68386. }, t.ccTO = function(e) {
  68387. this.logger.log(r.INFO, "TO(" + e + ") - Tab Offset"), this.writeScreen.moveCursor(e)
  68388. }, t.ccMIDROW = function(e) {
  68389. var t = {
  68390. flash: !1
  68391. };
  68392. if (t.underline = e % 2 == 1, t.italics = e >= 46, t.italics) t.foreground = "white";
  68393. else {
  68394. var i = Math.floor(e / 2) - 16;
  68395. t.foreground = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"][i]
  68396. }
  68397. this.logger.log(r.INFO, "MIDROW: " + JSON.stringify(t)), this.writeScreen.setPen(t)
  68398. }, t.outputDataUpdate = function(e) {
  68399. void 0 === e && (e = !1);
  68400. var t = this.logger.time;
  68401. null !== t && this.outputFilter && (null !== this.cueStartTime || this.displayedMemory
  68402. .isEmpty() ? this.displayedMemory.equals(this.lastOutputScreen) || (this.outputFilter.newCue(
  68403. this.cueStartTime, t, this.lastOutputScreen), e && this.outputFilter.dispatchCue && this
  68404. .outputFilter.dispatchCue(), this.cueStartTime = this.displayedMemory.isEmpty() ? null : t
  68405. ) : this.cueStartTime = t, this.lastOutputScreen.copy(this.displayedMemory))
  68406. }, t.cueSplitAtTime = function(e) {
  68407. this.outputFilter && (this.displayedMemory.isEmpty() || (this.outputFilter.newCue && this
  68408. .outputFilter.newCue(this.cueStartTime, e, this.displayedMemory), this.cueStartTime = e))
  68409. }, e
  68410. }(),
  68411. w = function() {
  68412. function e(e, t, i) {
  68413. this.channels = void 0, this.currentChannel = 0, this.cmdHistory = void 0, this.logger = void 0;
  68414. var r = new p;
  68415. this.channels = [null, new b(e, t, r), new b(e + 1, i, r)], this.cmdHistory = {
  68416. a: null,
  68417. b: null
  68418. }, this.logger = r
  68419. }
  68420. var t = e.prototype;
  68421. return t.getHandler = function(e) {
  68422. return this.channels[e].getHandler()
  68423. }, t.setHandler = function(e, t) {
  68424. this.channels[e].setHandler(t)
  68425. }, t.addData = function(e, t) {
  68426. var i, n, a, s = !1;
  68427. this.logger.time = e;
  68428. for (var o = 0; o < t.length; o += 2)
  68429. if (n = 127 & t[o], a = 127 & t[o + 1], 0 !== n || 0 !== a) {
  68430. if (this.logger.log(r.DATA, "[" + m([t[o], t[o + 1]]) + "] -> (" + m([n, a]) + ")"), (i =
  68431. this.parseCmd(n, a)) || (i = this.parseMidrow(n, a)), i || (i = this.parsePAC(n, a)),
  68432. i || (i = this.parseBackgroundAttributes(n, a)), !i && (s = this.parseChars(n, a))) {
  68433. var u = this.currentChannel;
  68434. if (u && u > 0) this.channels[u].insertChars(s);
  68435. else this.logger.log(r.WARNING, "No channel found yet. TEXT-MODE?")
  68436. }
  68437. i || s || this.logger.log(r.WARNING, "Couldn't parse cleaned data " + m([n, a]) +
  68438. " orig: " + m([t[o], t[o + 1]]))
  68439. }
  68440. }, t.parseCmd = function(e, t) {
  68441. var i = this.cmdHistory;
  68442. if (!((20 === e || 28 === e || 21 === e || 29 === e) && t >= 32 && t <= 47) && !((23 === e ||
  68443. 31 === e) && t >= 33 && t <= 35)) return !1;
  68444. if (T(e, t, i)) return E(null, null, i), this.logger.log(r.DEBUG, "Repeated command (" + m([e,
  68445. t]) + ") is dropped"), !0;
  68446. var n = 20 === e || 21 === e || 23 === e ? 1 : 2,
  68447. a = this.channels[n];
  68448. return 20 === e || 21 === e || 28 === e || 29 === e ? 32 === t ? a.ccRCL() : 33 === t ? a
  68449. .ccBS() : 34 === t ? a.ccAOF() : 35 === t ? a.ccAON() : 36 === t ? a.ccDER() : 37 === t ? a
  68450. .ccRU(2) : 38 === t ? a.ccRU(3) : 39 === t ? a.ccRU(4) : 40 === t ? a.ccFON() : 41 === t ? a
  68451. .ccRDC() : 42 === t ? a.ccTR() : 43 === t ? a.ccRTD() : 44 === t ? a.ccEDM() : 45 === t ? a
  68452. .ccCR() : 46 === t ? a.ccENM() : 47 === t && a.ccEOC() : a.ccTO(t - 32), E(e, t, i), this
  68453. .currentChannel = n, !0
  68454. }, t.parseMidrow = function(e, t) {
  68455. var i = 0;
  68456. if ((17 === e || 25 === e) && t >= 32 && t <= 47) {
  68457. if ((i = 17 === e ? 1 : 2) !== this.currentChannel) return this.logger.log(r.ERROR,
  68458. "Mismatch channel in midrow parsing"), !1;
  68459. var n = this.channels[i];
  68460. return !!n && (n.ccMIDROW(t), this.logger.log(r.DEBUG, "MIDROW (" + m([e, t]) + ")"), !0)
  68461. }
  68462. return !1
  68463. }, t.parsePAC = function(e, t) {
  68464. var i, r = this.cmdHistory;
  68465. if (!((e >= 17 && e <= 23 || e >= 25 && e <= 31) && t >= 64 && t <= 127) && !((16 === e ||
  68466. 24 === e) && t >= 64 && t <= 95)) return !1;
  68467. if (T(e, t, r)) return E(null, null, r), !0;
  68468. var n = e <= 23 ? 1 : 2;
  68469. i = t >= 64 && t <= 95 ? 1 === n ? l[e] : c[e] : 1 === n ? d[e] : h[e];
  68470. var a = this.channels[n];
  68471. return !!a && (a.setPAC(this.interpretPAC(i, t)), E(e, t, r), this.currentChannel = n, !0)
  68472. }, t.interpretPAC = function(e, t) {
  68473. var i, r = {
  68474. color: null,
  68475. italics: !1,
  68476. indent: null,
  68477. underline: !1,
  68478. row: e
  68479. };
  68480. return i = t > 95 ? t - 96 : t - 64, r.underline = 1 == (1 & i), i <= 13 ? r.color = ["white",
  68481. "green", "blue", "cyan", "red", "yellow", "magenta", "white"
  68482. ][Math.floor(i / 2)] : i <= 15 ? (r.italics = !0, r.color = "white") : r.indent = 4 * Math
  68483. .floor((i - 16) / 2), r
  68484. }, t.parseChars = function(e, t) {
  68485. var i, n, a = null,
  68486. o = null;
  68487. (e >= 25 ? (i = 2, o = e - 8) : (i = 1, o = e), o >= 17 && o <= 19) ? (n = 17 === o ? t + 80 :
  68488. 18 === o ? t + 112 : t + 144, this.logger.log(r.INFO, "Special char '" + s(n) +
  68489. "' in channel " + i), a = [n]) : e >= 32 && e <= 127 && (a = 0 === t ? [e] : [e, t]);
  68490. if (a) {
  68491. var u = m(a);
  68492. this.logger.log(r.DEBUG, "Char codes = " + u.join(",")), E(e, t, this.cmdHistory)
  68493. }
  68494. return a
  68495. }, t.parseBackgroundAttributes = function(e, t) {
  68496. var i;
  68497. if (!((16 === e || 24 === e) && t >= 32 && t <= 47) && !((23 === e || 31 === e) && t >= 45 &&
  68498. t <= 47)) return !1;
  68499. var r = {};
  68500. 16 === e || 24 === e ? (i = Math.floor((t - 32) / 2), r.background = f[i], t % 2 == 1 && (r
  68501. .background = r.background + "_semi")) : 45 === t ? r.background = "transparent" : (r
  68502. .foreground = "black", 47 === t && (r.underline = !0));
  68503. var n = e <= 23 ? 1 : 2;
  68504. return this.channels[n].setBkgData(r), E(e, t, this.cmdHistory), !0
  68505. }, t.reset = function() {
  68506. for (var e = 0; e < Object.keys(this.channels).length; e++) {
  68507. var t = this.channels[e];
  68508. t && t.reset()
  68509. }
  68510. this.cmdHistory = {
  68511. a: null,
  68512. b: null
  68513. }
  68514. }, t.cueSplitAtTime = function(e) {
  68515. for (var t = 0; t < this.channels.length; t++) {
  68516. var i = this.channels[t];
  68517. i && i.cueSplitAtTime(e)
  68518. }
  68519. }, e
  68520. }();
  68521. function E(e, t, i) {
  68522. i.a = e, i.b = t
  68523. }
  68524. function T(e, t, i) {
  68525. return i.a === e && i.b === t
  68526. }
  68527. t.default = w
  68528. },
  68529. "./src/utils/codecs.ts": function(e, t, i) {
  68530. "use strict";
  68531. i.r(t), i.d(t, "isCodecType", function() {
  68532. return n
  68533. }), i.d(t, "isCodecSupportedInMp4", function() {
  68534. return a
  68535. });
  68536. var r = {
  68537. audio: {
  68538. a3ds: !0,
  68539. "ac-3": !0,
  68540. "ac-4": !0,
  68541. alac: !0,
  68542. alaw: !0,
  68543. dra1: !0,
  68544. "dts+": !0,
  68545. "dts-": !0,
  68546. dtsc: !0,
  68547. dtse: !0,
  68548. dtsh: !0,
  68549. "ec-3": !0,
  68550. enca: !0,
  68551. g719: !0,
  68552. g726: !0,
  68553. m4ae: !0,
  68554. mha1: !0,
  68555. mha2: !0,
  68556. mhm1: !0,
  68557. mhm2: !0,
  68558. mlpa: !0,
  68559. mp4a: !0,
  68560. "raw ": !0,
  68561. Opus: !0,
  68562. samr: !0,
  68563. sawb: !0,
  68564. sawp: !0,
  68565. sevc: !0,
  68566. sqcp: !0,
  68567. ssmv: !0,
  68568. twos: !0,
  68569. ulaw: !0
  68570. },
  68571. video: {
  68572. avc1: !0,
  68573. avc2: !0,
  68574. avc3: !0,
  68575. avc4: !0,
  68576. avcp: !0,
  68577. av01: !0,
  68578. drac: !0,
  68579. dvav: !0,
  68580. dvhe: !0,
  68581. encv: !0,
  68582. hev1: !0,
  68583. hvc1: !0,
  68584. mjp2: !0,
  68585. mp4v: !0,
  68586. mvc1: !0,
  68587. mvc2: !0,
  68588. mvc3: !0,
  68589. mvc4: !0,
  68590. resv: !0,
  68591. rv60: !0,
  68592. s263: !0,
  68593. svc1: !0,
  68594. svc2: !0,
  68595. "vc-1": !0,
  68596. vp08: !0,
  68597. vp09: !0
  68598. },
  68599. text: {
  68600. stpp: !0,
  68601. wvtt: !0
  68602. }
  68603. };
  68604. function n(e, t) {
  68605. var i = r[t];
  68606. return !!i && !0 === i[e.slice(0, 4)]
  68607. }
  68608. function a(e, t) {
  68609. return MediaSource.isTypeSupported((t || "video") + '/mp4;codecs="' + e + '"')
  68610. }
  68611. },
  68612. "./src/utils/cues.ts": function(e, t, i) {
  68613. "use strict";
  68614. i.r(t);
  68615. var r = i("./src/utils/vttparser.ts"),
  68616. n = i("./src/utils/webvtt-parser.ts"),
  68617. a = i("./src/utils/texttrack-utils.ts"),
  68618. s = /\s/,
  68619. o = {
  68620. newCue: function(e, t, i, o) {
  68621. for (var u, l, d, c, h, f = [], p = self.VTTCue || self.TextTrackCue, m = 0; m < o.rows
  68622. .length; m++)
  68623. if (d = !0, c = 0, h = "", !(u = o.rows[m]).isEmpty()) {
  68624. for (var g = 0; g < u.chars.length; g++) s.test(u.chars[g].uchar) && d ? c++ : (h += u
  68625. .chars[g].uchar, d = !1);
  68626. u.cueStartTime = t, t === i && (i += 1e-4), c >= 16 ? c-- : c++;
  68627. var v = Object(r.fixLineBreaks)(h.trim()),
  68628. y = Object(n.generateCueId)(t, i, v);
  68629. e && e.cues && e.cues.getCueById(y) || ((l = new p(t, i, v)).id = y, l.line = m + 1, l
  68630. .align = "left", l.position = 10 + Math.min(80, 10 * Math.floor(8 * c / 32)), f.push(l))
  68631. } return e && f.length && (f.sort(function(e, t) {
  68632. return "auto" === e.line || "auto" === t.line ? 0 : e.line > 8 && t.line > 8 ? t.line -
  68633. e.line : e.line - t.line
  68634. }), f.forEach(function(t) {
  68635. return Object(a.addCueToTrack)(e, t)
  68636. })), f
  68637. }
  68638. };
  68639. t.default = o
  68640. },
  68641. "./src/utils/discontinuities.ts": function(e, t, i) {
  68642. "use strict";
  68643. i.r(t), i.d(t, "findFirstFragWithCC", function() {
  68644. return s
  68645. }), i.d(t, "shouldAlignOnDiscontinuities", function() {
  68646. return o
  68647. }), i.d(t, "findDiscontinuousReferenceFrag", function() {
  68648. return u
  68649. }), i.d(t, "adjustSlidingStart", function() {
  68650. return d
  68651. }), i.d(t, "alignStream", function() {
  68652. return c
  68653. }), i.d(t, "alignPDT", function() {
  68654. return h
  68655. }), i.d(t, "alignFragmentByPDTDelta", function() {
  68656. return f
  68657. }), i.d(t, "alignMediaPlaylistByPDT", function() {
  68658. return p
  68659. });
  68660. var r = i("./src/polyfills/number.ts"),
  68661. n = i("./src/utils/logger.ts"),
  68662. a = i("./src/controller/level-helper.ts");
  68663. function s(e, t) {
  68664. for (var i = null, r = 0, n = e.length; r < n; r++) {
  68665. var a = e[r];
  68666. if (a && a.cc === t) {
  68667. i = a;
  68668. break
  68669. }
  68670. }
  68671. return i
  68672. }
  68673. function o(e, t, i) {
  68674. return !(!t.details || !(i.endCC > i.startCC || e && e.cc < i.startCC))
  68675. }
  68676. function u(e, t) {
  68677. var i = e.fragments,
  68678. r = t.fragments;
  68679. if (r.length && i.length) {
  68680. var a = s(i, r[0].cc);
  68681. if (a && (!a || a.startPTS)) return a;
  68682. n.logger.log("No frag in previous level to align on")
  68683. } else n.logger.log("No fragments to align")
  68684. }
  68685. function l(e, t) {
  68686. if (e) {
  68687. var i = e.start + t;
  68688. e.start = e.startPTS = i, e.endPTS = i + e.duration
  68689. }
  68690. }
  68691. function d(e, t) {
  68692. for (var i = t.fragments, r = 0, n = i.length; r < n; r++) l(i[r], e);
  68693. t.fragmentHint && l(t.fragmentHint, e), t.alignedSliding = !0
  68694. }
  68695. function c(e, t, i) {
  68696. t && (! function(e, t, i) {
  68697. if (o(e, i, t)) {
  68698. var a = u(i.details, t);
  68699. a && Object(r.isFiniteNumber)(a.start) && (n.logger.log(
  68700. "Adjusting PTS using last level due to CC increase within current level " + t.url), d(a
  68701. .start, t))
  68702. }
  68703. }(e, i, t), !i.alignedSliding && t.details && h(i, t.details), i.alignedSliding || !t.details || i
  68704. .skippedSegments || Object(a.adjustSliding)(t.details, i))
  68705. }
  68706. function h(e, t) {
  68707. if (t.fragments.length && e.hasProgramDateTime && t.hasProgramDateTime) {
  68708. var i = t.fragments[0].programDateTime,
  68709. a = e.fragments[0].programDateTime,
  68710. s = (a - i) / 1e3 + t.fragments[0].start;
  68711. s && Object(r.isFiniteNumber)(s) && (n.logger.log("Adjusting PTS using programDateTime delta " + (
  68712. a - i) + "ms, sliding:" + s.toFixed(3) + " " + e.url + " "), d(s, e))
  68713. }
  68714. }
  68715. function f(e, t) {
  68716. var i = e.programDateTime;
  68717. if (i) {
  68718. var r = (i - t) / 1e3;
  68719. e.start = e.startPTS = r, e.endPTS = r + e.duration
  68720. }
  68721. }
  68722. function p(e, t) {
  68723. if (t.fragments.length && e.hasProgramDateTime && t.hasProgramDateTime) {
  68724. var i = t.fragments[0].programDateTime - 1e3 * t.fragments[0].start;
  68725. e.fragments.forEach(function(e) {
  68726. f(e, i)
  68727. }), e.fragmentHint && f(e.fragmentHint, i), e.alignedSliding = !0
  68728. }
  68729. }
  68730. },
  68731. "./src/utils/ewma-bandwidth-estimator.ts": function(e, t, i) {
  68732. "use strict";
  68733. i.r(t);
  68734. var r = i("./src/utils/ewma.ts"),
  68735. n = function() {
  68736. function e(e, t, i) {
  68737. this.defaultEstimate_ = void 0, this.minWeight_ = void 0, this.minDelayMs_ = void 0, this.slow_ =
  68738. void 0, this.fast_ = void 0, this.defaultEstimate_ = i, this.minWeight_ = .001, this
  68739. .minDelayMs_ = 50, this.slow_ = new r.default(e), this.fast_ = new r.default(t)
  68740. }
  68741. var t = e.prototype;
  68742. return t.update = function(e, t) {
  68743. var i = this.slow_,
  68744. n = this.fast_;
  68745. this.slow_.halfLife !== e && (this.slow_ = new r.default(e, i.getEstimate(), i
  68746. .getTotalWeight())), this.fast_.halfLife !== t && (this.fast_ = new r.default(t, n
  68747. .getEstimate(), n.getTotalWeight()))
  68748. }, t.sample = function(e, t) {
  68749. var i = (e = Math.max(e, this.minDelayMs_)) / 1e3,
  68750. r = 8 * t / i;
  68751. this.fast_.sample(i, r), this.slow_.sample(i, r)
  68752. }, t.canEstimate = function() {
  68753. var e = this.fast_;
  68754. return e && e.getTotalWeight() >= this.minWeight_
  68755. }, t.getEstimate = function() {
  68756. return this.canEstimate() ? Math.min(this.fast_.getEstimate(), this.slow_.getEstimate()) : this
  68757. .defaultEstimate_
  68758. }, t.destroy = function() {}, e
  68759. }();
  68760. t.default = n
  68761. },
  68762. "./src/utils/ewma.ts": function(e, t, i) {
  68763. "use strict";
  68764. i.r(t);
  68765. var r = function() {
  68766. function e(e, t, i) {
  68767. void 0 === t && (t = 0), void 0 === i && (i = 0), this.halfLife = void 0, this.alpha_ = void 0,
  68768. this.estimate_ = void 0, this.totalWeight_ = void 0, this.halfLife = e, this.alpha_ = e ? Math
  68769. .exp(Math.log(.5) / e) : 0, this.estimate_ = t, this.totalWeight_ = i
  68770. }
  68771. var t = e.prototype;
  68772. return t.sample = function(e, t) {
  68773. var i = Math.pow(this.alpha_, e);
  68774. this.estimate_ = t * (1 - i) + i * this.estimate_, this.totalWeight_ += e
  68775. }, t.getTotalWeight = function() {
  68776. return this.totalWeight_
  68777. }, t.getEstimate = function() {
  68778. if (this.alpha_) {
  68779. var e = 1 - Math.pow(this.alpha_, this.totalWeight_);
  68780. if (e) return this.estimate_ / e
  68781. }
  68782. return this.estimate_
  68783. }, e
  68784. }();
  68785. t.default = r
  68786. },
  68787. "./src/utils/fetch-loader.ts": function(e, t, i) {
  68788. "use strict";
  68789. i.r(t), i.d(t, "fetchSupported", function() {
  68790. return c
  68791. });
  68792. var r = i("./src/polyfills/number.ts"),
  68793. n = i("./src/loader/load-stats.ts"),
  68794. a = i("./src/demux/chunk-cache.ts");
  68795. function s(e) {
  68796. var t = "function" == typeof Map ? new Map : void 0;
  68797. return (s = function(e) {
  68798. if (null === e || (i = e, -1 === Function.toString.call(i).indexOf("[native code]"))) return e;
  68799. var i;
  68800. if ("function" != typeof e) throw new TypeError(
  68801. "Super expression must either be null or a function");
  68802. if (void 0 !== t) {
  68803. if (t.has(e)) return t.get(e);
  68804. t.set(e, r)
  68805. }
  68806. function r() {
  68807. return o(e, arguments, l(this).constructor)
  68808. }
  68809. return r.prototype = Object.create(e.prototype, {
  68810. constructor: {
  68811. value: r,
  68812. enumerable: !1,
  68813. writable: !0,
  68814. configurable: !0
  68815. }
  68816. }), u(r, e)
  68817. })(e)
  68818. }
  68819. function o(e, t, i) {
  68820. return (o = function() {
  68821. if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  68822. if (Reflect.construct.sham) return !1;
  68823. if ("function" == typeof Proxy) return !0;
  68824. try {
  68825. return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})), !0
  68826. } catch (e) {
  68827. return !1
  68828. }
  68829. }() ? Reflect.construct.bind() : function(e, t, i) {
  68830. var r = [null];
  68831. r.push.apply(r, t);
  68832. var n = new(Function.bind.apply(e, r));
  68833. return i && u(n, i.prototype), n
  68834. }).apply(null, arguments)
  68835. }
  68836. function u(e, t) {
  68837. return (u = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
  68838. return e.__proto__ = t, e
  68839. })(e, t)
  68840. }
  68841. function l(e) {
  68842. return (l = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
  68843. return e.__proto__ || Object.getPrototypeOf(e)
  68844. })(e)
  68845. }
  68846. function d() {
  68847. return (d = Object.assign ? Object.assign.bind() : function(e) {
  68848. for (var t = 1; t < arguments.length; t++) {
  68849. var i = arguments[t];
  68850. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  68851. }
  68852. return e
  68853. }).apply(this, arguments)
  68854. }
  68855. function c() {
  68856. if (self.fetch && self.AbortController && self.ReadableStream && self.Request) try {
  68857. return new self.ReadableStream({}), !0
  68858. } catch (e) {}
  68859. return !1
  68860. }
  68861. var h = function() {
  68862. function e(e) {
  68863. this.fetchSetup = void 0, this.requestTimeout = void 0, this.request = void 0, this.response =
  68864. void 0, this.controller = void 0, this.context = void 0, this.config = null, this.callbacks =
  68865. null, this.stats = void 0, this.loader = null, this.fetchSetup = e.fetchSetup || f, this
  68866. .controller = new self.AbortController, this.stats = new n.LoadStats
  68867. }
  68868. var t = e.prototype;
  68869. return t.destroy = function() {
  68870. this.loader = this.callbacks = null, this.abortInternal()
  68871. }, t.abortInternal = function() {
  68872. var e = this.response;
  68873. e && e.ok || (this.stats.aborted = !0, this.controller.abort())
  68874. }, t.abort = function() {
  68875. var e;
  68876. this.abortInternal(), null !== (e = this.callbacks) && void 0 !== e && e.onAbort && this
  68877. .callbacks.onAbort(this.stats, this.context, this.response)
  68878. }, t.load = function(e, t, i) {
  68879. var n = this,
  68880. a = this.stats;
  68881. if (a.loading.start) throw new Error("Loader can only be used once.");
  68882. a.loading.start = self.performance.now();
  68883. var s = function(e, t) {
  68884. var i = {
  68885. method: "GET",
  68886. mode: "cors",
  68887. credentials: "same-origin",
  68888. signal: t,
  68889. headers: new self.Headers(d({}, e.headers))
  68890. };
  68891. e.rangeEnd && i.headers.set("Range", "bytes=" + e.rangeStart + "-" + String(e.rangeEnd -
  68892. 1));
  68893. return i
  68894. }(e, this.controller.signal),
  68895. o = i.onProgress,
  68896. u = "arraybuffer" === e.responseType,
  68897. l = u ? "byteLength" : "length";
  68898. this.context = e, this.config = t, this.callbacks = i, this.request = this.fetchSetup(e, s),
  68899. self.clearTimeout(this.requestTimeout), this.requestTimeout = self.setTimeout(function() {
  68900. n.abortInternal(), i.onTimeout(a, e, n.response)
  68901. }, t.timeout), self.fetch(this.request).then(function(i) {
  68902. if (n.response = n.loader = i, !i.ok) {
  68903. var s = i.status,
  68904. l = i.statusText;
  68905. throw new p(l || "fetch, bad network response", s, i)
  68906. }
  68907. return a.loading.first = Math.max(self.performance.now(), a.loading.start), a.total =
  68908. parseInt(i.headers.get("Content-Length") || "0"), o && Object(r.isFiniteNumber)(t
  68909. .highWaterMark) ? n.loadProgressively(i, a, e, t.highWaterMark, o) : u ? i
  68910. .arrayBuffer() : i.text()
  68911. }).then(function(s) {
  68912. var u = n.response;
  68913. self.clearTimeout(n.requestTimeout), a.loading.end = Math.max(self.performance.now(), a
  68914. .loading.first), a.loaded = a.total = s[l];
  68915. var d = {
  68916. url: u.url,
  68917. data: s
  68918. };
  68919. o && !Object(r.isFiniteNumber)(t.highWaterMark) && o(a, e, s, u), i.onSuccess(d, a, e, u)
  68920. }).catch(function(t) {
  68921. if (self.clearTimeout(n.requestTimeout), !a.aborted) {
  68922. var r = t && t.code || 0,
  68923. s = t ? t.message : null;
  68924. i.onError({
  68925. code: r,
  68926. text: s
  68927. }, e, t ? t.details : null)
  68928. }
  68929. })
  68930. }, t.getCacheAge = function() {
  68931. var e = null;
  68932. if (this.response) {
  68933. var t = this.response.headers.get("age");
  68934. e = t ? parseFloat(t) : null
  68935. }
  68936. return e
  68937. }, t.loadProgressively = function(e, t, i, r, n) {
  68938. void 0 === r && (r = 0);
  68939. var s = new a.default,
  68940. o = e.body.getReader();
  68941. return function a() {
  68942. return o.read().then(function(o) {
  68943. if (o.done) return s.dataLength && n(t, i, s.flush(), e), Promise.resolve(
  68944. new ArrayBuffer(0));
  68945. var u = o.value,
  68946. l = u.length;
  68947. return t.loaded += l, l < r || s.dataLength ? (s.push(u), s.dataLength >= r && n(t, i,
  68948. s.flush(), e)) : n(t, i, u, e), a()
  68949. }).catch(function() {
  68950. return Promise.reject()
  68951. })
  68952. }()
  68953. }, e
  68954. }();
  68955. function f(e, t) {
  68956. return new self.Request(e.url, t)
  68957. }
  68958. var p = function(e) {
  68959. var t, i;
  68960. function r(t, i, r) {
  68961. var n;
  68962. return (n = e.call(this, t) || this).code = void 0, n.details = void 0, n.code = i, n.details = r,
  68963. n
  68964. }
  68965. return i = e, (t = r).prototype = Object.create(i.prototype), t.prototype.constructor = t, u(t, i),
  68966. r
  68967. }(s(Error));
  68968. t.default = h
  68969. },
  68970. "./src/utils/imsc1-ttml-parser.ts": function(e, t, i) {
  68971. "use strict";
  68972. i.r(t), i.d(t, "IMSC1_CODEC", function() {
  68973. return d
  68974. }), i.d(t, "parseIMSC1", function() {
  68975. return p
  68976. });
  68977. var r = i("./src/utils/mp4-tools.ts"),
  68978. n = i("./src/utils/vttparser.ts"),
  68979. a = i("./src/utils/vttcue.ts"),
  68980. s = i("./src/demux/id3.ts"),
  68981. o = i("./src/utils/timescale-conversion.ts"),
  68982. u = i("./src/utils/webvtt-parser.ts");
  68983. function l() {
  68984. return (l = Object.assign ? Object.assign.bind() : function(e) {
  68985. for (var t = 1; t < arguments.length; t++) {
  68986. var i = arguments[t];
  68987. for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (e[r] = i[r])
  68988. }
  68989. return e
  68990. }).apply(this, arguments)
  68991. }
  68992. var d = "stpp.ttml.im1t",
  68993. c = /^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,
  68994. h = /^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,
  68995. f = {
  68996. left: "start",
  68997. center: "center",
  68998. right: "end",
  68999. start: "start",
  69000. end: "end"
  69001. };
  69002. function p(e, t, i, n, d) {
  69003. var c = Object(r.findBox)(new Uint8Array(e), ["mdat"]);
  69004. if (0 !== c.length) {
  69005. var h = c.map(function(e) {
  69006. return Object(s.utf8ArrayToStr)(e)
  69007. }),
  69008. p = Object(o.toTimescaleFromScale)(t, 1, i);
  69009. try {
  69010. h.forEach(function(e) {
  69011. return n(function(e, t) {
  69012. var i = (new DOMParser).parseFromString(e, "text/xml").getElementsByTagName("tt")[0];
  69013. if (!i) throw new Error("Invalid ttml");
  69014. var r = {
  69015. frameRate: 30,
  69016. subFrameRate: 1,
  69017. frameRateMultiplier: 0,
  69018. tickRate: 0
  69019. },
  69020. n = Object.keys(r).reduce(function(e, t) {
  69021. return e[t] = i.getAttribute("ttp:" + t) || r[t], e
  69022. }, {}),
  69023. s = "preserve" !== i.getAttribute("xml:space"),
  69024. o = g(m(i, "styling", "style")),
  69025. d = g(m(i, "layout", "region")),
  69026. c = m(i, "body", "[begin]");
  69027. return [].map.call(c, function(e) {
  69028. var i = function e(t, i) {
  69029. return [].slice.call(t.childNodes).reduce(function(t, r, n) {
  69030. var a;
  69031. return "br" === r.nodeName && n ? t + "\n" : null !== (a = r
  69032. .childNodes) && void 0 !== a && a.length ? e(r, i) : i ? t + r
  69033. .textContent.trim().replace(/\s+/g, " ") : t + r.textContent
  69034. }, "")
  69035. }(e, s);
  69036. if (!i || !e.hasAttribute("begin")) return null;
  69037. var r = _(e.getAttribute("begin"), n),
  69038. c = _(e.getAttribute("dur"), n),
  69039. h = _(e.getAttribute("end"), n);
  69040. if (null === r) throw y(e);
  69041. if (null === h) {
  69042. if (null === c) throw y(e);
  69043. h = r + c
  69044. }
  69045. var p = new a.default(r - t, h - t, i);
  69046. p.id = Object(u.generateCueId)(p.startTime, p.endTime, p.text);
  69047. var m = d[e.getAttribute("region")],
  69048. g = o[e.getAttribute("style")];
  69049. p.position = 10, p.size = 80;
  69050. var b = function(e, t, i) {
  69051. var r = "http://www.w3.org/ns/ttml#styling",
  69052. n = null,
  69053. a = null !== e && void 0 !== e && e.hasAttribute("style") ? e
  69054. .getAttribute("style") : null;
  69055. a && i.hasOwnProperty(a) && (n = i[a]);
  69056. return ["displayAlign", "textAlign", "color", "backgroundColor", "fontSize",
  69057. "fontFamily"
  69058. ].reduce(function(i, a) {
  69059. var s = v(t, r, a) || v(e, r, a) || v(n, r, a);
  69060. return s && (i[a] = s), i
  69061. }, {})
  69062. }(m, g, o),
  69063. w = b.textAlign;
  69064. if (w) {
  69065. var E = f[w];
  69066. E && (p.lineAlign = E), p.align = w
  69067. }
  69068. return l(p, b), p
  69069. }).filter(function(e) {
  69070. return null !== e
  69071. })
  69072. }(e, p))
  69073. })
  69074. } catch (e) {
  69075. d(e)
  69076. }
  69077. } else d(new Error("Could not parse IMSC1 mdat"))
  69078. }
  69079. function m(e, t, i) {
  69080. var r = e.getElementsByTagName(t)[0];
  69081. return r ? [].slice.call(r.querySelectorAll(i)) : []
  69082. }
  69083. function g(e) {
  69084. return e.reduce(function(e, t) {
  69085. var i = t.getAttribute("xml:id");
  69086. return i && (e[i] = t), e
  69087. }, {})
  69088. }
  69089. function v(e, t, i) {
  69090. return e && e.hasAttributeNS(t, i) ? e.getAttributeNS(t, i) : null
  69091. }
  69092. function y(e) {
  69093. return new Error("Could not parse ttml timestamp " + e)
  69094. }
  69095. function _(e, t) {
  69096. if (!e) return null;
  69097. var i = Object(n.parseTimeStamp)(e);
  69098. return null === i && (c.test(e) ? i = function(e, t) {
  69099. var i = c.exec(e),
  69100. r = (0 | i[4]) + (0 | i[5]) / t.subFrameRate;
  69101. return 3600 * (0 | i[1]) + 60 * (0 | i[2]) + (0 | i[3]) + r / t.frameRate
  69102. }(e, t) : h.test(e) && (i = function(e, t) {
  69103. var i = h.exec(e),
  69104. r = Number(i[1]);
  69105. switch (i[2]) {
  69106. case "h":
  69107. return 3600 * r;
  69108. case "m":
  69109. return 60 * r;
  69110. case "ms":
  69111. return 1e3 * r;
  69112. case "f":
  69113. return r / t.frameRate;
  69114. case "t":
  69115. return r / t.tickRate
  69116. }
  69117. return r
  69118. }(e, t))), i
  69119. }
  69120. },
  69121. "./src/utils/logger.ts": function(e, t, i) {
  69122. "use strict";
  69123. i.r(t), i.d(t, "enableLogs", function() {
  69124. return o
  69125. }), i.d(t, "logger", function() {
  69126. return u
  69127. });
  69128. var r = function() {},
  69129. n = {
  69130. trace: r,
  69131. debug: r,
  69132. log: r,
  69133. warn: r,
  69134. info: r,
  69135. error: r
  69136. },
  69137. a = n;
  69138. function s(e) {
  69139. for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++) i[n - 1] =
  69140. arguments[n];
  69141. i.forEach(function(t) {
  69142. a[t] = e[t] ? e[t].bind(e) : function(e) {
  69143. var t = self.console[e];
  69144. return t ? t.bind(self.console, "[" + e + "] >") : r
  69145. }(t)
  69146. })
  69147. }
  69148. function o(e) {
  69149. if (self.console && !0 === e || "object" == typeof e) {
  69150. s(e, "debug", "log", "info", "warn", "error");
  69151. try {
  69152. a.log()
  69153. } catch (e) {
  69154. a = n
  69155. }
  69156. } else a = n
  69157. }
  69158. var u = n
  69159. },
  69160. "./src/utils/mediakeys-helper.ts": function(e, t, i) {
  69161. "use strict";
  69162. var r;
  69163. i.r(t), i.d(t, "KeySystems", function() {
  69164. return r
  69165. }), i.d(t, "requestMediaKeySystemAccess", function() {
  69166. return n
  69167. }),
  69168. function(e) {
  69169. e.WIDEVINE = "com.widevine.alpha", e.PLAYREADY = "com.microsoft.playready"
  69170. }(r || (r = {}));
  69171. var n = "undefined" != typeof self && self.navigator && self.navigator.requestMediaKeySystemAccess ?
  69172. self.navigator.requestMediaKeySystemAccess.bind(self.navigator) : null
  69173. },
  69174. "./src/utils/mediasource-helper.ts": function(e, t, i) {
  69175. "use strict";
  69176. function r() {
  69177. return self.MediaSource || self.WebKitMediaSource
  69178. }
  69179. i.r(t), i.d(t, "getMediaSource", function() {
  69180. return r
  69181. })
  69182. },
  69183. "./src/utils/mp4-tools.ts": function(e, t, i) {
  69184. "use strict";
  69185. i.r(t), i.d(t, "RemuxerTrackIdConfig", function() {
  69186. return u
  69187. }), i.d(t, "bin2str", function() {
  69188. return l
  69189. }), i.d(t, "readUint16", function() {
  69190. return d
  69191. }), i.d(t, "readUint32", function() {
  69192. return c
  69193. }), i.d(t, "readSint32", function() {
  69194. return h
  69195. }), i.d(t, "writeUint32", function() {
  69196. return f
  69197. }), i.d(t, "findBox", function() {
  69198. return p
  69199. }), i.d(t, "parseSegmentIndex", function() {
  69200. return m
  69201. }), i.d(t, "parseInitSegment", function() {
  69202. return g
  69203. }), i.d(t, "getStartDTS", function() {
  69204. return v
  69205. }), i.d(t, "getDuration", function() {
  69206. return y
  69207. }), i.d(t, "computeRawDurationFromSamples", function() {
  69208. return _
  69209. }), i.d(t, "offsetStartDTS", function() {
  69210. return b
  69211. }), i.d(t, "segmentValidRange", function() {
  69212. return w
  69213. }), i.d(t, "appendUint8Array", function() {
  69214. return E
  69215. }), i.d(t, "parseSamples", function() {
  69216. return T
  69217. }), i.d(t, "parseSEIMessageFromNALu", function() {
  69218. return A
  69219. }), i.d(t, "parseEmsg", function() {
  69220. return k
  69221. });
  69222. var r = i("./src/utils/typed-array.ts"),
  69223. n = i("./src/loader/fragment.ts"),
  69224. a = i("./src/demux/id3.ts"),
  69225. s = Math.pow(2, 32) - 1,
  69226. o = [].push,
  69227. u = {
  69228. video: 1,
  69229. audio: 2,
  69230. id3: 3,
  69231. text: 4
  69232. };
  69233. function l(e) {
  69234. return String.fromCharCode.apply(null, e)
  69235. }
  69236. function d(e, t) {
  69237. var i = e[t] << 8 | e[t + 1];
  69238. return i < 0 ? 65536 + i : i
  69239. }
  69240. function c(e, t) {
  69241. var i = h(e, t);
  69242. return i < 0 ? 4294967296 + i : i
  69243. }
  69244. function h(e, t) {
  69245. return e[t] << 24 | e[t + 1] << 16 | e[t + 2] << 8 | e[t + 3]
  69246. }
  69247. function f(e, t, i) {
  69248. e[t] = i >> 24, e[t + 1] = i >> 16 & 255, e[t + 2] = i >> 8 & 255, e[t + 3] = 255 & i
  69249. }
  69250. function p(e, t) {
  69251. var i = [];
  69252. if (!t.length) return i;
  69253. for (var r = e.byteLength, n = 0; n < r;) {
  69254. var a = c(e, n),
  69255. s = l(e.subarray(n + 4, n + 8)),
  69256. u = a > 1 ? n + a : r;
  69257. if (s === t[0])
  69258. if (1 === t.length) i.push(e.subarray(n + 8, u));
  69259. else {
  69260. var d = p(e.subarray(n + 8, u), t.slice(1));
  69261. d.length && o.apply(i, d)
  69262. } n = u
  69263. }
  69264. return i
  69265. }
  69266. function m(e) {
  69267. var t = p(e, ["moov"])[0],
  69268. i = t ? t.length : null,
  69269. r = p(e, ["sidx"]);
  69270. if (!r || !r[0]) return null;
  69271. var n = [],
  69272. a = r[0],
  69273. s = a[0],
  69274. o = 0 === s ? 8 : 16,
  69275. u = c(a, o);
  69276. o += 4;
  69277. o += 0 === s ? 8 : 16, o += 2;
  69278. var l = a.length + 0,
  69279. h = d(a, o);
  69280. o += 2;
  69281. for (var f = 0; f < h; f++) {
  69282. var m = o,
  69283. g = c(a, m);
  69284. m += 4;
  69285. var v = 2147483647 & g;
  69286. if (1 === (2147483648 & g) >>> 31) return console.warn(
  69287. "SIDX has hierarchical references (not supported)"), null;
  69288. var y = c(a, m);
  69289. m += 4, n.push({
  69290. referenceSize: v,
  69291. subsegmentDuration: y,
  69292. info: {
  69293. duration: y / u,
  69294. start: l,
  69295. end: l + v - 1
  69296. }
  69297. }), l += v, o = m += 4
  69298. }
  69299. return {
  69300. earliestPresentationTime: 0,
  69301. timescale: u,
  69302. version: s,
  69303. referencesCount: h,
  69304. references: n,
  69305. moovEndOffset: i
  69306. }
  69307. }
  69308. function g(e) {
  69309. for (var t = [], i = p(e, ["moov", "trak"]), r = 0; r < i.length; r++) {
  69310. var a = i[r],
  69311. s = p(a, ["tkhd"])[0];
  69312. if (s) {
  69313. var o = s[0],
  69314. u = 0 === o ? 12 : 20,
  69315. d = c(s, u),
  69316. h = p(a, ["mdia", "mdhd"])[0];
  69317. if (h) {
  69318. var f = c(h, u = 0 === (o = h[0]) ? 12 : 20),
  69319. m = p(a, ["mdia", "hdlr"])[0];
  69320. if (m) {
  69321. var g = l(m.subarray(8, 12)),
  69322. v = {
  69323. soun: n.ElementaryStreamTypes.AUDIO,
  69324. vide: n.ElementaryStreamTypes.VIDEO
  69325. } [g];
  69326. if (v) {
  69327. var y = p(a, ["mdia", "minf", "stbl", "stsd"])[0],
  69328. _ = void 0;
  69329. y && (_ = l(y.subarray(12, 16))), t[d] = {
  69330. timescale: f,
  69331. type: v
  69332. }, t[v] = {
  69333. timescale: f,
  69334. id: d,
  69335. codec: _
  69336. }
  69337. }
  69338. }
  69339. }
  69340. }
  69341. }
  69342. return p(e, ["moov", "mvex", "trex"]).forEach(function(e) {
  69343. var i = c(e, 4),
  69344. r = t[i];
  69345. r && (r.default = {
  69346. duration: c(e, 12),
  69347. flags: c(e, 20)
  69348. })
  69349. }), t
  69350. }
  69351. function v(e, t) {
  69352. return p(t, ["moof", "traf"]).reduce(function(t, i) {
  69353. var r = p(i, ["tfdt"])[0],
  69354. n = r[0],
  69355. a = p(i, ["tfhd"]).reduce(function(t, i) {
  69356. var a = c(i, 4),
  69357. s = e[a];
  69358. if (s) {
  69359. var o = c(r, 4);
  69360. 1 === n && (o *= Math.pow(2, 32), o += c(r, 8));
  69361. var u = o / (s.timescale || 9e4);
  69362. if (isFinite(u) && (null === t || u < t)) return u
  69363. }
  69364. return t
  69365. }, null);
  69366. return null !== a && isFinite(a) && (null === t || a < t) ? a : t
  69367. }, null) || 0
  69368. }
  69369. function y(e, t) {
  69370. for (var i = 0, r = 0, a = 0, s = p(e, ["moof", "traf"]), o = 0; o < s.length; o++) {
  69371. var u = s[o],
  69372. l = p(u, ["tfhd"])[0],
  69373. d = t[c(l, 4)];
  69374. if (d) {
  69375. var h = d.default,
  69376. f = c(l, 0) | (null === h || void 0 === h ? void 0 : h.flags),
  69377. g = null === h || void 0 === h ? void 0 : h.duration;
  69378. 8 & f && (g = c(l, 2 & f ? 12 : 8));
  69379. for (var v = d.timescale || 9e4, y = p(u, ["trun"]), b = 0; b < y.length; b++) {
  69380. if (!(i = _(y[b])) && g) i = g * c(y[b], 4);
  69381. d.type === n.ElementaryStreamTypes.VIDEO ? r += i / v : d.type === n.ElementaryStreamTypes
  69382. .AUDIO && (a += i / v)
  69383. }
  69384. }
  69385. }
  69386. if (0 === r && 0 === a) {
  69387. var w = m(e);
  69388. if (null !== w && void 0 !== w && w.references) return w.references.reduce(function(e, t) {
  69389. return e + t.info.duration || 0
  69390. }, 0)
  69391. }
  69392. return r || a
  69393. }
  69394. function _(e) {
  69395. var t = c(e, 0),
  69396. i = 8;
  69397. 1 & t && (i += 4), 4 & t && (i += 4);
  69398. for (var r = 0, n = c(e, 4), a = 0; a < n; a++) {
  69399. if (256 & t) r += c(e, i), i += 4;
  69400. 512 & t && (i += 4), 1024 & t && (i += 4), 2048 & t && (i += 4)
  69401. }
  69402. return r
  69403. }
  69404. function b(e, t, i) {
  69405. p(t, ["moof", "traf"]).forEach(function(t) {
  69406. p(t, ["tfhd"]).forEach(function(r) {
  69407. var n = c(r, 4),
  69408. a = e[n];
  69409. if (a) {
  69410. var o = a.timescale || 9e4;
  69411. p(t, ["tfdt"]).forEach(function(e) {
  69412. var t = e[0],
  69413. r = c(e, 4);
  69414. if (0 === t) r -= i * o, f(e, 4, r = Math.max(r, 0));
  69415. else {
  69416. r *= Math.pow(2, 32), r += c(e, 8), r -= i * o, r = Math.max(r, 0);
  69417. var n = Math.floor(r / (s + 1)),
  69418. a = Math.floor(r % (s + 1));
  69419. f(e, 4, n), f(e, 8, a)
  69420. }
  69421. })
  69422. }
  69423. })
  69424. })
  69425. }
  69426. function w(e) {
  69427. var t = {
  69428. valid: null,
  69429. remainder: null
  69430. },
  69431. i = p(e, ["moof"]);
  69432. if (!i) return t;
  69433. if (i.length < 2) return t.remainder = e, t;
  69434. var n = i[i.length - 1];
  69435. return t.valid = Object(r.sliceUint8)(e, 0, n.byteOffset - 8), t.remainder = Object(r.sliceUint8)(e, n
  69436. .byteOffset - 8), t
  69437. }
  69438. function E(e, t) {
  69439. var i = new Uint8Array(e.length + t.length);
  69440. return i.set(e), i.set(t, e.length), i
  69441. }
  69442. function T(e, t) {
  69443. var i = [],
  69444. r = t.samples,
  69445. a = t.timescale,
  69446. s = t.id,
  69447. o = !1;
  69448. return p(r, ["moof"]).map(function(u) {
  69449. var l = u.byteOffset - 8;
  69450. p(u, ["traf"]).map(function(u) {
  69451. var d = p(u, ["tfdt"]).map(function(e) {
  69452. var t = e[0],
  69453. i = c(e, 4);
  69454. return 1 === t && (i *= Math.pow(2, 32), i += c(e, 8)), i / a
  69455. })[0];
  69456. return void 0 !== d && (e = d), p(u, ["tfhd"]).map(function(d) {
  69457. var f = c(d, 4),
  69458. m = 16777215 & c(d, 0),
  69459. g = 0,
  69460. v = 0 != (16 & m),
  69461. y = 0,
  69462. _ = 0 != (32 & m),
  69463. b = 8;
  69464. f === s && (0 != (1 & m) && (b += 8), 0 != (2 & m) && (b += 4), 0 != (8 & m) && (g =
  69465. c(d, b), b += 4), v && (y = c(d, b), b += 4), _ && (b += 4), "video" === t
  69466. .type && (o = function(e) {
  69467. if (!e) return !1;
  69468. var t = e.indexOf("."),
  69469. i = t < 0 ? e : e.substring(0, t);
  69470. return "hvc1" === i || "hev1" === i || "dvh1" === i || "dvhe" === i
  69471. }(t.codec)), p(u, ["trun"]).map(function(s) {
  69472. var u = s[0],
  69473. d = 16777215 & c(s, 0),
  69474. f = 0 != (1 & d),
  69475. p = 0,
  69476. m = 0 != (4 & d),
  69477. v = 0 != (256 & d),
  69478. _ = 0,
  69479. b = 0 != (512 & d),
  69480. w = 0,
  69481. E = 0 != (1024 & d),
  69482. T = 0 != (2048 & d),
  69483. k = 0,
  69484. R = c(s, 4),
  69485. M = 8;
  69486. f && (p = c(s, M), M += 4), m && (M += 4);
  69487. for (var O = p + l, C = 0; C < R; C++) {
  69488. if (v ? (_ = c(s, M), M += 4) : _ = g, b ? (w = c(s, M), M += 4) : w = y,
  69489. E && (M += 4), T && (k = 0 === u ? c(s, M) : h(s, M), M += 4), t
  69490. .type === n.ElementaryStreamTypes.VIDEO)
  69491. for (var D = 0; D < w;) {
  69492. var I = c(r, O),
  69493. L = 31 & r[O += 4];
  69494. if (S(o, L)) A(r.subarray(O, O + I), e + k / a, i);
  69495. O += I, D += I + 4
  69496. }
  69497. e += _ / a
  69498. }
  69499. }))
  69500. })
  69501. })
  69502. }), i
  69503. }
  69504. function S(e, t) {
  69505. return e ? 39 === t || 40 === t : 6 === t
  69506. }
  69507. function A(e, t, i) {
  69508. var r = function(e) {
  69509. var t = e.byteLength,
  69510. i = [],
  69511. r = 1;
  69512. for (; r < t - 2;) 0 === e[r] && 0 === e[r + 1] && 3 === e[r + 2] ? (i.push(r + 2), r += 2) : r++;
  69513. if (0 === i.length) return e;
  69514. var n = t - i.length,
  69515. a = new Uint8Array(n),
  69516. s = 0;
  69517. for (r = 0; r < n; s++, r++) s === i[0] && (s++, i.shift()), a[r] = e[s];
  69518. return a
  69519. }(e),
  69520. n = 0;
  69521. n++;
  69522. for (var s = 0, o = 0, u = !1, l = 0; n < r.length;) {
  69523. s = 0;
  69524. do {
  69525. if (n >= r.length) break;
  69526. s += l = r[n++]
  69527. } while (255 === l);
  69528. o = 0;
  69529. do {
  69530. if (n >= r.length) break;
  69531. o += l = r[n++]
  69532. } while (255 === l);
  69533. var h = r.length - n;
  69534. if (!u && 4 === s && n < r.length) {
  69535. if (u = !0, 181 === r[n++]) {
  69536. var f = d(r, n);
  69537. if (n += 2, 49 === f) {
  69538. var p = c(r, n);
  69539. if (n += 4, 1195456820 === p) {
  69540. var m = r[n++];
  69541. if (3 === m) {
  69542. var g = r[n++],
  69543. v = 64 & g,
  69544. y = v ? 2 + 3 * (31 & g) : 0,
  69545. _ = new Uint8Array(y);
  69546. if (v) {
  69547. _[0] = g;
  69548. for (var b = 1; b < y; b++) _[b] = r[n++]
  69549. }
  69550. i.push({
  69551. type: m,
  69552. payloadType: s,
  69553. pts: t,
  69554. bytes: _
  69555. })
  69556. }
  69557. }
  69558. }
  69559. }
  69560. } else if (5 === s && o < h) {
  69561. if (u = !0, o > 16) {
  69562. for (var w = [], E = 0; E < 16; E++) {
  69563. var T = r[n++].toString(16);
  69564. w.push(1 == T.length ? "0" + T : T), 3 !== E && 5 !== E && 7 !== E && 9 !== E || w.push("-")
  69565. }
  69566. for (var S = o - 16, A = new Uint8Array(S), k = 0; k < S; k++) A[k] = r[n++];
  69567. i.push({
  69568. payloadType: s,
  69569. pts: t,
  69570. uuid: w.join(""),
  69571. userData: Object(a.utf8ArrayToStr)(A),
  69572. userDataBytes: A
  69573. })
  69574. }
  69575. } else if (o < h) n += o;
  69576. else if (o > h) break
  69577. }
  69578. }
  69579. function k(e) {
  69580. var t = e[0],
  69581. i = "",
  69582. r = "",
  69583. n = 0,
  69584. a = 0,
  69585. s = 0,
  69586. o = 0,
  69587. u = 0,
  69588. d = 0;
  69589. if (0 === t) {
  69590. for (;
  69591. "\0" !== l(e.subarray(d, d + 1));) i += l(e.subarray(d, d + 1)), d += 1;
  69592. for (i += l(e.subarray(d, d + 1)), d += 1;
  69593. "\0" !== l(e.subarray(d, d + 1));) r += l(e.subarray(d, d + 1)), d += 1;
  69594. r += l(e.subarray(d, d + 1)), d += 1, n = c(e, 12), a = c(e, 16), o = c(e, 20), u = c(e, 24), d = 28
  69595. } else if (1 === t) {
  69596. n = c(e, d += 4);
  69597. var h = c(e, d += 4),
  69598. f = c(e, d += 4);
  69599. for (d += 4, s = Math.pow(2, 32) * h + f, Number.isSafeInteger(s) || (s = Number.MAX_SAFE_INTEGER,
  69600. console.warn(
  69601. "Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box"
  69602. )), o = c(e, d), u = c(e, d += 4), d += 4;
  69603. "\0" !== l(e.subarray(d, d + 1));) i += l(e.subarray(d, d + 1)), d += 1;
  69604. for (i += l(e.subarray(d, d + 1)), d += 1;
  69605. "\0" !== l(e.subarray(d, d + 1));) r += l(e.subarray(d, d + 1)), d += 1;
  69606. r += l(e.subarray(d, d + 1)), d += 1
  69607. }
  69608. return {
  69609. schemeIdUri: i,
  69610. value: r,
  69611. timeScale: n,
  69612. presentationTime: s,
  69613. presentationTimeDelta: a,
  69614. eventDuration: o,
  69615. id: u,
  69616. payload: e.subarray(d, e.byteLength)
  69617. }
  69618. }
  69619. },
  69620. "./src/utils/output-filter.ts": function(e, t, i) {
  69621. "use strict";
  69622. i.r(t), i.d(t, "default", function() {
  69623. return r
  69624. });
  69625. var r = function() {
  69626. function e(e, t) {
  69627. this.timelineController = void 0, this.cueRanges = [], this.trackName = void 0, this.startTime =
  69628. null, this.endTime = null, this.screen = null, this.timelineController = e, this.trackName = t
  69629. }
  69630. var t = e.prototype;
  69631. return t.dispatchCue = function() {
  69632. null !== this.startTime && (this.timelineController.addCues(this.trackName, this.startTime, this
  69633. .endTime, this.screen, this.cueRanges), this.startTime = null)
  69634. }, t.newCue = function(e, t, i) {
  69635. (null === this.startTime || this.startTime > e) && (this.startTime = e), this.endTime = t, this
  69636. .screen = i, this.timelineController.createCaptionsTrack(this.trackName)
  69637. }, t.reset = function() {
  69638. this.cueRanges = [], this.startTime = null
  69639. }, e
  69640. }()
  69641. },
  69642. "./src/utils/texttrack-utils.ts": function(e, t, i) {
  69643. "use strict";
  69644. i.r(t), i.d(t, "sendAddTrackEvent", function() {
  69645. return n
  69646. }), i.d(t, "addCueToTrack", function() {
  69647. return a
  69648. }), i.d(t, "clearCurrentCues", function() {
  69649. return s
  69650. }), i.d(t, "removeCuesInRange", function() {
  69651. return o
  69652. }), i.d(t, "getCuesInRange", function() {
  69653. return u
  69654. });
  69655. var r = i("./src/utils/logger.ts");
  69656. function n(e, t) {
  69657. var i;
  69658. try {
  69659. i = new Event("addtrack")
  69660. } catch (e) {
  69661. (i = document.createEvent("Event")).initEvent("addtrack", !1, !1)
  69662. }
  69663. i.track = e, t.dispatchEvent(i)
  69664. }
  69665. function a(e, t) {
  69666. var i = e.mode;
  69667. if ("disabled" === i && (e.mode = "hidden"), e.cues && !e.cues.getCueById(t.id)) try {
  69668. if (e.addCue(t), !e.cues.getCueById(t.id)) throw new Error("addCue is failed for: " + t)
  69669. } catch (i) {
  69670. r.logger.debug("[texttrack-utils]: " + i);
  69671. var n = new self.TextTrackCue(t.startTime, t.endTime, t.text);
  69672. n.id = t.id, e.addCue(n)
  69673. }
  69674. "disabled" === i && (e.mode = i)
  69675. }
  69676. function s(e) {
  69677. var t = e.mode;
  69678. if ("disabled" === t && (e.mode = "hidden"), e.cues)
  69679. for (var i = e.cues.length; i--;) e.removeCue(e.cues[i]);
  69680. "disabled" === t && (e.mode = t)
  69681. }
  69682. function o(e, t, i) {
  69683. var r = e.mode;
  69684. if ("disabled" === r && (e.mode = "hidden"), e.cues && e.cues.length > 0)
  69685. for (var n = u(e.cues, t, i), a = 0; a < n.length; a++) e.removeCue(n[a]);
  69686. "disabled" === r && (e.mode = r)
  69687. }
  69688. function u(e, t, i) {
  69689. var r = [],
  69690. n = function(e, t) {
  69691. if (t < e[0].startTime) return 0;
  69692. var i = e.length - 1;
  69693. if (t > e[i].endTime) return -1;
  69694. for (var r = 0, n = i; r <= n;) {
  69695. var a = Math.floor((n + r) / 2);
  69696. if (t < e[a].startTime) n = a - 1;
  69697. else {
  69698. if (!(t > e[a].startTime && r < i)) return a;
  69699. r = a + 1
  69700. }
  69701. }
  69702. return e[r].startTime - t < t - e[n].startTime ? r : n
  69703. }(e, t);
  69704. if (n > -1)
  69705. for (var a = n, s = e.length; a < s; a++) {
  69706. var o = e[a];
  69707. if (o.startTime >= t && o.endTime <= i) r.push(o);
  69708. else if (o.startTime > i) return r
  69709. }
  69710. return r
  69711. }
  69712. },
  69713. "./src/utils/time-ranges.ts": function(e, t, i) {
  69714. "use strict";
  69715. i.r(t);
  69716. t.default = {
  69717. toString: function(e) {
  69718. for (var t = "", i = e.length, r = 0; r < i; r++) t += "[" + e.start(r).toFixed(3) + "," + e
  69719. .end(r).toFixed(3) + "]";
  69720. return t
  69721. }
  69722. }
  69723. },
  69724. "./src/utils/timescale-conversion.ts": function(e, t, i) {
  69725. "use strict";
  69726. i.r(t), i.d(t, "toTimescaleFromBase", function() {
  69727. return n
  69728. }), i.d(t, "toTimescaleFromScale", function() {
  69729. return a
  69730. }), i.d(t, "toMsFromMpegTsClock", function() {
  69731. return s
  69732. }), i.d(t, "toMpegTsClockFromTimescale", function() {
  69733. return o
  69734. });
  69735. var r = 9e4;
  69736. function n(e, t, i, r) {
  69737. void 0 === i && (i = 1), void 0 === r && (r = !1);
  69738. var n = e * t * i;
  69739. return r ? Math.round(n) : n
  69740. }
  69741. function a(e, t, i, r) {
  69742. return void 0 === i && (i = 1), void 0 === r && (r = !1), n(e, t, 1 / i, r)
  69743. }
  69744. function s(e, t) {
  69745. return void 0 === t && (t = !1), n(e, 1e3, 1 / r, t)
  69746. }
  69747. function o(e, t) {
  69748. return void 0 === t && (t = 1), n(e, r, 1 / t)
  69749. }
  69750. },
  69751. "./src/utils/typed-array.ts": function(e, t, i) {
  69752. "use strict";
  69753. function r(e, t, i) {
  69754. return Uint8Array.prototype.slice ? e.slice(t, i) : new Uint8Array(Array.prototype.slice.call(e, t,
  69755. i))
  69756. }
  69757. i.r(t), i.d(t, "sliceUint8", function() {
  69758. return r
  69759. })
  69760. },
  69761. "./src/utils/vttcue.ts": function(e, t, i) {
  69762. "use strict";
  69763. i.r(t), t.default = function() {
  69764. if ("undefined" != typeof self && self.VTTCue) return self.VTTCue;
  69765. var e = ["", "lr", "rl"],
  69766. t = ["start", "middle", "end", "left", "right"];
  69767. function i(e, t) {
  69768. if ("string" != typeof t) return !1;
  69769. if (!Array.isArray(e)) return !1;
  69770. var i = t.toLowerCase();
  69771. return !!~e.indexOf(i) && i
  69772. }
  69773. function r(e) {
  69774. return i(t, e)
  69775. }
  69776. function n(e) {
  69777. for (var t = arguments.length, i = new Array(t > 1 ? t - 1 : 0), r = 1; r < t; r++) i[r - 1] =
  69778. arguments[r];
  69779. for (var n = 1; n < arguments.length; n++) {
  69780. var a = arguments[n];
  69781. for (var s in a) e[s] = a[s]
  69782. }
  69783. return e
  69784. }
  69785. function a(t, a, s) {
  69786. var o = this,
  69787. u = {
  69788. enumerable: !0
  69789. };
  69790. o.hasBeenReset = !1;
  69791. var l = "",
  69792. d = !1,
  69793. c = t,
  69794. h = a,
  69795. f = s,
  69796. p = null,
  69797. m = "",
  69798. g = !0,
  69799. v = "auto",
  69800. y = "start",
  69801. _ = 50,
  69802. b = "middle",
  69803. w = 50,
  69804. E = "middle";
  69805. Object.defineProperty(o, "id", n({}, u, {
  69806. get: function() {
  69807. return l
  69808. },
  69809. set: function(e) {
  69810. l = "" + e
  69811. }
  69812. })), Object.defineProperty(o, "pauseOnExit", n({}, u, {
  69813. get: function() {
  69814. return d
  69815. },
  69816. set: function(e) {
  69817. d = !!e
  69818. }
  69819. })), Object.defineProperty(o, "startTime", n({}, u, {
  69820. get: function() {
  69821. return c
  69822. },
  69823. set: function(e) {
  69824. if ("number" != typeof e) throw new TypeError("Start time must be set to a number.");
  69825. c = e, this.hasBeenReset = !0
  69826. }
  69827. })), Object.defineProperty(o, "endTime", n({}, u, {
  69828. get: function() {
  69829. return h
  69830. },
  69831. set: function(e) {
  69832. if ("number" != typeof e) throw new TypeError("End time must be set to a number.");
  69833. h = e, this.hasBeenReset = !0
  69834. }
  69835. })), Object.defineProperty(o, "text", n({}, u, {
  69836. get: function() {
  69837. return f
  69838. },
  69839. set: function(e) {
  69840. f = "" + e, this.hasBeenReset = !0
  69841. }
  69842. })), Object.defineProperty(o, "region", n({}, u, {
  69843. get: function() {
  69844. return p
  69845. },
  69846. set: function(e) {
  69847. p = e, this.hasBeenReset = !0
  69848. }
  69849. })), Object.defineProperty(o, "vertical", n({}, u, {
  69850. get: function() {
  69851. return m
  69852. },
  69853. set: function(t) {
  69854. var r = function(t) {
  69855. return i(e, t)
  69856. }(t);
  69857. if (!1 === r) throw new SyntaxError("An invalid or illegal string was specified.");
  69858. m = r, this.hasBeenReset = !0
  69859. }
  69860. })), Object.defineProperty(o, "snapToLines", n({}, u, {
  69861. get: function() {
  69862. return g
  69863. },
  69864. set: function(e) {
  69865. g = !!e, this.hasBeenReset = !0
  69866. }
  69867. })), Object.defineProperty(o, "line", n({}, u, {
  69868. get: function() {
  69869. return v
  69870. },
  69871. set: function(e) {
  69872. if ("number" != typeof e && "auto" !== e) throw new SyntaxError(
  69873. "An invalid number or illegal string was specified.");
  69874. v = e, this.hasBeenReset = !0
  69875. }
  69876. })), Object.defineProperty(o, "lineAlign", n({}, u, {
  69877. get: function() {
  69878. return y
  69879. },
  69880. set: function(e) {
  69881. var t = r(e);
  69882. if (!t) throw new SyntaxError("An invalid or illegal string was specified.");
  69883. y = t, this.hasBeenReset = !0
  69884. }
  69885. })), Object.defineProperty(o, "position", n({}, u, {
  69886. get: function() {
  69887. return _
  69888. },
  69889. set: function(e) {
  69890. if (e < 0 || e > 100) throw new Error("Position must be between 0 and 100.");
  69891. _ = e, this.hasBeenReset = !0
  69892. }
  69893. })), Object.defineProperty(o, "positionAlign", n({}, u, {
  69894. get: function() {
  69895. return b
  69896. },
  69897. set: function(e) {
  69898. var t = r(e);
  69899. if (!t) throw new SyntaxError("An invalid or illegal string was specified.");
  69900. b = t, this.hasBeenReset = !0
  69901. }
  69902. })), Object.defineProperty(o, "size", n({}, u, {
  69903. get: function() {
  69904. return w
  69905. },
  69906. set: function(e) {
  69907. if (e < 0 || e > 100) throw new Error("Size must be between 0 and 100.");
  69908. w = e, this.hasBeenReset = !0
  69909. }
  69910. })), Object.defineProperty(o, "align", n({}, u, {
  69911. get: function() {
  69912. return E
  69913. },
  69914. set: function(e) {
  69915. var t = r(e);
  69916. if (!t) throw new SyntaxError("An invalid or illegal string was specified.");
  69917. E = t, this.hasBeenReset = !0
  69918. }
  69919. })), o.displayState = void 0
  69920. }
  69921. return a.prototype.getCueAsHTML = function() {
  69922. return self.WebVTT.convertCueToDOMTree(self, this.text)
  69923. }, a
  69924. }()
  69925. },
  69926. "./src/utils/vttparser.ts": function(e, t, i) {
  69927. "use strict";
  69928. i.r(t), i.d(t, "parseTimeStamp", function() {
  69929. return a
  69930. }), i.d(t, "fixLineBreaks", function() {
  69931. return c
  69932. }), i.d(t, "VTTParser", function() {
  69933. return h
  69934. });
  69935. var r = i("./src/utils/vttcue.ts"),
  69936. n = function() {
  69937. function e() {}
  69938. return e.prototype.decode = function(e, t) {
  69939. if (!e) return "";
  69940. if ("string" != typeof e) throw new Error("Error - expected string data.");
  69941. return decodeURIComponent(encodeURIComponent(e))
  69942. }, e
  69943. }();
  69944. function a(e) {
  69945. function t(e, t, i, r) {
  69946. return 3600 * (0 | e) + 60 * (0 | t) + (0 | i) + parseFloat(r || 0)
  69947. }
  69948. var i = e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);
  69949. return i ? parseFloat(i[2]) > 59 ? t(i[2], i[3], 0, i[4]) : t(i[1], i[2], i[3], i[4]) : null
  69950. }
  69951. var s = function() {
  69952. function e() {
  69953. this.values = Object.create(null)
  69954. }
  69955. var t = e.prototype;
  69956. return t.set = function(e, t) {
  69957. this.get(e) || "" === t || (this.values[e] = t)
  69958. }, t.get = function(e, t, i) {
  69959. return i ? this.has(e) ? this.values[e] : t[i] : this.has(e) ? this.values[e] : t
  69960. }, t.has = function(e) {
  69961. return e in this.values
  69962. }, t.alt = function(e, t, i) {
  69963. for (var r = 0; r < i.length; ++r)
  69964. if (t === i[r]) {
  69965. this.set(e, t);
  69966. break
  69967. }
  69968. }, t.integer = function(e, t) {
  69969. /^-?\d+$/.test(t) && this.set(e, parseInt(t, 10))
  69970. }, t.percent = function(e, t) {
  69971. if (/^([\d]{1,3})(\.[\d]*)?%$/.test(t)) {
  69972. var i = parseFloat(t);
  69973. if (i >= 0 && i <= 100) return this.set(e, i), !0
  69974. }
  69975. return !1
  69976. }, e
  69977. }();
  69978. function o(e, t, i, r) {
  69979. var n = r ? e.split(r) : [e];
  69980. for (var a in n)
  69981. if ("string" == typeof n[a]) {
  69982. var s = n[a].split(i);
  69983. if (2 === s.length) t(s[0], s[1])
  69984. }
  69985. }
  69986. var u = new r.default(0, 0, ""),
  69987. l = "middle" === u.align ? "middle" : "center";
  69988. function d(e, t, i) {
  69989. var r = e;
  69990. function n() {
  69991. var t = a(e);
  69992. if (null === t) throw new Error("Malformed timestamp: " + r);
  69993. return e = e.replace(/^[^\sa-zA-Z-]+/, ""), t
  69994. }
  69995. function d() {
  69996. e = e.replace(/^\s+/, "")
  69997. }
  69998. if (d(), t.startTime = n(), d(), "--\x3e" !== e.slice(0, 3)) throw new Error(
  69999. "Malformed time stamp (time stamps must be separated by '--\x3e'): " + r);
  70000. e = e.slice(3), d(), t.endTime = n(), d(),
  70001. function(e, t) {
  70002. var r = new s;
  70003. o(e, function(e, t) {
  70004. var n;
  70005. switch (e) {
  70006. case "region":
  70007. for (var a = i.length - 1; a >= 0; a--)
  70008. if (i[a].id === t) {
  70009. r.set(e, i[a].region);
  70010. break
  70011. } break;
  70012. case "vertical":
  70013. r.alt(e, t, ["rl", "lr"]);
  70014. break;
  70015. case "line":
  70016. n = t.split(","), r.integer(e, n[0]), r.percent(e, n[0]) && r.set("snapToLines", !1), r
  70017. .alt(e, n[0], ["auto"]), 2 === n.length && r.alt("lineAlign", n[1], ["start", l,
  70018. "end"]);
  70019. break;
  70020. case "position":
  70021. n = t.split(","), r.percent(e, n[0]), 2 === n.length && r.alt("positionAlign", n[1], [
  70022. "start", l, "end", "line-left", "line-right", "auto"
  70023. ]);
  70024. break;
  70025. case "size":
  70026. r.percent(e, t);
  70027. break;
  70028. case "align":
  70029. r.alt(e, t, ["start", l, "end", "left", "right"])
  70030. }
  70031. }, /:/, /\s/), t.region = r.get("region", null), t.vertical = r.get("vertical", "");
  70032. var n = r.get("line", "auto");
  70033. "auto" === n && -1 === u.line && (n = -1), t.line = n, t.lineAlign = r.get("lineAlign", "start"),
  70034. t.snapToLines = r.get("snapToLines", !0), t.size = r.get("size", 100), t.align = r.get("align",
  70035. l);
  70036. var a = r.get("position", "auto");
  70037. "auto" === a && 50 === u.position && (a = "start" === t.align || "left" === t.align ? 0 :
  70038. "end" === t.align || "right" === t.align ? 100 : 50), t.position = a
  70039. }(e, t)
  70040. }
  70041. function c(e) {
  70042. return e.replace(/<br(?: \/)?>/gi, "\n")
  70043. }
  70044. var h = function() {
  70045. function e() {
  70046. this.state = "INITIAL", this.buffer = "", this.decoder = new n, this.regionList = [], this.cue =
  70047. null, this.oncue = void 0, this.onparsingerror = void 0, this.onflush = void 0
  70048. }
  70049. var t = e.prototype;
  70050. return t.parse = function(e) {
  70051. var t = this;
  70052. function i() {
  70053. var e = t.buffer,
  70054. i = 0;
  70055. for (e = c(e); i < e.length && "\r" !== e[i] && "\n" !== e[i];) ++i;
  70056. var r = e.slice(0, i);
  70057. return "\r" === e[i] && ++i, "\n" === e[i] && ++i, t.buffer = e.slice(i), r
  70058. }
  70059. e && (t.buffer += t.decoder.decode(e, {
  70060. stream: !0
  70061. }));
  70062. try {
  70063. var n = "";
  70064. if ("INITIAL" === t.state) {
  70065. if (!/\r\n|\n/.test(t.buffer)) return this;
  70066. var a = (n = i()).match(/^()?WEBVTT([ \t].*)?$/);
  70067. if (!a || !a[0]) throw new Error("Malformed WebVTT signature.");
  70068. t.state = "HEADER"
  70069. }
  70070. for (var s = !1; t.buffer;) {
  70071. if (!/\r\n|\n/.test(t.buffer)) return this;
  70072. switch (s ? s = !1 : n = i(), t.state) {
  70073. case "HEADER":
  70074. /:/.test(n) ? o(n, function(e, t) {}, /:/) : n || (t.state = "ID");
  70075. continue;
  70076. case "NOTE":
  70077. n || (t.state = "ID");
  70078. continue;
  70079. case "ID":
  70080. if (/^NOTE($|[ \t])/.test(n)) {
  70081. t.state = "NOTE";
  70082. break
  70083. }
  70084. if (!n) continue;
  70085. if (t.cue = new r.default(0, 0, ""), t.state = "CUE", -1 === n.indexOf("--\x3e")) {
  70086. t.cue.id = n;
  70087. continue
  70088. }
  70089. case "CUE":
  70090. if (!t.cue) {
  70091. t.state = "BADCUE";
  70092. continue
  70093. }
  70094. try {
  70095. d(n, t.cue, t.regionList)
  70096. } catch (e) {
  70097. t.cue = null, t.state = "BADCUE";
  70098. continue
  70099. }
  70100. t.state = "CUETEXT";
  70101. continue;
  70102. case "CUETEXT":
  70103. var u = -1 !== n.indexOf("--\x3e");
  70104. if (!n || u && (s = !0)) {
  70105. t.oncue && t.cue && t.oncue(t.cue), t.cue = null, t.state = "ID";
  70106. continue
  70107. }
  70108. if (null === t.cue) continue;
  70109. t.cue.text && (t.cue.text += "\n"), t.cue.text += n;
  70110. continue;
  70111. case "BADCUE":
  70112. n || (t.state = "ID")
  70113. }
  70114. }
  70115. } catch (e) {
  70116. "CUETEXT" === t.state && t.cue && t.oncue && t.oncue(t.cue), t.cue = null, t.state =
  70117. "INITIAL" === t.state ? "BADWEBVTT" : "BADCUE"
  70118. }
  70119. return this
  70120. }, t.flush = function() {
  70121. try {
  70122. if ((this.cue || "HEADER" === this.state) && (this.buffer += "\n\n", this.parse()),
  70123. "INITIAL" === this.state || "BADWEBVTT" === this.state) throw new Error(
  70124. "Malformed WebVTT signature.")
  70125. } catch (e) {
  70126. this.onparsingerror && this.onparsingerror(e)
  70127. }
  70128. return this.onflush && this.onflush(), this
  70129. }, e
  70130. }()
  70131. },
  70132. "./src/utils/webvtt-parser.ts": function(e, t, i) {
  70133. "use strict";
  70134. i.r(t), i.d(t, "generateCueId", function() {
  70135. return h
  70136. }), i.d(t, "parseWebVTT", function() {
  70137. return p
  70138. });
  70139. var r = i("./src/polyfills/number.ts"),
  70140. n = i("./src/utils/vttparser.ts"),
  70141. a = i("./src/demux/id3.ts"),
  70142. s = i("./src/utils/timescale-conversion.ts"),
  70143. o = i("./src/remux/mp4-remuxer.ts"),
  70144. u = /\r\n|\n\r|\n|\r/g,
  70145. l = function(e, t, i) {
  70146. return void 0 === i && (i = 0), e.slice(i, i + t.length) === t
  70147. },
  70148. d = function(e) {
  70149. var t = parseInt(e.slice(-3)),
  70150. i = parseInt(e.slice(-6, -4)),
  70151. n = parseInt(e.slice(-9, -7)),
  70152. a = e.length > 9 ? parseInt(e.substring(0, e.indexOf(":"))) : 0;
  70153. if (!(Object(r.isFiniteNumber)(t) && Object(r.isFiniteNumber)(i) && Object(r.isFiniteNumber)(n) &&
  70154. Object(r.isFiniteNumber)(a))) throw Error("Malformed X-TIMESTAMP-MAP: Local:" + e);
  70155. return t += 1e3 * i, t += 6e4 * n, t += 36e5 * a
  70156. },
  70157. c = function(e) {
  70158. for (var t = 5381, i = e.length; i;) t = 33 * t ^ e.charCodeAt(--i);
  70159. return (t >>> 0).toString()
  70160. };
  70161. function h(e, t, i) {
  70162. return c(e.toString()) + c(t.toString()) + c(i)
  70163. }
  70164. var f = function(e, t, i) {
  70165. var r = e[t],
  70166. n = e[r.prevCC];
  70167. if (!n || !n.new && r.new) return e.ccOffset = e.presentationOffset = r.start, void(r.new = !1);
  70168. for (; null !== (a = n) && void 0 !== a && a.new;) {
  70169. var a;
  70170. e.ccOffset += r.start - n.start, r.new = !1, n = e[(r = n).prevCC]
  70171. }
  70172. e.presentationOffset = i
  70173. };
  70174. function p(e, t, i, r, c, p, m, g) {
  70175. var v, y = new n.VTTParser,
  70176. _ = Object(a.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(u, "\n").split("\n"),
  70177. b = [],
  70178. w = Object(s.toMpegTsClockFromTimescale)(t, i),
  70179. E = "00:00.000",
  70180. T = 0,
  70181. S = 0,
  70182. A = !0;
  70183. y.oncue = function(e) {
  70184. var t = r[c],
  70185. i = r.ccOffset,
  70186. n = (T - w) / 9e4;
  70187. null !== t && void 0 !== t && t.new && (void 0 !== S ? i = r.ccOffset = t.start : f(r, c, n)),
  70188. n && (i = n - r.presentationOffset);
  70189. var a = e.endTime - e.startTime,
  70190. s = Object(o.normalizePts)(9e4 * (e.startTime + i - S), 9e4 * p) / 9e4;
  70191. e.startTime = s, e.endTime = s + a;
  70192. var u = e.text.trim();
  70193. e.text = decodeURIComponent(encodeURIComponent(u)), e.id || (e.id = h(e.startTime, e.endTime, u)),
  70194. e.endTime > 0 && b.push(e)
  70195. }, y.onparsingerror = function(e) {
  70196. v = e
  70197. }, y.onflush = function() {
  70198. v ? g(v) : m(b)
  70199. }, _.forEach(function(e) {
  70200. if (A) {
  70201. if (l(e, "X-TIMESTAMP-MAP=")) {
  70202. A = !1, e.slice(16).split(",").forEach(function(e) {
  70203. l(e, "LOCAL:") ? E = e.slice(6) : l(e, "MPEGTS:") && (T = parseInt(e.slice(7)))
  70204. });
  70205. try {
  70206. S = d(E) / 1e3
  70207. } catch (e) {
  70208. v = e
  70209. }
  70210. return
  70211. }
  70212. "" === e && (A = !1)
  70213. }
  70214. y.parse(e + "\n")
  70215. }), y.flush()
  70216. }
  70217. },
  70218. "./src/utils/xhr-loader.ts": function(e, t, i) {
  70219. "use strict";
  70220. i.r(t);
  70221. var r = i("./src/utils/logger.ts"),
  70222. n = i("./src/loader/load-stats.ts"),
  70223. a = /^age:\s*[\d.]+\s*$/m,
  70224. s = function() {
  70225. function e(e) {
  70226. this.xhrSetup = void 0, this.requestTimeout = void 0, this.retryTimeout = void 0, this
  70227. .retryDelay = void 0, this.config = null, this.callbacks = null, this.context = void 0, this
  70228. .loader = null, this.stats = void 0, this.xhrSetup = e ? e.xhrSetup : null, this.stats = new n
  70229. .LoadStats, this.retryDelay = 0
  70230. }
  70231. var t = e.prototype;
  70232. return t.destroy = function() {
  70233. this.callbacks = null, this.abortInternal(), this.loader = null, this.config = null
  70234. }, t.abortInternal = function() {
  70235. var e = this.loader;
  70236. self.clearTimeout(this.requestTimeout), self.clearTimeout(this.retryTimeout), e && (e
  70237. .onreadystatechange = null, e.onprogress = null, 4 !== e.readyState && (this.stats
  70238. .aborted = !0, e.abort()))
  70239. }, t.abort = function() {
  70240. var e;
  70241. this.abortInternal(), null !== (e = this.callbacks) && void 0 !== e && e.onAbort && this
  70242. .callbacks.onAbort(this.stats, this.context, this.loader)
  70243. }, t.load = function(e, t, i) {
  70244. if (this.stats.loading.start) throw new Error("Loader can only be used once.");
  70245. this.stats.loading.start = self.performance.now(), this.context = e, this.config = t, this
  70246. .callbacks = i, this.retryDelay = t.retryDelay, this.loadInternal()
  70247. }, t.loadInternal = function() {
  70248. var e = this.config,
  70249. t = this.context;
  70250. if (e) {
  70251. var i = this.loader = new self.XMLHttpRequest,
  70252. r = this.stats;
  70253. r.loading.first = 0, r.loaded = 0;
  70254. var n = this.xhrSetup;
  70255. try {
  70256. if (n) try {
  70257. n(i, t.url)
  70258. } catch (e) {
  70259. i.open("GET", t.url, !0), n(i, t.url)
  70260. }
  70261. i.readyState || i.open("GET", t.url, !0);
  70262. var a = this.context.headers;
  70263. if (a)
  70264. for (var s in a) i.setRequestHeader(s, a[s])
  70265. } catch (e) {
  70266. return void this.callbacks.onError({
  70267. code: i.status,
  70268. text: e.message
  70269. }, t, i)
  70270. }
  70271. t.rangeEnd && i.setRequestHeader("Range", "bytes=" + t.rangeStart + "-" + (t.rangeEnd - 1)), i
  70272. .onreadystatechange = this.readystatechange.bind(this), i.onprogress = this.loadprogress
  70273. .bind(this), i.responseType = t.responseType, self.clearTimeout(this.requestTimeout), this
  70274. .requestTimeout = self.setTimeout(this.loadtimeout.bind(this), e.timeout), i.send()
  70275. }
  70276. }, t.readystatechange = function() {
  70277. var e = this.context,
  70278. t = this.loader,
  70279. i = this.stats;
  70280. if (e && t) {
  70281. var n = t.readyState,
  70282. a = this.config;
  70283. if (!i.aborted && n >= 2)
  70284. if (self.clearTimeout(this.requestTimeout), 0 === i.loading.first && (i.loading.first = Math
  70285. .max(self.performance.now(), i.loading.start)), 4 === n) {
  70286. t.onreadystatechange = null, t.onprogress = null;
  70287. var s = t.status;
  70288. if (s >= 200 && s < 300) {
  70289. var o, u, l;
  70290. if (i.loading.end = Math.max(self.performance.now(), i.loading.first), "arraybuffer" ===
  70291. e.responseType ? (l = (o = t.response).byteLength, u = o.slice(0)) : (o = t
  70292. .responseText, u = t.responseText, l = o.length), i.loaded = i.total = l, !this
  70293. .callbacks) return;
  70294. var d = this.callbacks.onProgress;
  70295. if (d && d(i, e, o, t), !this.callbacks) return;
  70296. var c = {
  70297. url: t.responseURL,
  70298. data: u
  70299. };
  70300. this.callbacks.onSuccess(c, i, e, t)
  70301. } else i.retry >= a.maxRetry || s >= 400 && s < 499 ? (r.logger.error(s +
  70302. " while loading " + e.url), console.log("this.callbacks", this.callbacks.onError),
  70303. this.callbacks.onError({
  70304. code: s,
  70305. text: t.statusText
  70306. }, e, t)) : (r.logger.warn(s + " while loading " + e.url + ", retrying in " + this
  70307. .retryDelay + "..."), this.abortInternal(), this.loader = null, self.clearTimeout(
  70308. this.retryTimeout), this.retryTimeout = self.setTimeout(this.loadInternal.bind(
  70309. this), this.retryDelay), this.retryDelay = Math.min(2 * this.retryDelay, a
  70310. .maxRetryDelay), i.retry++)
  70311. } else self.clearTimeout(this.requestTimeout), this.requestTimeout = self.setTimeout(this
  70312. .loadtimeout.bind(this), a.timeout)
  70313. }
  70314. }, t.loadtimeout = function() {
  70315. r.logger.warn("timeout while loading " + this.context.url);
  70316. var e = this.callbacks;
  70317. e && (this.abortInternal(), e.onTimeout(this.stats, this.context, this.loader))
  70318. }, t.loadprogress = function(e) {
  70319. var t = this.stats;
  70320. t.loaded = e.loaded, e.lengthComputable && (t.total = e.total)
  70321. }, t.getCacheAge = function() {
  70322. var e = null;
  70323. if (this.loader && a.test(this.loader.getAllResponseHeaders())) {
  70324. var t = this.loader.getResponseHeader("age");
  70325. e = t ? parseFloat(t) : null
  70326. }
  70327. return e
  70328. }, t.deepClone = function(e) {
  70329. var t = Object.prototype.toString;
  70330. if (!e || "object" != typeof e) return e;
  70331. if (e.nodeType && "cloneNode" in e) return e.cloneNode(!0);
  70332. if ("[object Date]" === t.call(e)) return new Date(e.getTime());
  70333. if ("[object RegExp]" === t.call(e)) {
  70334. var i = [];
  70335. return e.global && i.push("g"), e.multiline && i.push("m"), e.ignoreCase && i.push("i"),
  70336. new RegExp(e.source, i.join(""))
  70337. }
  70338. var r = Array.isArray(e) ? [] : e.constructor ? new e.constructor : {};
  70339. for (var n in e) r[n] = this.deepClone(e[n]);
  70340. return r
  70341. }, e
  70342. }();
  70343. t.default = s
  70344. }
  70345. }).default
  70346. }),
  70347. function(e, t, i) {
  70348. if (t && i && i.isSupported()) {
  70349. var r = function(e, r) {
  70350. var n, a, s, o = this,
  70351. u = {},
  70352. l = !1,
  70353. d = !1,
  70354. c = !1,
  70355. h = r.el(),
  70356. f = r.hls = new i(r.options_.hlsJs || {}),
  70357. p = 0,
  70358. m = function() {
  70359. d && (!c || c && 0 === o.duration() && !1 === f.config.autoStartLoad) && f.startLoad(), c = !0
  70360. };
  70361. return f.isHlsJs = !0, !1 === f.config.autoStartLoad && h.addEventListener("play", m), f.on(i.Events
  70362. .MANIFEST_LOADED,
  70363. function() {
  70364. d = !0, c && !1 === f.config.autoStartLoad && m()
  70365. }), f.on(i.Events.LEVEL_LOADED, function(e, t) {
  70366. n = t.details.live ? 1 / 0 : t.details.totalduration, p = t.details.fragments && t.details.fragments[
  70367. 0] && t.details.fragments[0].start || p
  70368. }), f.on(i.Events.ERROR, function(t, n) {
  70369. var o = function() {
  70370. l = !0, r.error = function() {
  70371. return n
  70372. }, r.trigger("error")
  70373. };
  70374. if (!l && n.fatal) switch (u[n.type] = u[n.type] || 0, ++u[n.type], n.type) {
  70375. case i.ErrorTypes.NETWORK_ERROR:
  70376. if (2 < u[n.type]) return void o();
  70377. if ([i.ErrorDetails.MANIFEST_LOAD_ERROR, i.ErrorDetails.MANIFEST_LOAD_TIMEOUT, i.ErrorDetails
  70378. .MANIFEST_PARSING_ERROR
  70379. ].some(function(e) {
  70380. return e === n.details
  70381. })) return void f.loadSource(e.src);
  70382. f.startLoad();
  70383. break;
  70384. case i.ErrorTypes.MEDIA_ERROR:
  70385. ! function(e) {
  70386. var t = Date.now();
  70387. if (!a || 3e3 < t - a) a = t, f.recoverMediaError();
  70388. else if (!s || 3e3 < t - s) s = t, f.swapAudioCodec(), f.recoverMediaError();
  70389. else {
  70390. if (l) return;
  70391. l = !0, r.error = function() {
  70392. return e
  70393. }, r.trigger("error")
  70394. }
  70395. }();
  70396. break;
  70397. default:
  70398. o()
  70399. }
  70400. }), f.attachMedia(h), f.loadSource(e.src), o.dispose = function() {
  70401. h.removeEventListener("play", m), f.destroy()
  70402. }, o.duration = function() {
  70403. return n || h.duration || 0
  70404. }, o.seekable = function() {
  70405. return t.createTimeRange(p, h.seekable.length && h.seekable.end(0) || h.duration)
  70406. }, o
  70407. };
  70408. (t.getTech && t.getTech("Html5") || t.getComponent && t.getComponent("Html5")).registerSourceHandler({
  70409. canHandleSource: function(e, t) {
  70410. return /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(e.type) && !1 !== (t.hlsJs || {})
  70411. .shouldHandle ? "probably" : ""
  70412. },
  70413. handleSource: function(e, t) {
  70414. return new r(e, t)
  70415. }
  70416. }, 0)
  70417. }
  70418. }(window, window.videojs, window.Hls);